Browse Source

总资金管理

master
lizhixin 4 years ago
parent
commit
b2cb479468
  1. 5
      src/layout/dashboard/DashboardLayout.vue
  2. 121
      src/pages/Profit/index.vue
  3. 10
      src/pages/WinRate/index.vue
  4. 6
      src/router/routes.js

5
src/layout/dashboard/DashboardLayout.vue

@ -22,6 +22,11 @@
:name="'短线胜率测试'"
icon="tim-icons icon-single-02"
/>
<sidebar-link
to="/capital"
:name="'总资金管理'"
icon="tim-icons icon-single-02"
/>
<!-- <sidebar-link to="/icons" :name="$t('sidebar.icons')" icon="tim-icons icon-atom"/>
<sidebar-link to="/maps" :name="$t('sidebar.maps')" icon="tim-icons icon-pin"/>

121
src/pages/Profit/index.vue

@ -0,0 +1,121 @@
<template>
<card>
<h5 slot="header">
总资金管理
</h5>
<div class="row">
<div class="col-md-6">
<base-input
label="总资金"
placeholder="总资金"
v-model="form.NowCapital"
></base-input>
<base-input
label="冻结利润比"
placeholder="冻结利润比"
v-model="form.FrozenProfit"
></base-input>
<base-input
label="下单金额比(%)"
placeholder="下单金额比(%)"
v-model="form.TradeAmountRatio"
></base-input>
<base-input
label="下单金额(根据下单金额比例和总资金得出)请参考右图,需满足条件: 最小下单金额 < 下单金额 < 最大下单金额"
placeholder="单金额"
v-model="total"
disabled
></base-input>
<base-button :disabled="!canSubmit" @click="submitCapital"
>提交</base-button
>
</div>
<div class="col-md-6">
<custom-base-table
:data="data"
:columns="columns"
thead-classes="text-primary"
>
</custom-base-table>
</div>
</div>
<div></div>
</card>
</template>
<script>
import CustomBaseTable from "../../components/CustomBaseTable";
export default {
components: { CustomBaseTable },
data() {
return {
data: [],
form: {},
columns: [
{ name: "币种", prop: "Symbol" },
{ name: "最小下单金额", prop: "BuyMarketMinValue" },
{ name: "最大下单金额", prop: "BuyMarketMaxValue" }
]
};
},
computed: {
total() {
return (this.form.NowCapital * this.form.TradeAmountRatio) / 100;
},
canSubmit() {
return (
this.data &&
this.data[1] &&
this.data.every(
i =>
i.BuyMarketMinValue < this.total && i.BuyMarketMaxValue > this.total
)
);
}
},
created() {
this.getAllSymbol();
this.getCapital();
},
methods: {
//
getAllSymbol() {
this.$http.get("/Api/Symbol/GetList").then(res => {
if (res.Code == 200) {
this.data = res.Data;
}
});
},
//
getCapital() {
this.$http.get("/Api/Capital/GetCapital").then(res => {
if (res.Code == 200) {
this.form = res.Data;
}
});
},
submitCapital() {
this.$http
.put("/Api/Capital/EditCapital", {
...this.form,
Captial: this.form.NowCapital
})
.then(res => {
if (res.Code == 200) {
this.sMessage("success", "提交成功");
} else {
this.sMessage("danger", res.Message);
}
});
},
// showNotification
sMessage(type, message) {
this.$notify({
type: type,
message,
timeout: 1800
});
}
}
};
</script>

10
src/pages/WinRate/index.vue

@ -294,7 +294,7 @@ export default {
} else if (this.data[i][3] < stopLost) {
// console.log(`---->`, this.data[i]);
let lostPercent = ((stopLost - buyPrice) / buyPrice) * 100;
// console.log("", lostPercent);
// console.log("", lostPercent, buyPrice, timeStamp);
result = lostPercent;
break;
} else {
@ -314,7 +314,13 @@ export default {
} else if (this.data[i][2] > stopLost) {
// console.log(`---->`, this.data[i]);
let lostPercent = ((buyPrice - stopLost) / buyPrice) * 100;
// console.log("", lostPercent, buyPrice, stopLost);
// console.log(
// "",
// lostPercent,
// buyPrice,
// stopLost,
// timeStamp
// );
result = lostPercent;
break;
} else {

6
src/router/routes.js

@ -15,6 +15,7 @@ const Account = () => import("@/pages/Account");
const Edit = () => import("@/pages/Robot/edit.vue");
const WinRate = () => import("@/pages/WinRate");
const ReCheck = () => import("@/pages/ReCheck");
const Capital = () => import("@/pages/Profit");
const routes = [
{
path: "/",
@ -45,6 +46,11 @@ const routes = [
path: "reCheck",
name: "reCheck",
component: ReCheck
},
{
path: "capital",
name: "capital",
component: Capital
}
// {
// path: "profile",

Loading…
Cancel
Save