Browse Source

bug改

master
lizhixin 4 years ago
parent
commit
97d1930217
  1. 10
      src/pages/Profit/index.vue
  2. 14
      src/pages/ReCheck/AccountInfo.vue
  3. 24
      src/pages/ReCheck/MoveTrend.vue
  4. 147
      src/pages/ReCheck/OrderTable.vue
  5. 103
      src/pages/ReCheck/index.vue
  6. 4
      src/pages/WinRate/index.vue
  7. 10
      src/pages/prePages/js/selectoptions.js

10
src/pages/Profit/index.vue

@ -11,8 +11,8 @@
v-model="form.NowCapital"
></base-input>
<base-input
label="冻结利润"
placeholder="冻结利润"
label="冻结利润"
placeholder="冻结利润"
v-model="form.FrozenProfit"
></base-input>
<base-input
@ -60,7 +60,11 @@ export default {
},
computed: {
total() {
return (this.form.NowCapital * this.form.TradeAmountRatio) / 100;
return (
((this.form.NowCapital - this.form.FrozenProfit) *
this.form.TradeAmountRatio) /
100
);
},
canSubmit() {
return (

14
src/pages/ReCheck/AccountInfo.vue

@ -1,6 +1,6 @@
<template>
<div>
<base-input
<!-- <base-input
label=" 单轮趋势最大持仓金额"
v-model="accountInfo.MaxOrderTotalPurchasePricePerRound"
disabled
@ -14,7 +14,17 @@
label=" 订单持仓最长时间"
v-model="accountInfo.MaxTotalPurchasePricePerDay"
disabled
></base-input>
></base-input> -->
<p>
单轮趋势最大持仓金额{{ accountInfo.MaxOrderTotalPurchasePricePerRound }}
</p>
<p>
单日持仓最大金额(当天内购买未在当天内出售){{
accountInfo.MaxTotalPurchasePricePerDay
}}
</p>
<p>
订单持仓最长时间{{
accountInfo.MaxOrderHoldTime && secToMin(accountInfo.MaxOrderHoldTime)

24
src/pages/ReCheck/MoveTrend.vue

@ -1,18 +1,18 @@
<template>
<div>
<base-input
<!-- <base-input
label="现有资金"
placeholder="现有资金"
v-model="form.NowCapital"
></base-input>
></base-input> -->
<base-input
label="原始资金"
placeholder="原始资金"
v-model="form.OriginalCapital"
label="资金"
placeholder="资金"
v-model="form.NowCapital"
></base-input>
<base-input
label="冻结利润比(%)"
placeholder="冻结利润比"
label="冻结金额"
placeholder="冻结金额"
v-model="form.FrozenProfit"
></base-input>
<base-input
@ -20,6 +20,7 @@
placeholder="下单金额比(%)"
v-model="form.TradeAmountRatio"
></base-input>
<p class="form-label">下单金额{{ total }}</p>
</div>
</template>
<script>
@ -38,6 +39,15 @@ export default {
},
data() {
return {};
},
computed: {
total() {
return (
((this.form.NowCapital - this.form.FrozenProfit) *
this.form.TradeAmountRatio) /
100
);
}
}
};
</script>

147
src/pages/ReCheck/OrderTable.vue

@ -1,75 +1,78 @@
<template>
<custom-base-table
:data="data"
:columns="columns"
thead-classes="text-primary"
>
<!-- 卖卖类型 -->
<template slot="OrderType">
<p>买入</p>
<p>卖出</p>
</template>
<!-- 买卖时间 -->
<template slot="KLineId" slot-scope="item">
<p>
{{
moment(item.row.item.PurchaseKLineId * 1000).format(
"YYYY-MM-DD HH:mm:ss"
)
}}
</p>
<p>
{{
item.row.item.SaleKLineId
? moment(item.row.item.SaleKLineId * 1000).format(
"YYYY-MM-DD HH:mm:ss"
)
: "-"
}}
</p>
</template>
<!-- 买卖价格 -->
<template slot="Price" slot-scope="item">
<p>{{ item.row.item.PurchasePrice || "-" }}</p>
<p>{{ item.row.item.SalePrice || "-" }}</p>
</template>
<!-- 买卖数量 -->
<template slot="Count" slot-scope="item">
<p>{{ item.row.item.PurchaseCoinCount || "-" }}</p>
<p>{{ item.row.item.SaleCoinCount || "-" }}</p>
</template>
<!-- 最大浮亏 -->
<template slot="MaxLossRatio" slot-scope="item">
<p>{{ item.row.item.MaxLossPrice || "-" }}</p>
<p>{{ item.row.item.MaxLossRatio || "-" }}%</p>
</template>
<!-- 盈亏 -->
<template slot="Profit" slot-scope="item">
<p>{{ item.row.item.Profit }}</p>
<p v-if="item.row.item.Profit">
{{
(
(item.row.item.Profit / item.row.item.TotalPurchasePrice) *
100
).toFixed(2)
}}%
</p>
<p v-else>-</p>
</template>
<!-- 累计盈亏 -->
<template slot="TotalProfit" slot-scope="item">
<p>{{ item.row.item.TotalProfit }}</p>
<p v-if="item.row.item.TotalProfit">
{{
(
(item.row.item.TotalProfit / policyFormData.PositionFund) *
100
).toFixed(2)
}}%
</p>
<p v-else>-</p>
</template>
</custom-base-table>
<div class="table-full-width table-responsive" style="height:500px">
<custom-base-table
:data="data"
:columns="columns"
thead-classes="text-primary"
>
<!-- 卖卖类型 -->
<template slot="OrderType">
<p>买入</p>
<p>卖出</p>
</template>
<!-- 买卖时间 -->
<template slot="KLineId" slot-scope="item">
<p>
{{ item.row.item.PurchaseKLineId
?
moment(item.row.item.PurchaseKLineId * 1000).format(
"YYYY-MM-DD HH:mm:ss"
) : "-"
}}
</p>
<p>
{{
item.row.item.SaleKLineId
? moment(item.row.item.SaleKLineId * 1000).format(
"YYYY-MM-DD HH:mm:ss"
)
: "-"
}}
</p>
</template>
<!-- 买卖价格 -->
<template slot="Price" slot-scope="item">
<p>{{ item.row.item.PurchasePrice || "-" }}</p>
<p>{{ item.row.item.SalePrice || "-" }}</p>
</template>
<!-- 买卖数量 -->
<template slot="Count" slot-scope="item">
<p>{{ item.row.item.PurchaseCoinCount || "-" }}</p>
<p>{{ item.row.item.SaleCoinCount || "-" }}</p>
</template>
<!-- 最大浮亏 -->
<template slot="MaxLossRatio" slot-scope="item">
<p>{{ item.row.item.MaxLossPrice || "-" }}</p>
<p>{{ item.row.item.MaxLossRatio || "-" }}%</p>
</template>
<!-- 盈亏 -->
<template slot="Profit" slot-scope="item">
<p>{{ item.row.item.Profit }}</p>
<p v-if="item.row.item.Profit">
{{
(
(item.row.item.Profit / item.row.item.TotalPurchasePrice) *
100
).toFixed(2)
}}%
</p>
<p v-else>-</p>
</template>
<!-- 累计盈亏 -->
<template slot="TotalProfit" slot-scope="item">
<p>{{ item.row.item.TotalProfit }}</p>
<p v-if="item.row.item.TotalProfit">
{{
(
(item.row.item.TotalProfit / policyFormData.PositionFund) *
100
).toFixed(2)
}}%
</p>
<p v-else>-</p>
</template>
</custom-base-table>
</div>
</template>
<script>
@ -78,7 +81,7 @@ import { tradeColumns } from "../../pages/prePages/js/columns";
import moment from "moment";
export default {
model: { prop: "data", event: "tableDataChange" },
props: { data: { type: Array, default: () => [] } },
props: { data: { type: Array, default: () => [] }, policyFormData: {} },
components: { CustomBaseTable },
data() {
return { moment, columns: tradeColumns };

103
src/pages/ReCheck/index.vue

@ -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;
});
}

4
src/pages/WinRate/index.vue

@ -271,8 +271,8 @@ export default {
//
isSignal(data) {
if (data[5] == 1 || data[6] == 1) {
return { up: data[5] == 1, low: data[6] == 1 };
if (data[10] == 1 || data[12] == 1) {
return { up: data[10] == 1, low: data[12] == 1 };
} else {
return false;
}

10
src/pages/prePages/js/selectoptions.js

@ -129,7 +129,11 @@ export const LogTypes = [
{ title: "做空", value: 3 },
{ title: "大趋势看多", value: 4 },
{ title: "大趋势看空", value: 5 },
{ title: "自动卖出", value: 10 },
{ title: "自动卖出(趋势收益)", value: 11 },
{ title: "订单回调", value: 12 }
{ title: "中趋势看多", value: 6 },
{ title: "中趋势看空", value: 7 },
{ title: "小趋势看多", value: 8 },
{ title: "小趋势看空", value: 9 },
{ title: "多交叉", value: 10 },
{ title: "空交叉", value: 11 },
{ title: "订单回调", value: 100 }
];

Loading…
Cancel
Save