基于友人需求,特发基于股票的自定义合约回测方法
1.创建自定义合约方法
a. 手动创建步骤
? 1.选中行情框内任意合约,单击选中合约,右键交易品种
弹出自定义合约配置页面
? 选中custom 点击创建自定义交易品种
输入交易代码 000001,图标模式:最后价格, 计算:exchange stock
其他非关键信息可以无需填写,如果想分层分类,在组路径设置即可?
点击 确定,完成创建
b. 导入配置好的配置文件
配置文件是一种基于json的文件格式
{
"ConfigSymbols": [
{
"Symbol": "000001",
"Path": "Custom\\sz\\000001",
"Exchange": "\u6df1\u5733\u8bc1\u5238\u4ea4\u6613\u6240",
"Description": "\u5e73\u5b89\u94f6\u884c",
"ISIN": "",
"Category": "",
"Basis": "",
"Page": "",
"CurrencyBase": "RMB",
"CurrencyProfit": "RMB",
"CurrencyMargin": "RMB",
"ColorBackground": "4278190080",
"Digits": "2",
"Point": "0.01",
"TickFlags": "1",
"TickBookDepth": "10",
"TickChartMode": "1",
"TradeMode": "4",
"TradeFlags": "2",
"CalcMode": "32",
"ExecMode": "1",
"GTCMode": "0",
"FillFlags": "1",
"ExpirFlags": "15",
"OrderFlags": "127",
"Spread": "0",
"TickValue": "1.0",
"TickSize": "0.01",
"ContractSize": "100",
"StopsLevel": "5",
"FreezeLevel": "0",
"VolumeMin": "1",
"VolumeMinExt": "1",
"VolumeMax": "1000000",
"VolumeMaxExt": "1000000",
"VolumeStep": "1",
"VolumeStepExt": "1",
"VolumeLimit": "0",
"VolumeLimitExt": "0",
"MarginFlags": "0",
"MarginInitial": "0",
"MarginMaintenance": "0",
"MarginInitialBuy": "1",
"MarginInitialSell": "1",
"MarginInitialBuyLimit": "1",
"MarginInitialSellLimit": "1",
"MarginInitialBuyStop": "0",
"MarginInitialSellStop": "1",
"MarginInitialBuyStopLimit": "1",
"MarginInitialSellStopLimit": "1",
"MarginMaintenanceBuy": "0",
"MarginMaintenanceSell": "0",
"MarginMaintenanceBuyLimit": "0",
"MarginMaintenanceSellLimit": "0",
"MarginMaintenanceBuyStop": "0",
"MarginMaintenanceSellStop": "0",
"MarginMaintenanceBuyStopLimit": "0",
"MarginMaintenanceSellStopLimit": "0",
"MarginLiquidity": "0",
"MarginHedged": "100000",
"SwapMode": "0",
"SwapLong": "0",
"SwapShort": "0",
"Swap3Day": "3",
"TimeStart": "0",
"TimeExpiration": "0",
"SessionsQuotes": [
[
],
[
{
"Open": "570",
"Close": "900"
}
],
[
{
"Open": "570",
"Close": "900"
}
],
[
{
"Open": "570",
"Close": "900"
}
],
[
{
"Open": "570",
"Close": "900"
}
],
[
{
"Open": "570",
"Close": "900"
}
],
[
]
],
"SessionsTrades": [
[
],
[
{
"Open": "570",
"Close": "900"
}
],
[
{
"Open": "570",
"Close": "900"
}
],
[
{
"Open": "570",
"Close": "900"
}
],
[
{
"Open": "570",
"Close": "900"
}
],
[
{
"Open": "570",
"Close": "900"
}
],
[
]
],
"PriceSettle": "0",
"PriceLimitMax": "0",
"PriceLimitMin": "0",
"PriceStrike": "0",
"OptionMode": "0",
"FaceValue": "0",
"AccruedInterest": "0",
"PricesAllowNegative": "0",
"Formula": ""
}
]
}
只需要修改symbol信息即可
选择导入即可
c 基于配置文件的批量导入
选中custom 右键 导入自定义组
选择配置好的json文件
完成
|