mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-17 17:34:35 +08:00
add YahooNormalizeIN and YahooNormalizeIN1d
This commit is contained in:
@@ -32,6 +32,7 @@ CALENDAR_BENCH_URL_MAP = {
|
|||||||
"ALL": CALENDAR_URL_BASE.format(market=1, bench_code="000905"),
|
"ALL": CALENDAR_URL_BASE.format(market=1, bench_code="000905"),
|
||||||
# NOTE: Use the time series of ^GSPC(SP500) as the sequence of all stocks
|
# NOTE: Use the time series of ^GSPC(SP500) as the sequence of all stocks
|
||||||
"US_ALL": "^GSPC",
|
"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)
|
calendar = _CALENDAR_MAP.get(bench_code, None)
|
||||||
if calendar is 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")
|
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()
|
calendar = df.index.get_level_values(level="date").map(pd.Timestamp).unique().tolist()
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -733,6 +733,16 @@ class YahooNormalizeUS1min(YahooNormalizeUS, YahooNormalize1minOffline):
|
|||||||
return fname_to_code(symbol)
|
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:
|
class YahooNormalizeCN:
|
||||||
def _get_calendar_list(self) -> Iterable[pd.Timestamp]:
|
def _get_calendar_list(self) -> Iterable[pd.Timestamp]:
|
||||||
# TODO: from MSN
|
# TODO: from MSN
|
||||||
|
|||||||
Reference in New Issue
Block a user