|
|
@ -46,7 +46,9 @@ |
|
|
|
> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
<base-button @click="test" class="ml-2">执行回测</base-button> |
|
|
|
<base-button @click="test" class="ml-2" :loading="excuting" |
|
|
|
>执行回测</base-button |
|
|
|
> |
|
|
|
<base-button class="ml-2">重置回测</base-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -135,7 +137,10 @@ |
|
|
|
<el-tabs value="1"> |
|
|
|
<!-- 交易清单 --> |
|
|
|
<el-tab-pane name="1" label="交易清单"> |
|
|
|
<order-table v-model="tradeData"></order-table> |
|
|
|
<order-table |
|
|
|
v-model="tradeData" |
|
|
|
:policyFormData="policyFormData" |
|
|
|
></order-table> |
|
|
|
</el-tab-pane> |
|
|
|
|
|
|
|
<!-- 信号记录 --> |
|
|
@ -158,18 +163,21 @@ |
|
|
|
@change="onOk" |
|
|
|
> |
|
|
|
</el-date-picker> |
|
|
|
<custom-base-table |
|
|
|
size="small" |
|
|
|
:columns="logColumns" |
|
|
|
:data="logData.filter(logShowCondition)" |
|
|
|
tbodyClasses="cTable" |
|
|
|
> |
|
|
|
<template slot="LogType" slot-scope="item"> |
|
|
|
{{ |
|
|
|
LogTypes.filter(i => i.value == item.row.item.LogType)[0].title |
|
|
|
}} |
|
|
|
</template> |
|
|
|
</custom-base-table> |
|
|
|
<div class="table-full-width table-responsive" style="height:500px"> |
|
|
|
<custom-base-table |
|
|
|
size="small" |
|
|
|
:columns="logColumns" |
|
|
|
:data="logData.filter(logShowCondition)" |
|
|
|
tbodyClasses="cTable" |
|
|
|
> |
|
|
|
<template slot="LogType" slot-scope="item"> |
|
|
|
{{ |
|
|
|
LogTypes.filter(i => i.value == item.row.item.LogType)[0] |
|
|
|
.title |
|
|
|
}} |
|
|
|
</template> |
|
|
|
</custom-base-table> |
|
|
|
</div> |
|
|
|
</el-tab-pane> |
|
|
|
<!-- 绩效总结 --> |
|
|
|
<el-tab-pane name="3" label="绩效总结"> |
|
|
@ -226,10 +234,10 @@ export default { |
|
|
|
tradeData: [], |
|
|
|
trendForm: { |
|
|
|
NowCapital: 10000, |
|
|
|
OriginalCapital: 12000, |
|
|
|
FrozenProfit: 12, |
|
|
|
TradeAmountRatio: 50 |
|
|
|
}, |
|
|
|
excuting: false, |
|
|
|
startTime: null, |
|
|
|
endTime: null, |
|
|
|
kLineData: {}, |
|
|
@ -447,7 +455,7 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
//动量回测数据处理 |
|
|
|
//5-小趋势 6-中趋势 7-大趋势 8-多交叉 9-空交叉 10-做多 12-做空 |
|
|
|
//5-小趋势 6-中趋势 7-大趋势 8-多交叉 9-空交叉 10-做多 12-做空 15-买入 14-卖出 |
|
|
|
mutateData(data) { |
|
|
|
let result = []; |
|
|
|
let postResult = []; |
|
|
@ -523,11 +531,14 @@ export default { |
|
|
|
} else if (j == 12) { |
|
|
|
if (data[i][j] != 0) postObj.N = 3; |
|
|
|
} else if (j == 15) { |
|
|
|
subArray[5] = {}; |
|
|
|
subArray[6] = {}; |
|
|
|
if (data[i][j] != 0) { |
|
|
|
postObj.N = 1; |
|
|
|
subArray[5] = { |
|
|
|
subArray[6] = { |
|
|
|
name: "卖出Point", |
|
|
|
symbol: "diamond", |
|
|
|
symbolSize: [15, 25], |
|
|
|
symbolOffset: [0, 25], |
|
|
|
coord: [ |
|
|
|
`${moment(data[i][0] * 1000).format( |
|
|
|
"YYYY-MM-DD HH:mm:ss" |
|
|
@ -541,14 +552,11 @@ export default { |
|
|
|
}; |
|
|
|
} |
|
|
|
} else if (j == 14) { |
|
|
|
subArray[6] = {}; |
|
|
|
subArray[5] = {}; |
|
|
|
if (data[i][j] != 0) { |
|
|
|
postObj.N = 0; |
|
|
|
subArray[6] = { |
|
|
|
subArray[5] = { |
|
|
|
name: "买入Point", |
|
|
|
symbol: "diamond", |
|
|
|
symbolSize: [15, 25], |
|
|
|
symbolOffset: [0, 25], |
|
|
|
coord: [ |
|
|
|
`${moment(data[i][0] * 1000).format( |
|
|
|
"YYYY-MM-DD HH:mm:ss" |
|
|
@ -679,6 +687,7 @@ export default { |
|
|
|
executeTest() { |
|
|
|
if (this.policyFormData && this.kLineDataList.length > 0) { |
|
|
|
this.spinning = true; |
|
|
|
this.excuting = true; |
|
|
|
this.$http |
|
|
|
.post("/Api/Simulation/MomentumWaveTest", { |
|
|
|
MomentumWavePolicy: this.policyFormData, |
|
|
@ -687,6 +696,7 @@ export default { |
|
|
|
.then(res => { |
|
|
|
this.logShowCondition = i => true; |
|
|
|
this.spinning = false; |
|
|
|
this.excuting = false; |
|
|
|
if (res.Code == 200) { |
|
|
|
console.log("回测成功"); |
|
|
|
this.logData = res.Data.ExecutionLogList; |
|
|
@ -696,32 +706,34 @@ export default { |
|
|
|
].CreateTime; |
|
|
|
this.dateRange[1] = this.logData[0].CreateTime; |
|
|
|
} |
|
|
|
res.Data.OrderList.sort( |
|
|
|
(a, b) => b.PurchaseKLineId - a.PurchaseKLineId |
|
|
|
); |
|
|
|
// res.Data.OrderList.sort( |
|
|
|
// (a, b) => b.PurchaseKLineId - a.PurchaseKLineId |
|
|
|
// ); |
|
|
|
this.tradeData = res.Data.OrderList; |
|
|
|
//accountInfo |
|
|
|
this.accountInfo.MaxOrderTotalPurchasePricePerRound = |
|
|
|
res.Data.MaxOrderTotalPurchasePricePerRound; |
|
|
|
this.accountInfo.MaxTotalPurchasePricePerDay = |
|
|
|
res.Data.MaxTotalPurchasePricePerDay; |
|
|
|
this.accountInfo.MaxOrderHoldTime = res.Data.MaxOrderHoldTime; |
|
|
|
this.accountInfo.MinOrderHoldTime = res.Data.MinOrderHoldTime; |
|
|
|
this.accountInfo.MaxOrderLossRatio = res.Data.MaxOrderLossRatio; |
|
|
|
this.accountInfo.MaxAccountLossRatio = |
|
|
|
res.Data.MaxAccountLossRatio; |
|
|
|
this.accountInfo.MaxOrderProfit = res.Data.MaxOrderProfit; |
|
|
|
this.accountInfo.MaxOrderProfitRatio = |
|
|
|
res.Data.MaxOrderProfitRatio; |
|
|
|
this.accountInfo.MinOrderProfit = res.Data.MinOrderProfit; |
|
|
|
this.accountInfo.MinOrderProfitRatio = |
|
|
|
res.Data.MinOrderProfitRatio; |
|
|
|
// //accountInfo |
|
|
|
// this.accountInfo.MaxOrderTotalPurchasePricePerRound = |
|
|
|
// res.Data.MaxOrderTotalPurchasePricePerRound; |
|
|
|
// this.accountInfo.MaxTotalPurchasePricePerDay = |
|
|
|
// res.Data.MaxTotalPurchasePricePerDay; |
|
|
|
// this.accountInfo.MaxOrderHoldTime = res.Data.MaxOrderHoldTime; |
|
|
|
// this.accountInfo.MinOrderHoldTime = res.Data.MinOrderHoldTime; |
|
|
|
// this.accountInfo.MaxOrderLossRatio = res.Data.MaxOrderLossRatio; |
|
|
|
// this.accountInfo.MaxAccountLossRatio = |
|
|
|
// res.Data.MaxAccountLossRatio; |
|
|
|
// this.accountInfo.MaxOrderProfit = res.Data.MaxOrderProfit; |
|
|
|
// this.accountInfo.MaxOrderProfitRatio = |
|
|
|
// res.Data.MaxOrderProfitRatio; |
|
|
|
// this.accountInfo.MinOrderProfit = res.Data.MinOrderProfit; |
|
|
|
// this.accountInfo.MinOrderProfitRatio = |
|
|
|
// res.Data.MinOrderProfitRatio; |
|
|
|
this.accountInfo = { ...res.Data }; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
executeTrendTest() { |
|
|
|
if (this.trendForm && this.kLineDataList.length > 0) { |
|
|
|
this.excuting = true; |
|
|
|
this.$http |
|
|
|
.post("/Api/Simulation/MomentumTrendTest", { |
|
|
|
Capital: { |
|
|
@ -732,13 +744,14 @@ export default { |
|
|
|
kLineDataList: this.kLineDataList |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
this.excuting = false; |
|
|
|
if (res.Code == 200) { |
|
|
|
this.sMessage("success", "回测完成"); |
|
|
|
} |
|
|
|
this.logData = res.Data.ExecutionLogList; |
|
|
|
res.Data.OrderList.sort( |
|
|
|
(a, b) => b.PurchaseKLineId - a.PurchaseKLineId |
|
|
|
); |
|
|
|
// res.Data.OrderList.sort( |
|
|
|
// (a, b) => b.PurchaseKLineId - a.PurchaseKLineId |
|
|
|
// ); |
|
|
|
this.tradeData = res.Data.OrderList; |
|
|
|
}); |
|
|
|
} |
|
|
|