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

14
src/pages/ReCheck/AccountInfo.vue

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

24
src/pages/ReCheck/MoveTrend.vue

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

147
src/pages/ReCheck/OrderTable.vue

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

103
src/pages/ReCheck/index.vue

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

4
src/pages/WinRate/index.vue

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

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

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

Loading…
Cancel
Save