Beispiel #1
0
 def init_rqdata(self):
     """
     Init RQData client.
     """
     result = mddata_client.init()
     md_data_api = SETTINGS["mddata.api"]
     if result:
         self.write_log(f"{md_data_api}数据接口初始化成功")
Beispiel #2
0
 def init(self):
     """
     Start script engine.
     """
     result = mddata_client.init()
     md_data_api = SETTINGS("mdata.api")
     if result:
         self.write_log(f"{md_data_api}数据接口初始化成功")
Beispiel #3
0
 def init(self):
     """
     Start script engine.
     """
     # result = rqdata_client.init()
     # if result:
     #     self.write_log("RQData数据接口初始化成功")
     result = mddata_client.init()
     md_data_api = SETTINGS["mddata.api"]
     if result:
         self.write_log(f"{md_data_api}数据接口初始化成功")
Beispiel #4
0
 def init_rqdata(self):
     """
     Init RQData client.
     """
     try:
         result = mddata_client.init()
         md_data_api = SETTINGS["mddata.api"]
         if result:
             self.write_log(f"{md_data_api}数据接口初始化成功")
     except QuotaExceeded as e:
         self.write_log(f"{md_data_api}初始化异常{e.args}")
Beispiel #5
0
from datetime import datetime

from vnpy.trader.constant import Interval, Exchange
from vnpy.trader.mddata import mddata_client
from vnpy.trader.object import HistoryRequest


def download_history_data(symbol, exchange):
    print(symbol, exchange)
    begin_date = datetime.strptime("2019-09-19", "%Y-%m-%d")

    for i in range(1):
        start_date = begin_date.replace(year=begin_date.year + i)
        # end_date = begin_date.replace(year=begin_date.year + i + 1)
        end_date = datetime.now()

        print(start_date, end_date)
        req = HistoryRequest(symbol=symbol,
                             exchange=Exchange(exchange),
                             interval=Interval("1m"),
                             start=start_date,
                             end=end_date)
        data = mddata_client.query_history(req)


if __name__ == '__main__':
    mddata_client.init()

    download_history_data('RB1910', 'SHFE')