是的,系统只支持'FUTURE':期货的买入时间。对于自己手动记录,可参考以下代码,使用pandas
#encoding:gbk
import pandas as pd
import numpy as np
class a():
pass
A = a()
def init(ContextInfo):
#建仓自己手动记录信息
A.data =[
{'stock': '601225.SH', 'start_date': '20240401', 'quantity': 100, 'weight': 0.11, 'optType': 23},
{'stock': '600377.SH', 'start_date': '20240604', 'quantity': 200, 'weight': 0.11, 'optType': 23},
{'stock': '603199.SH', 'start_date': '20240401', 'quantity': 100, 'weight': 0.11, 'optType': 23}
]
A.df = pd.DataFrame(A.data)
A.df.set_index('stock',inplace=True)
print('\n建仓股票池:', [item['stock'] for item in A.data])
print('\n建仓的日期:', [item['start_date']for item in A.data])
|