diff --git a/scripts/data_collector/utils.py b/scripts/data_collector/utils.py index ceb0735cb..883a1c551 100644 --- a/scripts/data_collector/utils.py +++ b/scripts/data_collector/utils.py @@ -32,6 +32,7 @@ CALENDAR_BENCH_URL_MAP = { "ALL": CALENDAR_URL_BASE.format(market=1, bench_code="000905"), # NOTE: Use the time series of ^GSPC(SP500) as the sequence of all stocks "US_ALL": "^GSPC", + "IN_ALL": "^NSEI", } @@ -68,7 +69,7 @@ def get_calendar_list(bench_code="CSI300") -> List[pd.Timestamp]: calendar = _CALENDAR_MAP.get(bench_code, None) if calendar is None: - if bench_code.startswith("US_"): + if bench_code.startswith("US_") or bench_code.startswith("IN_"): df = Ticker(CALENDAR_BENCH_URL_MAP[bench_code]).history(interval="1d", period="max") calendar = df.index.get_level_values(level="date").map(pd.Timestamp).unique().tolist() else: diff --git a/scripts/data_collector/yahoo/collector.py b/scripts/data_collector/yahoo/collector.py index d7518eca8..97e674293 100644 --- a/scripts/data_collector/yahoo/collector.py +++ b/scripts/data_collector/yahoo/collector.py @@ -733,6 +733,16 @@ class YahooNormalizeUS1min(YahooNormalizeUS, YahooNormalize1minOffline): return fname_to_code(symbol) +class YahooNormalizeIN: + def _get_calendar_list(self) -> Iterable[pd.Timestamp]: + # TODO: from MSN + return get_calendar_list("IN_ALL") + + +class YahooNormalizeIN1d(YahooNormalizeIN, YahooNormalize1d): + pass + + class YahooNormalizeCN: def _get_calendar_list(self) -> Iterable[pd.Timestamp]: # TODO: from MSN