[update]
This commit is contained in:
parent
5ddbf6541a
commit
4e006e59fd
@ -16,8 +16,10 @@ os.environ["VNPY_TESTING"] = "1"
|
||||
|
||||
from vnpy.data.tdx.tdx_future_data import *
|
||||
from vnpy.trader.util_wechat import send_wx_msg
|
||||
from vnpy.trader.utility import load_json, save_json
|
||||
from vnpy.trader.utility import load_json, save_json, append_data
|
||||
|
||||
log_csv_name = 'dominat_change_history.csv'
|
||||
field_names = ['account_name', 'strategy_name', 'old_vt_symbol', 'new_vt_symbol', 'datetime']
|
||||
if __name__ == "__main__":
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
@ -103,6 +105,16 @@ if __name__ == "__main__":
|
||||
setting.update({'vt_symbol': new_vt_symbol})
|
||||
send_wx_msg(f'{account_name}{strategy_name} 主力合约更换:{vt_symbol} => {new_vt_symbol} ')
|
||||
changed = True
|
||||
# 写入日志csv,供后续检查
|
||||
append_data(file_name=log_csv_name,
|
||||
dict_data={
|
||||
'account_name': account_name,
|
||||
'strategy_name': strategy_name,
|
||||
'old_vt_symbol': vt_symbol,
|
||||
'new_vt_symbol': new_vt_symbol,
|
||||
'datetime': datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
},
|
||||
field_names=field_names)
|
||||
|
||||
if changed:
|
||||
save_json(setting_file_path, settings)
|
||||
|
@ -18,8 +18,8 @@ from vnpy.trader.utility import get_csv_last_dt, append_data
|
||||
|
||||
# 获取币安合约交易的所有期货合约
|
||||
future_data = BinanceFutureData()
|
||||
contracts = BinanceFutureData.load_contracts()
|
||||
if len(contracts) == 0:
|
||||
|
||||
# 获取全量合约信息
|
||||
future_data.save_contracts()
|
||||
contracts = BinanceFutureData.load_contracts()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user