将数据管理页面中的更新数据部分提取出来,可以自己建一个定时任务,进行行情捕获,捕获内容根据自己HOME目录下的配置

import multiprocessing
from time import sleep
from datetime import datetime, time
from logging import INFO

from vnpy.event import EventEngine
from vnpy.trader.setting import SETTINGS
from vnpy.trader.engine import MainEngine
from vnpy.trader.constant import Interval, Exchange

from vnpy.gateway.gateios import GateiosGateway
from vnpy.gateway.okexs import OkexsGateway

from vnpy.app.cta_strategy import CtaStrategyApp
from vnpy.app.cta_strategy.base import EVENT_CTA_LOG

from vnpy.app.data_manager import DataManagerApp

SETTINGS["log.active"] = True
SETTINGS["log.level"] = INFO
SETTINGS["log.console"] = True
SETTINGS["log.file"] = True

connect_gateios = {
"API Key": "",
"Secret Key": "",
"服务器": "REAL",
"代理地址": "127.0.0.1",
"代理端口": "1087"
}
connect_okexs = {
"API Key": "",
"Secret Key": "",
"Passphrase": "523311",
"会话数": 3,
"代理地址": "127.0.0.1",
"代理端口": "1087"
}

def main():
event_engine = EventEngine()
main_engine = MainEngine(event_engine)
main_engine.add_gateway(OkexsGateway)
main_engine.connect(connect_okexs, "OKEXS")
sleep(30)
datamanager_engine = main_engine.add_app(DataManagerApp)
data = datamanager_engine.get_bar_data_available()
print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>开始获取数据<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
for d in data:
datamanager_engine.download_bar_data(
d["symbol"],
Exchange(d["exchange"]),
Interval(d["interval"]),
d["end"]
)
print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>获取数据完成<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
main_engine.close()

if name == "main":
main()