From 1dff8b2587c3261f6e8483d7bd98fefc8ff51ba0 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Mon, 6 Dec 2021 10:00:43 +0800 Subject: [PATCH] =?UTF-8?q?[Mod]=20=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E5=88=B01.2.64.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- setup.cfg | 2 +- vnpy_tushare/tushare_datafeed.py | 12 ++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5811f31..e36c911 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@

- + 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" )