Merge pull request #1795 from vnpy/bug-fix

Bug fix
This commit is contained in:
vn.py 2019-06-05 19:30:39 +08:00 committed by GitHub
commit c83a762015
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
@ -75,6 +79,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]
@ -118,24 +127,27 @@ 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] = []
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