From 04cb7df3e9b7483ea68a428373294c09eeb5a029 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Wed, 5 Jun 2019 17:56:23 +0800 Subject: [PATCH 1/4] [Fix] close #1754 --- vnpy/trader/rqdata.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/vnpy/trader/rqdata.py b/vnpy/trader/rqdata.py index f3e650bc..070843c8 100644 --- a/vnpy/trader/rqdata.py +++ b/vnpy/trader/rqdata.py @@ -122,20 +122,22 @@ class RqdataClient: ) data: List[BarData] = [] - for ix, row in df.iterrows(): - bar = BarData( - symbol=symbol, - exchange=exchange, - interval=interval, - datetime=row.name.to_pydatetime() - adjustment, - open_price=row["open"], - high_price=row["high"], - low_price=row["low"], - close_price=row["close"], - volume=row["volume"], - gateway_name="RQ" - ) - data.append(bar) + + if df is not None: + for ix, row in df.iterrows(): + bar = BarData( + symbol=symbol, + exchange=exchange, + interval=interval, + datetime=row.name.to_pydatetime() - adjustment, + open_price=row["open"], + high_price=row["high"], + low_price=row["low"], + close_price=row["close"], + volume=row["volume"], + gateway_name="RQ" + ) + data.append(bar) return data From 1f5a57c2c7cbbd63237736f71155fc3beab7af5f Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Wed, 5 Jun 2019 18:09:10 +0800 Subject: [PATCH 2/4] [Fix] close #1753 --- vnpy/trader/rqdata.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vnpy/trader/rqdata.py b/vnpy/trader/rqdata.py index 070843c8..ef55a031 100644 --- a/vnpy/trader/rqdata.py +++ b/vnpy/trader/rqdata.py @@ -75,6 +75,11 @@ class RqdataClient: if word.isdigit(): break + # Check for index symbol + time_str = symbol[count:] + if time_str in ["88", "888", "99"]: + return symbol + # noinspection PyUnboundLocalVariable product = symbol[:count] year = symbol[count] From be315e4bc1152a85c695673339b066850e6a803e Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Wed, 5 Jun 2019 19:17:23 +0800 Subject: [PATCH 3/4] [Mod] use no adjustment type of equity history data --- vnpy/trader/rqdata.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vnpy/trader/rqdata.py b/vnpy/trader/rqdata.py index ef55a031..87515e59 100644 --- a/vnpy/trader/rqdata.py +++ b/vnpy/trader/rqdata.py @@ -123,7 +123,8 @@ class RqdataClient: frequency=rq_interval, fields=["open", "high", "low", "close", "volume"], start_date=start, - end_date=end + end_date=end, + adjust_type="none" ) data: List[BarData] = [] From b0edd7fe884edaa344a801f0b4769604f7c88d5d Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Wed, 5 Jun 2019 19:24:44 +0800 Subject: [PATCH 4/4] [Mod] change init function of RqDataClient --- vnpy/trader/rqdata.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vnpy/trader/rqdata.py b/vnpy/trader/rqdata.py index 87515e59..630a82f6 100644 --- a/vnpy/trader/rqdata.py +++ b/vnpy/trader/rqdata.py @@ -36,11 +36,15 @@ class RqdataClient: self.inited = False self.symbols = set() - def init(self): + def init(self, username="", password=""): """""" if self.inited: return True + if username and password: + self.username = username + self.password = password + if not self.username or not self.password: return False