- {{ item.row.item.PurchaseKLineId
- ?
- moment(item.row.item.PurchaseKLineId * 1000).format(
- "YYYY-MM-DD HH:mm:ss"
- ) : "-"
+ {{
+ item.row.item.PurchaseKLineId
+ ? moment(item.row.item.PurchaseKLineId * 1000).format(
+ "YYYY-MM-DD HH:mm:ss"
+ )
+ : "-"
}}
@@ -64,7 +65,7 @@
{{
(
- (item.row.item.TotalProfit / policyFormData.PositionFund) *
+ (item.row.item.TotalProfit / item.row.item.TotalPurchasePrice) *
100
).toFixed(2)
}}%
@@ -81,7 +82,10 @@ import { tradeColumns } from "../../pages/prePages/js/columns";
import moment from "moment";
export default {
model: { prop: "data", event: "tableDataChange" },
- props: { data: { type: Array, default: () => [] }, policyFormData: {} },
+ props: {
+ data: { type: Array, default: () => [] },
+ positionFund: { type: Number, default: 1 }
+ },
components: { CustomBaseTable },
data() {
return { moment, columns: tradeColumns };
diff --git a/src/pages/ReCheck/index.vue b/src/pages/ReCheck/index.vue
index dd26383..2a0d066 100644
--- a/src/pages/ReCheck/index.vue
+++ b/src/pages/ReCheck/index.vue
@@ -36,6 +36,7 @@
style="width:200px"
placeholder="策略选择"
v-model="policyMode"
+ @change="policyModeChange"
>
-
+
@@ -205,6 +206,7 @@ import moment from "moment";
import OrderTable from "./OrderTable";
import CustomBaseTable from "../../components/CustomBaseTable.vue";
import MoveTrend from "./MoveTrend";
+import { deepClone } from "../../utils/util";
// import TopEndPolicy from "../components/TopEndPolicy.vue";
export default {
components: {
@@ -229,6 +231,7 @@ export default {
tradeColumns,
logColumns,
logData: [],
+ PositionFund: 1,
RobotPolicyType,
policyMode: 0,
tradeData: [],
@@ -242,7 +245,7 @@ export default {
endTime: null,
kLineData: {},
keyFilter: {},
- policyFormData: {},
+ policyFormData: { ...ResetMomentumWaveTest },
kLineDataList: [],
dateRange: [],
accountInfo: {},
@@ -253,9 +256,19 @@ export default {
};
},
mounted() {
- this.policyFormData = ResetMomentumWaveTest;
+ this.PositionFund = this.policyFormData.PositionFund;
},
methods: {
+ policyModeChange(value) {
+ console.log(value);
+ if (value == 2) {
+ this.PositionFund =
+ (this.trendForm.NowCapital - this.trendForm.FrozenProfit) /
+ (this.trendForm.TradeAmountRatio / 100);
+ } else if (value == 0) {
+ this.PositionFund = this.policyFormData.PositionFund;
+ }
+ },
onOk(value) {
this.logShowCondition = item =>
moment(item.CreateTime).isBetween(moment(value[0]), moment(value[1]));
@@ -470,15 +483,15 @@ export default {
this.startTime &&
this.endTime &&
!moment(data[i][j] * 1000).isBetween(
- this.startTime.startOf("day"),
- this.endTime.endOf("day")
+ moment(this.startTime).startOf("day"),
+ moment(this.endTime).endOf("day")
)
) {
break;
} else if (
this.startTime &&
!moment(data[i][j] * 1000).isAfter(
- this.startTime.startOf("day")
+ moment(this.startTime).startOf("day")
)
) {
break;
@@ -738,8 +751,8 @@ export default {
.post("/Api/Simulation/MomentumTrendTest", {
Capital: {
...this.trendForm,
- FrozenProfit: this.trendForm.FrozenProfit / 100,
- TradeAmountRatio: this.trendForm.TradeAmountRatio / 100
+ FrozenProfit: this.trendForm.FrozenProfit,
+ TradeAmountRatio: this.trendForm.TradeAmountRatio
},
kLineDataList: this.kLineDataList
})
diff --git a/src/pages/prePages/ReCheck.vue b/src/pages/prePages/ReCheck.vue
index 8d27197..8678c95 100644
--- a/src/pages/prePages/ReCheck.vue
+++ b/src/pages/prePages/ReCheck.vue
@@ -80,7 +80,7 @@
-
+
diff --git a/src/utils/util.js b/src/utils/util.js
new file mode 100644
index 0000000..e1b6fce
--- /dev/null
+++ b/src/utils/util.js
@@ -0,0 +1,31 @@
+//深拷贝
+function deepClone(newObj, oldObj) {
+ for (let i in oldObj) {
+ let item = oldObj[i];
+ if (item instanceof Array) {
+ newObj[i] = [];
+ deepClone(newObj[i], item);
+ } else if (item instanceof Object) {
+ newObj[i] = {};
+ deepClone(newObj[i], item);
+ } else {
+ newObj[i] = item;
+ }
+ // console.log(newObj, "深拷贝的每一步", i, oldObj);
+ }
+ }
+
+ //节流函数
+ function debounce(fn, delay) {
+ var timer = null;
+ return function() {
+ if (!timer) {
+ timer = setTimeout(fn, delay);
+ } else {
+ clearTimeout(timer);
+ timer = setTimeout(fn, delay);
+ }
+ };
+ }
+ export { deepClone, debounce };
+
\ No newline at end of file