Browse Source

多个表解析

master
lizhixin 4 years ago
parent
commit
e75d0ac048
  1. 18
      src/pages/ReCheck/AccountInfo.vue
  2. 4
      src/pages/ReCheck/MoveTrend.vue
  3. 7
      src/pages/ReCheck/OrderTable.vue
  4. 171
      src/pages/ReCheck/index.vue

18
src/pages/ReCheck/AccountInfo.vue

@ -19,10 +19,20 @@
单轮趋势最大持仓金额{{ accountInfo.MaxOrderTotalPurchasePricePerRound }} 单轮趋势最大持仓金额{{ accountInfo.MaxOrderTotalPurchasePricePerRound }}
</p> </p>
<p> <p
单日持仓最大金额(当天内购买未在当天内出售){{ v-if="
accountInfo.MaxTotalPurchasePricePerDay accountInfo.TotalPurchaseInfoList &&
}} accountInfo.TotalPurchaseInfoList[0]
"
>
单日持仓最大金额(当天内购买未在当天内出售)<span
v-for="(item, index) in accountInfo.TotalPurchaseInfoList"
:key="index + '12'"
>{{ item.TotalPurchasePrice }}
{{
index == accountInfo.TotalPurchaseInfoList.length - 1 ? "" : "---"
}}</span
>
</p> </p>
<p> <p>

4
src/pages/ReCheck/MoveTrend.vue

@ -21,6 +21,10 @@
v-model="form.TradeAmountRatio" v-model="form.TradeAmountRatio"
></base-input> ></base-input>
<p class="form-label">下单金额{{ total }}</p> <p class="form-label">下单金额{{ total }}</p>
<base-checkbox inline v-model="form.IsEnabledLimit">
是否启用限价单
</base-checkbox>
</div> </div>
</template> </template>
<script> <script>

7
src/pages/ReCheck/OrderTable.vue

@ -80,12 +80,7 @@
<template slot="TotalProfit" slot-scope="item"> <template slot="TotalProfit" slot-scope="item">
<p>{{ item.row.item.TotalProfit }}</p> <p>{{ item.row.item.TotalProfit }}</p>
<p v-if="item.row.item.TotalProfit"> <p v-if="item.row.item.TotalProfit">
{{ {{ item.row.item.TotalProfitRatio }}%
(
(item.row.item.TotalProfit / item.row.item.TotalPurchasePrice) *
100
).toFixed(2)
}}%
</p> </p>
<p v-else>-</p> <p v-else>-</p>
</template> </template>

171
src/pages/ReCheck/index.vue

