def get_future_list(): # client_config = get_quote_client() # quote_client = QuoteClient(client_config) quote_client = get_quote_client() # exchanges = quote_client.get_future_exchanges() future_contracts = quote_client.get_future_contracts(exchange='NYMEX') print(future_contracts) # data = quote_client.get_future_trading_times('GF1908') data = quote_client.get_future_trade_ticks(identifiers='GF1908') print(data)
def get_future_quote(): # client_config = get_quote_client() # quote_client = QuoteClient(client_config) quote_client = get_quote_client() exchanges = quote_client.get_future_exchanges() print(exchanges) quote_client.get_future_bars(['CN1901'], begin_time=-1, end_time=1545105097358) quote_client.get_future_trade_ticks(['CN1901']) quote_client.get_future_contracts('CME') quote_client.get_future_trading_times('CN1901', trading_date=1545049282852) quote_client.get_future_brief(['ES1906', 'CN1901'])
# X轴刻度设置 date_locator = None if plotDateType == PlotDateType.MONTH: date_locator = dates.AutoDateFormatter(dates.MonthLocator()) elif plotDateType == PlotDateType.WEEK: date_locator = dates.AutoDateFormatter(dates.WeekdayLocator()) elif plotDateType == PlotDateType.DAY: date_locator = dates.AutoDateFormatter(dates.DateLocator()) g.format_xdata = date_locator # 鼠标hover 事件 # plt.gcf().canvas.mpl_connect('motion_notify_event', onpick) plt.title('ETF价格叠加图({0} - {1})'.format(date_2_month(min_date), date_2_month(max_date))) plt.legend() plt.show() if __name__ == '__main__': quote_client = get_quote_client() stocks = ['QQQ', 'SPY', 'WTI', 'IAU'] data = get_bars_from_cache(quote_client, symbols=stocks, period=BarPeriod.MONTH, begin_time=date_delta(-52 * 14), end_time=get_today()) # FIXME 用对数坐标替换 line_overlay_plot(data, stocks, PlotDateType.MONTH)