|
|
@ -1,6 +1,6 @@ |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<robot-create /> |
|
|
|
<robot-create @initRobotList="initRobotList" /> |
|
|
|
<custom-base-table |
|
|
|
:data="data" |
|
|
|
:columns="columns" |
|
|
@ -36,12 +36,33 @@ |
|
|
|
</el-switch> |
|
|
|
</template> |
|
|
|
<!-- 运行时长 --> |
|
|
|
<template slot="OnlySale" slot-scope="item">{{ item }}</template> |
|
|
|
<template slot="WorkTime" slot-scope="item" v-if="item.row.item.Time">{{ |
|
|
|
secToMin(item.row.item.Time) |
|
|
|
}}</template> |
|
|
|
<!-- 策略配置 --> |
|
|
|
<template slot="OnlySale" slot-scope="item">{{ item }}</template> |
|
|
|
<template |
|
|
|
slot="Setting" |
|
|
|
slot-scope="item" |
|
|
|
v-if="item.row.item.TradePolicy" |
|
|
|
> |
|
|
|
<div> |
|
|
|
固定交易量:{{ item.row.item.TradePolicy.TradeCoinCount }}、 |
|
|
|
交易周期:{{ |
|
|
|
getMatchTitle( |
|
|
|
item.row.item.TradePolicy.PeriodicSignal, |
|
|
|
periodSignal |
|
|
|
) |
|
|
|
}} |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
最大借款比例:{{ item.row.item.TradePolicy.MaxLoanRatio }}%、 |
|
|
|
止损比例:{{ item.row.item.TradePolicy.maxLoanRatio }} |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<!-- 委托单 --> |
|
|
|
<template slot="OnlySale" slot-scope="item">{{ item }}</template> |
|
|
|
|
|
|
|
<template slot="OrderPlan" slot-scope="item">{{}}委托单</template> |
|
|
|
<!-- 总盈亏 --> |
|
|
|
<!-- <template slot="OrderPlan" slot-scope="item">{{item.row.item.ZYK}}({{item.row.item.Ratio}})</template> --> |
|
|
|
<!-- 操作 --> |
|
|
|
<template slot="Action" slot-scope="item"> |
|
|
|
<div class="row"> |
|
|
@ -72,17 +93,22 @@ |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</custom-base-table> |
|
|
|
<robot-setting :robotInfo="robot" v-model="settingVisible" /> |
|
|
|
<robot-setting |
|
|
|
:robotSetting="robotSetting" |
|
|
|
v-model="settingVisible" |
|
|
|
@initRobotList="initRobotList" |
|
|
|
/> |
|
|
|
<order-plan :robotInfo="robot" v-model="orderVisible" /> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { secToMin } from "../../utils/TimeUtils"; |
|
|
|
import RobotCreate from "./Modal/RobotCreate"; |
|
|
|
import RobotSetting from "./Modal/RobotSetting"; |
|
|
|
import OrderPlan from "./Modal/OrderPlan"; |
|
|
|
const tableColumns = [ |
|
|
|
{ name: "货币对", prop: "Robot.Symbol", customSlot: "Symbol" }, |
|
|
|
{ name: "货币对", prop: "Robot.Symbol" }, |
|
|
|
{ |
|
|
|
name: "运行状态", |
|
|
|
prop: "WaveBandPolicy.IsEnabledBuySignal", |
|
|
@ -90,7 +116,7 @@ const tableColumns = [ |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: "只卖", |
|
|
|
prop: "RobotAccount.TotalPurchasePrice", |
|
|
|
prop: "TradePolicy.isEnabledBuySignal", |
|
|
|
customSlot: "OnlySale" |
|
|
|
}, |
|
|
|
{ name: "持仓成本", prop: "RobotAccount.TotalPurchasePrice" }, |
|
|
@ -99,9 +125,7 @@ const tableColumns = [ |
|
|
|
{ name: "币本位盈亏", prop: "RobotAccount.BBWProfit" }, |
|
|
|
|
|
|
|
{ name: "持币盈亏", prop: "RobotAccount.TotalProfit" }, |
|
|
|
{ name: "实际本金", prop: "RealCost" }, |
|
|
|
{ name: "总盈亏", prop: "RobotAccount.ZYK" }, |
|
|
|
|
|
|
|
{ |
|
|
|
name: "运行时长", |
|
|
|
prop: "Robot.IntervalSetting", |
|
|
@ -114,26 +138,62 @@ const tableColumns = [ |
|
|
|
|
|
|
|
import CustomBaseTable from "../../../src/components/CustomBaseTable"; |
|
|
|
import { Modal } from "@/components"; |
|
|
|
|
|
|
|
import { periodSignal } from "../prePages/js/selectoptions"; |
|
|
|
export default { |
|
|
|
components: { CustomBaseTable, Modal, RobotCreate, RobotSetting, OrderPlan }, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
secToMin, |
|
|
|
periodSignal, |
|
|
|
columns: tableColumns, |
|
|
|
data: [ |
|
|
|
{ item: 1, Id: 0 }, |
|
|
|
{ item: 2, Id: 2 } |
|
|
|
], |
|
|
|
data: [], |
|
|
|
robot: {}, |
|
|
|
robotSetting: {}, |
|
|
|
settingVisible: false, |
|
|
|
orderVisible: false |
|
|
|
}; |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.initRobotList(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
initRobotList() { |
|
|
|
this.$http |
|
|
|
.get("/Api/Robot/GetMomentumTrendV2TradeRobotList") |
|
|
|
.then(res => { |
|
|
|
if (res.Code == 200) { |
|
|
|
this.data = res.Data; |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
visibleModi(type, record) { |
|
|
|
this[type] = true; |
|
|
|
this.robot = record; |
|
|
|
if (type == "settingVisible") { |
|
|
|
this.robotSetting = { robotId: record.Robot.Id }; |
|
|
|
this.getEditDetails(record.Robot.Id); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
getMatchTitle(value, sourceArray) { |
|
|
|
let title = ""; |
|
|
|
sourceArray.forEach(element => { |
|
|
|
if (element.value == value) title = element.title; |
|
|
|
}); |
|
|
|
return title; |
|
|
|
}, |
|
|
|
|
|
|
|
//获取动2策略详情 |
|
|
|
getEditDetails(Id) { |
|
|
|
this.$http |
|
|
|
.get("/Api/MomentumTrendV2Policy/Get?robotId=" + Id) |
|
|
|
.then(res => { |
|
|
|
if (res.Code == 200) { |
|
|
|
this.robotSetting = { ...this.robotSetting, ...res.Data }; |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
//每个机器人的运行状态改变 |
|
|
|
onStatusChange(record, isOn) { |
|
|
|
console.log(record, isOn); |
|
|
@ -164,7 +224,7 @@ export default { |
|
|
|
record.TradePolicy.IsEnabledBuySignal = isOn ? 0 : 1; |
|
|
|
this.$forceUpdate(); |
|
|
|
this.$http |
|
|
|
.put("/Api/MomentumWavePolicy/EditPurchaseStatus", { |
|
|
|
.put("/Api/MomentumTrendV2Policy/EditPurchaseStatus", { |
|
|
|
RobotId: record.Robot.Id, |
|
|
|
OnlySell: isOn |
|
|
|
}) |
|
|
@ -179,6 +239,13 @@ export default { |
|
|
|
|
|
|
|
goCheck(id) { |
|
|
|
this.$router.push(`/editt/${id}`); |
|
|
|
}, // 封装showNotification |
|
|
|
sMessage(type, message) { |
|
|
|
this.$notify({ |
|
|
|
type: type, |
|
|
|
message, |
|
|
|
timeout: 1800 |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|