@ -68,11 +68,11 @@
@change="onKlineExcelChange" @change="onKlineExcelChange"
> >
<el-option <el-option
v-for="item in kLinesFromExcels" v-for="item in excelTabsData"
class="select-danger" class="select-danger"
:label="item.name" :label="item.Symbol"
:key="item.name" :key="item.Symbol"
:value="item.name" :value="item.Symbol"
> >
</el-option> </el-option>
</el-select> </el-select>
@ -135,13 +135,17 @@
</el-tabs> </el-tabs>
</div> </div>
<div> <div>
<el-tabs value="1"> <el-tabs>
<el-tab-pane
v-for="(item, index) in excelTabsData"
:key="item.Symbol + '' + index"
:label="item.Symbol"
>
<card
><el-tabs value="1">
<!-- 交易清单 --> <!-- 交易清单 -->
<el-tab-pane name="1" label="交易清单"> <el-tab-pane name="1" label="交易清单">
<order-table <order-table v-model="item.tradeData"></order-table>
v-model="tradeData"
:positionFund="PositionFund"
></order-table>
</el-tab-pane> </el-tab-pane>
<!-- 信号记录 --> <!-- 信号记录 -->
@ -164,24 +168,34 @@
@change="onOk" @change="onOk"
> >
</el-date-picker> </el-date-picker>
<div class="table-full-width table-responsive" style="height:500px"> <div
class="table-full-width table-responsive"
style="height:500px"
>
<custom-base-table <custom-base-table
v-if="item.logData"
size="small" size="small"
:columns="logColumns" :columns="logColumns"
:data="logData.filter(logShowCondition)" :data="item.logData.filter(logShowCondition)"
tbodyClasses="cTable" tbodyClasses="cTable"
> >
<template slot="LogType" slot-scope="item"> <template slot="LogType" slot-scope="item">
{{ {{
LogTypes.filter(i => i.value == item.row.item.LogType)[0] LogTypes.filter(
.title i => i.value == item.row.item.LogType
)[0].title
}} }}
</template> </template>
</custom-base-table> </custom-base-table>
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane name="3" :label="`${item.Symbol}绩效总结`">
<account-info v-model="item.accountInfo" />
</el-tab-pane> </el-tabs
></card>
</el-tab-pane>
<!-- 绩效总结 --> <!-- 绩效总结 -->
<el-tab-pane name="3" label="绩效总结"> <el-tab-pane name="3" label="绩效总结">
<account-info v-model="accountInfo" /> <account-info v-model="accountInfo" />
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
@ -207,6 +221,7 @@ import OrderTable from "./OrderTable";
import CustomBaseTable from "../../components/CustomBaseTable.vue"; import CustomBaseTable from "../../components/CustomBaseTable.vue";
import MoveTrend from "./MoveTrend"; import MoveTrend from "./MoveTrend";
import { deepClone } from "../../utils/util"; import { deepClone } from "../../utils/util";
import Card from "../../components/Cards/Card.vue";
// import TopEndPolicy from "../components/TopEndPolicy.vue"; // import TopEndPolicy from "../components/TopEndPolicy.vue";
export default { export default {
components: { components: {
@ -215,7 +230,8 @@ export default {
MovementPolicyForm, MovementPolicyForm,
OrderTable, OrderTable,
CustomBaseTable, CustomBaseTable,
MoveTrend MoveTrend,
Card
// HQKline // HQKline
// TopEndPolicy // TopEndPolicy
@ -227,7 +243,6 @@ export default {
LogTypes, LogTypes,
spinning: false, spinning: false,
lineSelect: "", lineSelect: "",
kLinesFromExcels: [],
tradeColumns, tradeColumns,
logColumns, logColumns,
logData: [], logData: [],
@ -238,7 +253,8 @@ export default {
trendForm: { trendForm: {
NowCapital: 10000, NowCapital: 10000,
FrozenProfit: 12, FrozenProfit: 12,
TradeAmountRatio: 50 TradeAmountRatio: 50,
IsEnabledLimit: false
}, },
excuting: false, excuting: false,
startTime: null, startTime: null,
@ -252,6 +268,7 @@ export default {
topTempDataList: [], topTempDataList: [],
buyPointCountList: [], buyPointCountList: [],
salePointCountList: [], salePointCountList: [],
excelTabsData: [],
logShowCondition: i => true logShowCondition: i => true
}; };
}, },
@ -320,61 +337,46 @@ export default {
onKlineExcelChange(model) { onKlineExcelChange(model) {
console.log(model); console.log(model);
if ( if (
this.kLinesFromExcels && this.excelTabsData &&
this.kLinesFromExcels.length > 0 && this.excelTabsData.length > 0 &&
this.kLinesFromExcels.some(item => item.name == model) this.excelTabsData.some(item => item.Symbol == model)
) { ) {
let result = []; let result = [];
// if (this.policyMode == 0) { let data = this.excelTabsData.filter(item => item.Symbol == model)[0]
let data = this.kLinesFromExcels.filter(item => item.name == model)[0]
.data; .data;
let temp = this.mutateData(data); //datadata let temp = this.mutateData(data); //datadata
result = this.splitData(temp.kLineData); //data result = this.splitData(temp.kLineData); //data
this.kLineDataList = temp.postData; // this.kLineDataList = temp.postData;
this.kLineData = result; this.kLineData = result;
// } else {
// let index = 0;
// for (let i = 0; i < this.kLinesFromExcels.length; i++) {
// if (this.kLinesFromExcels[i].name == model) {
// index = i;
// break;
// }
// }
// let temp = this.topMutateData(this.topTempDataList[index]);
// result = this.splitData(temp.kLineData); //data
// this.kLineData = result;
// }
} }
}, },
excelImport() { excelImport() {
let that = this; let that = this;
let result = [];
this.spinning = true; this.spinning = true;
this.excelTabsData = [];
Excel.importExcel(data => { Excel.importExcel(data => {
that.spinning = false; that.spinning = false;
if (data && data[0]) { if (data && data[0]) {
// if (this.policyMode == 1) { this.lineSelect = data[0].name; //modelName
// this.kLinesFromExcels = data; data.forEach(element => {
// this.lineSelect = data[0].name; let result = [];
// let _data = []; let sIndex = element.name.indexOf("_") + 1;
// data.forEach(element => { let eIndex = element.name.indexOf("USDT") + 4;
// _data.push(element.data); let cutName = element.name.substring(sIndex, eIndex);
// }); let temp = that.mutateData(element.data); //datadata
// this.topEndMutateData(_data);
// console.log("final", _data);
// this.topTempDataList = _data;
// let temp = that.topMutateData(_data[0]);
// result = this.splitData(temp.kLineData); //data
// this.kLineData = result;
// } else {
this.kLinesFromExcels = data;
this.lineSelect = data[0].name;
let temp = that.mutateData(data[0].data); //datadata
result = this.splitData(temp.kLineData); //data
console.log("what i got", result);
this.kLineDataList = temp.postData; this.kLineDataList = temp.postData;
this.excelTabsData.push({
Symbol: cutName,
KLineDataList: temp.postData,
accountInfo: {}
});
//K线
if (element.name == data[0].name) {
result = this.splitData(temp.kLineData); //data
this.kLineData = result; this.kLineData = result;
// } }
});
} }
}); });
}, },
@ -719,26 +721,7 @@ export default {
].CreateTime; ].CreateTime;
this.dateRange[1] = this.logData[0].CreateTime; this.dateRange[1] = this.logData[0].CreateTime;
} }
// res.Data.OrderList.sort(
// (a, b) => b.PurchaseKLineId - a.PurchaseKLineId
// );
this.tradeData = res.Data.OrderList; 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;
this.accountInfo = { ...res.Data }; this.accountInfo = { ...res.Data };
} }
}); });
@ -749,26 +732,42 @@ export default {
this.excuting = true; this.excuting = true;
this.$http this.$http
.post("/Api/Simulation/MomentumTrendTest", { .post("/Api/Simulation/MomentumTrendTest", {
Capital: { Capital: this.trendForm,
...this.trendForm, IsEnabledLimit: this.trendForm.IsEnabledLimit,
FrozenProfit: this.trendForm.FrozenProfit, SymbolList: this.excelTabsData
TradeAmountRatio: this.trendForm.TradeAmountRatio
},
kLineDataList: this.kLineDataList
}) })
.then(res => { .then(res => {
this.excuting = false; this.excuting = false;
if (res.Code == 200) { if (res.Code == 200) {
this.sMessage("success", "回测完成"); this.sMessage("success", "回测完成");
} }
this.logData = res.Data.ExecutionLogList; res.Data.SimulationResultList.forEach(element => {
// res.Data.OrderList.sort( let index = this.getIndex(element.Symbol);
// (a, b) => b.PurchaseKLineId - a.PurchaseKLineId if (index != -1) {
// ); this.excelTabsData[index] = {
this.tradeData = res.Data.OrderList; ...this.excelTabsData[index],
tradeData: element.OrderList,
logData: element.ExecutionLogList,
accountInfo: { ...element }
};
}
});
this.accountInfo = { ...res.Data };
}); });
} }
}, },
getIndex(symbol) {
let index = -1;
for (let i = 0; i < this.excelTabsData.length; i++) {
if (this.excelTabsData[i].Symbol == symbol) {
index = i;
break;
}
}
return index;
},
// showNotification // showNotification
sMessage(type, message) { sMessage(type, message) {
this.$notify({ this.$notify({

Loading…
Cancel
Save