From 1dff8b2587c3261f6e8483d7bd98fefc8ff51ba0 Mon Sep 17 00:00:00 2001
From: "vn.py"
- + diff --git a/setup.cfg b/setup.cfg index 063bea0..5350d52 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = vnpy_tushare -version = 1.2.64.1 +version = 1.2.64.2 url = https://www.vnpy.com license = MIT author = Xiaoyou Chen diff --git a/vnpy_tushare/tushare_datafeed.py b/vnpy_tushare/tushare_datafeed.py index 597437c..946f59c 100644 --- a/vnpy_tushare/tushare_datafeed.py +++ b/vnpy_tushare/tushare_datafeed.py @@ -180,6 +180,14 @@ def query_bar_history(self, req: HistoryRequest) -> Optional[List[BarData]]: dt = CHINA_TZ.localize(dt) + turnover = row.get("amount", 0) + if turnover is None: + turnover = 0 + + open_interest = row.get("oi", 0) + if open_interest is None: + open_interest = 0 + bar: BarData = BarData( symbol=symbol, exchange=exchange, @@ -190,8 +198,8 @@ def query_bar_history(self, req: HistoryRequest) -> Optional[List[BarData]]: low_price=round_to(row["low"], 0.000001), close_price=round_to(row["close"], 0.000001), volume=row["vol"], - turnover=row.get("amount", 0) if row.get("amount", 0) else 0, - open_interest=row.get("oi", 0) if row.get("oi", 0) else 0, + turnover=turnover, + open_interest=open_interest, gateway_name="TS" )