[Add]interval map from vt to rqdata
This commit is contained in:
parent
e4caa5996c
commit
769e70290d
@ -10,6 +10,13 @@ from .constant import Exchange, Interval
|
|||||||
from .object import BarData
|
from .object import BarData
|
||||||
|
|
||||||
|
|
||||||
|
INTERVAL_VT2RQ = {
|
||||||
|
Interval.MINUTE: "1m",
|
||||||
|
Interval.HOUR: "1h",
|
||||||
|
Interval.DAILY: "1d",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class RqdataClient:
|
class RqdataClient:
|
||||||
"""
|
"""
|
||||||
Client for querying history data from RQData.
|
Client for querying history data from RQData.
|
||||||
@ -91,11 +98,15 @@ class RqdataClient:
|
|||||||
if rq_symbol not in self.symbols:
|
if rq_symbol not in self.symbols:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
rq_interval = INTERVAL_VT2RQ.get(interval)
|
||||||
|
if not rq_interval:
|
||||||
|
return None
|
||||||
|
|
||||||
end += timedelta(1) # For querying night trading period data
|
end += timedelta(1) # For querying night trading period data
|
||||||
|
|
||||||
df = rqdata_get_price(
|
df = rqdata_get_price(
|
||||||
rq_symbol,
|
rq_symbol,
|
||||||
frequency=interval.value,
|
frequency=rq_interval,
|
||||||
fields=["open", "high", "low", "close", "volume"],
|
fields=["open", "high", "low", "close", "volume"],
|
||||||
start_date=start,
|
start_date=start,
|
||||||
end_date=end
|
end_date=end
|
||||||
|
Loading…
Reference in New Issue
Block a user