|
19 | 19 | FUTURE_CONTRACTS, MARKET_SCANNER, \ |
20 | 20 | STOCK_BROKER, CAPITAL_FLOW, CAPITAL_DISTRIBUTION, WARRANT_REAL_TIME_QUOTE, WARRANT_FILTER, MARKET_SCANNER_TAGS, \ |
21 | 21 | KLINE_QUOTA, FUND_ALL_SYMBOLS, FUND_CONTRACTS, FUND_QUOTE, FUND_HISTORY_QUOTE, FINANCIAL_CURRENCY, \ |
22 | | - FINANCIAL_EXCHANGE_RATE, ALL_HK_OPTION_SYMBOLS, OPTION_DEPTH, BROKER_HOLD |
| 22 | + FINANCIAL_EXCHANGE_RATE, ALL_HK_OPTION_SYMBOLS, OPTION_DEPTH, BROKER_HOLD, OPTION_TIMELINE |
23 | 23 | from tigeropen.common.consts.service_types import MARKET_STATE, ALL_SYMBOLS, ALL_SYMBOL_NAMES, BRIEF, \ |
24 | 24 | TIMELINE, KLINE, TRADE_TICK, OPTION_EXPIRATION, OPTION_CHAIN, FUTURE_EXCHANGE, OPTION_BRIEF, \ |
25 | 25 | OPTION_KLINE, OPTION_TRADE_TICK, FUTURE_KLINE, FUTURE_TICK, FUTURE_CONTRACT_BY_EXCHANGE_CODE, \ |
|
68 | 68 | from tigeropen.quote.response.option_quote_bar_response import OptionQuoteBarResponse |
69 | 69 | from tigeropen.quote.response.option_quote_ticks_response import OptionTradeTickResponse |
70 | 70 | from tigeropen.quote.response.option_symbols_response import OptionSymbolsResponse |
| 71 | +from tigeropen.quote.response.option_timeline_response import OptionTimelineResponse |
71 | 72 | from tigeropen.quote.response.quote_bar_response import QuoteBarResponse |
72 | 73 | from tigeropen.quote.response.quote_brief_response import QuoteBriefResponse |
73 | 74 | from tigeropen.quote.response.quote_delay_briefs_response import DelayBriefsResponse |
@@ -937,6 +938,34 @@ def get_option_depth(self, identifiers, market: Market = Market.US, timezone=Non |
937 | 938 | else: |
938 | 939 | raise ApiException(response.code, response.message) |
939 | 940 |
|
| 941 | + def get_option_timeline(self, identifiers, market: Market, begin_time=None, timezone=None): |
| 942 | + params = OptionContractsParams() |
| 943 | + contracts = [] |
| 944 | + for identifier in identifiers: |
| 945 | + symbol, expiry, put_call, strike = extract_option_info(identifier) |
| 946 | + if symbol is None or expiry is None or put_call is None or strike is None: |
| 947 | + continue |
| 948 | + param = SingleOptionQuoteParams() |
| 949 | + param.symbol = symbol |
| 950 | + param.expiry = date_str_to_timestamp(expiry, self._parse_timezone(timezone, market)) |
| 951 | + param.put_call = put_call |
| 952 | + param.strike = strike |
| 953 | + param.begin_time = date_str_to_timestamp(begin_time, self._parse_timezone(timezone, market)) |
| 954 | + contracts.append(param) |
| 955 | + params.option_query = contracts |
| 956 | + if market: |
| 957 | + params.market = get_enum_value(market) |
| 958 | + request = OpenApiRequest(OPTION_TIMELINE, biz_model=params) |
| 959 | + response_content = self.__fetch_data(request) |
| 960 | + if response_content: |
| 961 | + response = OptionTimelineResponse() |
| 962 | + response.parse_response_content(response_content) |
| 963 | + if response.is_success(): |
| 964 | + return response.result |
| 965 | + else: |
| 966 | + raise ApiException(response.code, response.message) |
| 967 | + |
| 968 | + |
940 | 969 | def get_future_exchanges(self, sec_type=SecurityType.FUT, lang=None): |
941 | 970 | """ |
942 | 971 | 获取期货交易所列表 |
|
0 commit comments