量化
This commit is contained in:
@ -3,8 +3,13 @@
|
||||
<template #wrapper>
|
||||
<el-card class="box-card">
|
||||
<el-form ref="queryForm" :model="queryParams" :inline="true" label-width="68px">
|
||||
<el-form-item label="模板名称" prop="name"><el-input v-model="queryParams.name" placeholder="请输入模板名称" clearable
|
||||
size="small" @keyup.enter.native="handleQuery" />
|
||||
<el-form-item label="模板名称" prop="name"><el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入模板名称"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="用户" prop="userId"><el-select
|
||||
v-model="queryParams.userId"
|
||||
@ -44,13 +49,25 @@
|
||||
</el-button>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button v-permisaction="['admin:lineOrderTemplateLogs:edit']" type="success" icon="el-icon-edit"
|
||||
size="mini" :disabled="single" @click="handleUpdate">修改
|
||||
<el-button
|
||||
v-permisaction="['admin:lineOrderTemplateLogs:edit']"
|
||||
type="success"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button v-permisaction="['admin:lineOrderTemplateLogs:remove']" type="danger" icon="el-icon-delete"
|
||||
size="mini" :disabled="multiple" @click="handleDelete">删除
|
||||
<el-button
|
||||
v-permisaction="['admin:lineOrderTemplateLogs:remove']"
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
@ -59,8 +76,12 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table ref="table" v-loading="loading" :data="lineOrderTemplateLogsList"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="loading"
|
||||
:data="lineOrderTemplateLogsList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="id" align="center" prop="id" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="模板名称" align="center" prop="name" :show-overflow-tooltip="true" />
|
||||
@ -74,31 +95,59 @@
|
||||
</el-table-column><el-table-column label="开关" align="center" prop="switch" :show-overflow-tooltip="true">
|
||||
<template #default="{ row }">
|
||||
<div @click="onSwitch(row)">
|
||||
<el-switch :value="row.switch" active-value="1" inactive-value="0" active-color="#13ce66"
|
||||
inactive-color="#ff4949" />
|
||||
<el-switch
|
||||
:value="row.switch"
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-popconfirm class="delete-popconfirm" title="确认要修改吗?" confirm-button-text="修改"
|
||||
@confirm="handleUpdate(scope.row)">
|
||||
<el-button slot="reference" v-permisaction="['admin:lineOrderTemplateLogs:edit']" size="mini"
|
||||
type="text" icon="el-icon-edit">修改
|
||||
<el-popconfirm
|
||||
class="delete-popconfirm"
|
||||
title="确认要修改吗?"
|
||||
confirm-button-text="修改"
|
||||
@confirm="handleUpdate(scope.row)"
|
||||
>
|
||||
<el-button
|
||||
slot="reference"
|
||||
v-permisaction="['admin:lineOrderTemplateLogs:edit']"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-popconfirm>
|
||||
<el-popconfirm class="delete-popconfirm" title="确认要删除吗?" confirm-button-text="删除"
|
||||
@confirm="handleDelete(scope.row)">
|
||||
<el-button slot="reference" v-permisaction="['admin:lineOrderTemplateLogs:remove']" size="mini"
|
||||
type="text" icon="el-icon-delete">删除
|
||||
<el-popconfirm
|
||||
class="delete-popconfirm"
|
||||
title="确认要删除吗?"
|
||||
confirm-button-text="删除"
|
||||
@confirm="handleDelete(scope.row)"
|
||||
>
|
||||
<el-button
|
||||
slot="reference"
|
||||
v-permisaction="['admin:lineOrderTemplateLogs:remove']"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageIndex"
|
||||
:limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageIndex"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="1200px" :close-on-click-modal="false">
|
||||
@ -106,11 +155,23 @@
|
||||
<el-form-item label="模板名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="模板名称" />
|
||||
</el-form-item>
|
||||
<el-form ref="inForm" :model="inForm" :rules="inRules" label-width="180px"
|
||||
style="height: 500px;overflow: hidden auto;">
|
||||
<el-form
|
||||
ref="inForm"
|
||||
:model="inForm"
|
||||
:rules="inRules"
|
||||
label-width="180px"
|
||||
style="height: 500px;overflow: hidden auto;"
|
||||
>
|
||||
<el-form-item label="交易所" prop="exchange_type">
|
||||
<el-select v-model="inForm.exchange_type" style="width: 100%;" placeholder="请选择交易所" clearable filterable
|
||||
size="small" @change="onchangeForm">
|
||||
<el-select
|
||||
v-model="inForm.exchange_type"
|
||||
style="width: 100%;"
|
||||
placeholder="请选择交易所"
|
||||
clearable
|
||||
filterable
|
||||
size="small"
|
||||
@change="onchangeForm"
|
||||
>
|
||||
<el-option v-for="dict in exchangeTypes" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@ -130,10 +191,21 @@
|
||||
<el-form-item label="api用户" prop="api_id">
|
||||
<el-row>
|
||||
<el-col :span="21">
|
||||
<el-select v-model="inForm.api_id" multiple style="width: 100%;" placeholder="请选择api用户" clearable
|
||||
filterable size="small">
|
||||
<el-option v-for="dict in lineUsers" :key="dict.id" :label="dict.apiName"
|
||||
:value="String(dict.id)" />
|
||||
<el-select
|
||||
v-model="inForm.api_id"
|
||||
multiple
|
||||
style="width: 100%;"
|
||||
placeholder="请选择api用户"
|
||||
clearable
|
||||
filterable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in lineUsers"
|
||||
:key="dict.id"
|
||||
:label="dict.apiName"
|
||||
:value="String(dict.id)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
@ -142,20 +214,47 @@
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.type === 2" label="交易对组" prop="symbol_group_id">
|
||||
<el-select v-if="form.type === 2" v-model="inForm.symbol_group_id" style="width: 100%;"
|
||||
placeholder="请选择交易对组" clearable filterable size="small">
|
||||
<el-select
|
||||
v-if="form.type === 2"
|
||||
v-model="inForm.symbol_group_id"
|
||||
style="width: 100%;"
|
||||
placeholder="请选择交易对组"
|
||||
clearable
|
||||
filterable
|
||||
size="small"
|
||||
>
|
||||
<el-option v-for="dict in comSymbols" :key="dict.id" :label="dict.groupName" :value="dict.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-else label="交易对" prop="symbol">
|
||||
<el-select v-model="inForm.symbol" style="width: 100%;" placeholder="请选择交易对" clearable filterable remote
|
||||
:remote-method="getSymbol" :loading="searchLoding" size="small" @change="onchangeSymbol">
|
||||
<el-option v-for="dict in comSymbols" :key="dict.id || dict.symbol" :label="dict.symbol"
|
||||
:value="dict.symbol" />
|
||||
<el-select
|
||||
v-model="inForm.symbol"
|
||||
style="width: 100%;"
|
||||
placeholder="请选择交易对"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
:remote-method="getSymbol"
|
||||
:loading="searchLoding"
|
||||
size="small"
|
||||
@change="onchangeSymbol"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in comSymbols"
|
||||
:key="dict.id || dict.symbol"
|
||||
:label="dict.symbol"
|
||||
:value="dict.symbol"
|
||||
/>
|
||||
<div class="page">
|
||||
<pagination v-show="symbol.total > 0" :background="false" :total="symbol.total"
|
||||
layout="prev, pager, next" :page.sync="symbol.pageIndex" :limit.sync="symbol.pageSize"
|
||||
@pagination="getSymbol" />
|
||||
<pagination
|
||||
v-show="symbol.total > 0"
|
||||
:background="false"
|
||||
:total="symbol.total"
|
||||
layout="prev, pager, next"
|
||||
:page.sync="symbol.pageIndex"
|
||||
:limit.sync="symbol.pageSize"
|
||||
@pagination="getSymbol"
|
||||
/>
|
||||
</div>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@ -183,10 +282,19 @@
|
||||
<el-form-item label="下单价(实际价格)" prop="price">
|
||||
<el-input v-model="inForm.price" placeholder="下单价(实际价格)">
|
||||
<template #prepend>
|
||||
<el-select v-if="inForm.price_pattern === 'aicoin'" v-model="aicoinPrice" placeholder="请选择"
|
||||
style="width: 150px;" @change="onchangeAicoin">
|
||||
<el-option v-for="o in JSON.stringify(aicoins) !== '{}' ? options : []" :key="o.label"
|
||||
:label="o.label" :value="aicoins[o.value] || ''">
|
||||
<el-select
|
||||
v-if="inForm.price_pattern === 'aicoin'"
|
||||
v-model="aicoinPrice"
|
||||
placeholder="请选择"
|
||||
style="width: 150px;"
|
||||
@change="onchangeAicoin"
|
||||
>
|
||||
<el-option
|
||||
v-for="o in JSON.stringify(aicoins) !== '{}' ? options : []"
|
||||
:key="o.label"
|
||||
:label="o.label"
|
||||
:value="aicoins[o.value] || ''"
|
||||
>
|
||||
<span style="float: left">{{ o.label }}</span>
|
||||
<span style="float: right">{{ aicoins[o.value] || 0 }}</span>
|
||||
</el-option>
|
||||
@ -303,51 +411,63 @@
|
||||
<el-row>
|
||||
<el-col :span="4"><el-form-item label="主单加仓配置" /></el-col>
|
||||
<el-col :span="2"><el-button type="primary" size="mini" @click="onAddExt(0)">新增</el-button></el-col>
|
||||
<el-col v-if="form.type === 1" :span="2"><el-button type="primary" size="mini"
|
||||
:disabled="inForm.ext && inForm.ext.length === 0" @click="onCalculate">计算</el-button></el-col>
|
||||
<el-col v-if="form.type === 1" :span="2"><el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
:disabled="inForm.ext && inForm.ext.length === 0"
|
||||
@click="onCalculate"
|
||||
>计算</el-button></el-col>
|
||||
</el-row>
|
||||
<div v-for="(item, index) in inForm.ext" :key="index" class="exts">
|
||||
<el-row :gutter="20">
|
||||
<div v-for="(item,index) in inForm.ext" :key="index" class="exts">
|
||||
<el-row v-if="item.addType===1" :gutter="20" style="margin-bottom: 20px;">
|
||||
<el-col :span="5">
|
||||
<div style="margin-bottom: 8px;">加仓类型</div>
|
||||
<el-radio-group v-model="item.addPositionOrderType" size="mini">
|
||||
<div style="margin-bottom: 8px;">{{ item.addType===1?'加仓类型':'减仓类型' }}</div>
|
||||
<el-radio-group v-model="item.orderType" size="mini">
|
||||
<el-radio label="LIMIT">限价</el-radio>
|
||||
<el-radio label="MARKET">市价</el-radio>
|
||||
</el-radio-group>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<div style="margin-bottom: 8px;">加仓方式</div>
|
||||
<div style="margin-bottom: 8px;">{{ item.addType===1?'加仓方式':'减仓方式' }}</div>
|
||||
<el-radio-group v-model="item.addPositionType" size="mini">
|
||||
<el-radio :label="1">百分比</el-radio>
|
||||
<el-radio :label="2">实际金额</el-radio>
|
||||
<el-radio :label="2" :disabled="item.addType===2">实际金额</el-radio>
|
||||
</el-radio-group>
|
||||
</el-col>
|
||||
<el-col :span="5">加仓下跌百分比<el-input v-model.number="item.addPositionPriceRatio" size="mini"
|
||||
type="number" placeholder="加仓价格百分比" /></el-col>
|
||||
<el-col :span="5">加仓数值<el-input v-model.number="item.addPositionVal" size="mini" type="number"
|
||||
placeholder="加仓数值" /></el-col>
|
||||
<el-col :span="4">加仓后止盈价百分比<el-input v-model.number="item.takeProfitRatio" size="mini" type="number"
|
||||
placeholder="止盈百分比">
|
||||
<template v-if="form.type === 1" #append>{{ ext[index] ? ext[index].reTakeProfitRatio : 0
|
||||
}}</template>
|
||||
</el-input></el-col>
|
||||
|
||||
</el-row>
|
||||
<el-row :gutter="20" style="margin-top: 10px;">
|
||||
<el-col :span="5">减仓下跌百分比<el-input v-model.number="item.reducePriceRatio" size="mini" type="number"
|
||||
placeholder="减仓价格百分比" /></el-col>
|
||||
<el-col :span="5">减仓数量百分比<el-input v-model.number="item.reduceNumRatio" size="mini" type="number"
|
||||
placeholder="减仓数量百分比" /></el-col>
|
||||
<el-col :span="5">减仓后止盈价百分比<el-input v-model.number="item.reduceTakeProfitRatio" size="mini"
|
||||
type="number" placeholder="减仓后止盈百分比">
|
||||
<template v-if="form.type === 1" #append>{{ ext[index] ? ext[index].reduceReTakeProfitRatio : 0
|
||||
}}</template>
|
||||
</el-input></el-col>
|
||||
<el-col :span="5">减仓后止损价百分比<el-input v-model.number="item.reduceStopLossRatio" size="mini"
|
||||
type="number" placeholder="减仓后止损百分比" /></el-col>
|
||||
<el-col :span="4">
|
||||
<div style="margin-bottom: 14px;" /><el-button size="mini" type="danger"
|
||||
@click="onAddExt(1, index)">删除</el-button>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="3">{{ item.addType===1?'加仓下跌百分比': '减仓下跌百分比' }}
|
||||
<el-input v-model.number="item.priceRatio" min="0" size="mini" type="number" :placeholder="item.addType===1?'加仓下跌百分比': '减仓下跌百分比'" /></el-col>
|
||||
<el-col :span="3">{{ item.addType===1?'加仓数值':'减仓数值' }}
|
||||
<el-input v-model.number="item.addPositionVal" min="0" size="mini" type="number" :placeholder="item.addType===1?'加仓数值':'减仓数值'" />
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<span>止盈/止损百分比</span>
|
||||
<div>
|
||||
<el-input v-model="item.takeProfitRatio" min="0" style="width:50%;" size="mini" type="number" placeholder="止盈百分比">
|
||||
<template v-if="form.type === 1" #append>{{ ext[index] ? ext[index].reTakeProfitRatio : 0 }}</template>
|
||||
</el-input>
|
||||
—
|
||||
<el-input v-model.number="item.stopLossRatio" style="width:42%;" size="mini" type="number" placeholder="止损百分比" />
|
||||
</div>
|
||||
</el-col>
|
||||
<!-- <el-col :span="3">止损百分比<el-input v-model.number="item.stopLossRatio" size="mini" type="number" placeholder="止损百分比" /></el-col> -->
|
||||
|
||||
<template v-if="item.addType===1">
|
||||
<el-col :span="3">
|
||||
止盈数量百分比<el-input v-model.number="item.takeProfitNumRatio" size="mini" type="number" placeholder="止盈数量百分比" />
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<span>第二止盈/止损百分比</span>
|
||||
<div>
|
||||
<el-input v-model.number="item.tpTpPriceRatio" min="0" style="width:42%" size="mini" type="number" placeholder="止盈后止盈价百分比" />
|
||||
—
|
||||
<el-input v-model.number="item.tpSlPriceRatio" min="0" style="width:42%" size="mini" type="number" placeholder="止盈后止损价百分比" />
|
||||
</div>
|
||||
</el-col>
|
||||
</template>
|
||||
<el-col :span="3"><div style="margin-bottom: 14px;" /><el-button size="mini" type="danger" @click="onAddExt(1,index)">删除</el-button></el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<!-- <el-form-item label="是否保存模板" prop="save_template">
|
||||
@ -551,22 +671,40 @@ export default {
|
||||
this.inForm.price = this.aicoinPrice || 0
|
||||
},
|
||||
onAddExt(type, index) {
|
||||
if (type === 0) {
|
||||
this.inForm.ext.push({
|
||||
reducePriceRatio: undefined,
|
||||
reduceNumRatio: undefined,
|
||||
reduceTakeProfitRatio: undefined,
|
||||
reduceStopLossRatio: undefined,
|
||||
|
||||
takeProfitRatio: undefined,
|
||||
addPositionPriceRatio: undefined,
|
||||
addPositionOrderType: 'LIMIT',
|
||||
addPositionType: 1,
|
||||
addPositionVal: undefined
|
||||
})
|
||||
if (type === 1) {
|
||||
this.inForm.ext.splice(index, 1)
|
||||
return false
|
||||
}
|
||||
this.inForm.ext.splice(index, 1)
|
||||
this.inForm.ext.push({
|
||||
// 类型 订单类型 加仓类型 加仓数值 价格百分比 止盈百分比 止损百分比
|
||||
addType: type === 0 ? 1 : 2,
|
||||
orderType: 'LIMIT',
|
||||
addPositionType: 1,
|
||||
addPositionVal: 0,
|
||||
priceRatio: 0,
|
||||
takeProfitRatio: 0,
|
||||
stopLossRatio: 0,
|
||||
// 止盈数量百分比 止盈后止盈价格百分比 止盈后止损价格百分比
|
||||
takeProfitNumRatio: 0,
|
||||
tpTpPriceRatio: 0,
|
||||
tpSlPriceRatio: 0
|
||||
})
|
||||
// if (type === 0) {
|
||||
// this.inForm.ext.push({
|
||||
// reducePriceRatio: undefined,
|
||||
// reduceNumRatio: undefined,
|
||||
// reduceTakeProfitRatio: undefined,
|
||||
// reduceStopLossRatio: undefined,
|
||||
|
||||
// takeProfitRatio: undefined,
|
||||
// addPositionPriceRatio: undefined,
|
||||
// addPositionOrderType: 'LIMIT',
|
||||
// addPositionType: 1,
|
||||
// addPositionVal: undefined
|
||||
// })
|
||||
// return false
|
||||
// }
|
||||
// this.inForm.ext.splice(index, 1)
|
||||
},
|
||||
onchangeForm() {
|
||||
this.getListLineApiUser(this.inForm.exchange_type)
|
||||
@ -663,10 +801,10 @@ export default {
|
||||
}
|
||||
this.resetForm('form')
|
||||
},
|
||||
getImgList: function () {
|
||||
getImgList: function() {
|
||||
this.form[this.fileIndex] = this.$refs['fileChoose'].resultList[0].fullUrl
|
||||
},
|
||||
fileClose: function () {
|
||||
fileClose: function() {
|
||||
this.fileOpen = false
|
||||
},
|
||||
userIdFormat(row) {
|
||||
@ -726,7 +864,7 @@ export default {
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
submitForm: function() {
|
||||
this.$refs['form'].validate(valid => {
|
||||
if (valid) {
|
||||
this.inForm.price = this.inForm.price ? String(this.inForm.price) : ''
|
||||
@ -779,7 +917,7 @@ export default {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
}).then(function() {
|
||||
return delLineOrderTemplateLogs({ 'ids': Ids })
|
||||
}).then((response) => {
|
||||
if (response.code === 200) {
|
||||
@ -789,7 +927,7 @@ export default {
|
||||
} else {
|
||||
this.msgError(response.msg)
|
||||
}
|
||||
}).catch(function () {
|
||||
}).catch(function() {
|
||||
})
|
||||
},
|
||||
handleOrders() {
|
||||
@ -798,7 +936,7 @@ export default {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
}).then(function() {
|
||||
return quickAddPreOrder({ ids: Ids.toString() })
|
||||
}).then((response) => {
|
||||
if (response.code === 200) {
|
||||
@ -808,7 +946,7 @@ export default {
|
||||
} else {
|
||||
this.msgError(response.msg)
|
||||
}
|
||||
}).catch(function () {
|
||||
}).catch(function() {
|
||||
})
|
||||
},
|
||||
// 计算需要回本利润
|
||||
|
||||
@ -512,7 +512,7 @@
|
||||
/>
|
||||
|
||||
<!-- 添加或修改对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="1200px" :close-on-click-modal="false">
|
||||
<el-dialog :title="title" :visible.sync="open" width="1300px" :close-on-click-modal="false">
|
||||
<div v-loading="formLoading">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="180px" style="height: 600px;overflow: hidden auto;">
|
||||
<el-form-item label="交易所" prop="exchange_type">
|
||||
@ -824,7 +824,7 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="主单亏损百分比" prop="reduce_price">
|
||||
<el-input v-model.number="form.reduce_price" type="number" placeholder="主单亏损百分比" />
|
||||
<el-input v-model.number="form.reduce_price" min="0" max="99.9" type="number" placeholder="主单亏损百分比" />
|
||||
</el-form-item>
|
||||
<el-form-item label="主单减仓数量百分比" prop="reduce_num">
|
||||
<el-input v-model.number="form.reduce_num" type="number" placeholder="主单减仓数量百分比" />
|
||||
@ -839,39 +839,60 @@
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<el-col :span="4"><el-form-item label="主单加仓配置" /></el-col>
|
||||
<el-col :span="2"><el-button type="primary" size="mini" @click="onAddExt(0)">新增</el-button></el-col>
|
||||
<el-col :span="2"><el-button type="primary" size="mini" @click="onAddExt(0)">新增加仓</el-button></el-col>
|
||||
<el-col :span="2"><el-button type="primary" size="mini" @click="onAddExt(2)">新增减仓</el-button></el-col>
|
||||
<el-col v-if="title!=='批量添加'" :span="2"><el-button type="primary" size="mini" :disabled="form.ext && form.ext.length===0" @click="onCalculate">计算</el-button></el-col>
|
||||
</el-row>
|
||||
<div v-for="(item,index) in form.ext" :key="index" class="exts">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="5">
|
||||
<div style="margin-bottom: 8px;">加仓类型</div>
|
||||
<el-radio-group v-model="item.addPositionOrderType" size="mini">
|
||||
<el-row v-if="item.addType===1" :gutter="20" style="margin-bottom: 20px;">
|
||||
<el-col :span="4">
|
||||
<div style="margin-bottom: 8px;">{{ item.addType===1?'加仓类型':'减仓类型' }}</div>
|
||||
<el-radio-group v-model="item.orderType" size="mini">
|
||||
<el-radio label="LIMIT">限价</el-radio>
|
||||
<el-radio label="MARKET">市价</el-radio>
|
||||
</el-radio-group>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<div style="margin-bottom: 8px;">加仓方式</div>
|
||||
<el-col :span="4">
|
||||
<div style="margin-bottom: 8px;">{{ item.addType===1?'加仓方式':'减仓方式' }}</div>
|
||||
<el-radio-group v-model="item.addPositionType" size="mini">
|
||||
<el-radio :label="1">百分比</el-radio>
|
||||
<el-radio :label="2">实际金额</el-radio>
|
||||
<el-radio :label="2" :disabled="item.addType===2">实际金额</el-radio>
|
||||
</el-radio-group>
|
||||
</el-col>
|
||||
<el-col :span="5">加仓下跌百分比<el-input v-model.number="item.addPositionPriceRatio" size="mini" type="number" placeholder="加仓下跌百分比" /></el-col>
|
||||
<el-col :span="5">加仓数值<el-input v-model.number="item.addPositionVal" size="mini" type="number" placeholder="加仓数值" /></el-col>
|
||||
<el-col :span="4">加仓后止盈价百分比<el-input v-model.number="item.takeProfitRatio" size="mini" type="number" placeholder="止盈百分比">
|
||||
<template v-if="title!=='批量添加'" #append>{{ ext[index] ? ext[index].reTakeProfitRatio : 0 }}</template>
|
||||
</el-input></el-col>
|
||||
|
||||
</el-row>
|
||||
<el-row :gutter="20" style="margin-top: 10px;">
|
||||
<el-col :span="5">减仓下跌百分比<el-input v-model.number="item.reducePriceRatio" size="mini" type="number" placeholder="减仓下跌百分比" /></el-col>
|
||||
<el-col :span="5">减仓数量百分比<el-input v-model.number="item.reduceNumRatio" size="mini" type="number" placeholder="减仓数量百分比" /></el-col>
|
||||
<el-col :span="5">减仓后止盈价百分比<el-input v-model.number="item.reduceTakeProfitRatio" size="mini" type="number" placeholder="减仓后止盈百分比">
|
||||
<template v-if="title!=='批量添加'" #append>{{ ext[index] ? ext[index].reduceReTakeProfitRatio : 0 }}</template>
|
||||
</el-input></el-col>
|
||||
<el-col :span="5">减仓后止损价百分比<el-input v-model.number="item.reduceStopLossRatio" size="mini" type="number" placeholder="减仓后止损百分比" /></el-col>
|
||||
<el-col :span="4"><div style="margin-bottom: 14px;" /><el-button size="mini" type="danger" @click="onAddExt(1,index)">删除</el-button></el-col>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="3">{{ item.addType===1?'加仓下跌百分比': '减仓下跌百分比' }}
|
||||
<el-input v-model.number="item.priceRatio" min="0" size="mini" type="number" :placeholder="item.addType===1?'加仓下跌百分比': '减仓下跌百分比'" /></el-col>
|
||||
<el-col :span="3">{{ item.addType===1?'加仓数值':'减仓数值' }}
|
||||
<el-input v-model.number="item.addPositionVal" min="0" size="mini" type="number" :placeholder="item.addType===1?'加仓数值':'减仓数值'" />
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<span>止盈/止损百分比</span>
|
||||
<div>
|
||||
<el-input v-model.number="item.takeProfitRatio" min="0" style="width:50%;" size="mini" type="number" placeholder="止盈百分比">
|
||||
<template v-if="title!=='批量添加'" #append>{{ ext[index] ? ext[index].reTakeProfitRatio : 0 }}</template>
|
||||
</el-input>
|
||||
—
|
||||
<el-input v-model.number="item.stopLossRatio" style="width:42%;" size="mini" type="number" placeholder="止损百分比" />
|
||||
</div>
|
||||
</el-col>
|
||||
<!-- <el-col :span="3">止损百分比<el-input v-model.number="item.stopLossRatio" size="mini" type="number" placeholder="止损百分比" /></el-col> -->
|
||||
|
||||
<template v-if="item.addType===1">
|
||||
<el-col :span="3">
|
||||
止盈数量百分比<el-input v-model.number="item.takeProfitNumRatio" size="mini" type="number" placeholder="止盈数量百分比" />
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<span>第二止盈/止损百分比</span>
|
||||
<div>
|
||||
<el-input v-model.number="item.tpTpPriceRatio" min="0" style="width:42%" size="mini" type="number" placeholder="止盈后止盈价百分比" />
|
||||
—
|
||||
<el-input v-model.number="item.tpSlPriceRatio" min="0" style="width:42%" size="mini" type="number" placeholder="止盈后止损价百分比" />
|
||||
</div>
|
||||
</el-col>
|
||||
</template>
|
||||
<el-col :span="3"><div style="margin-bottom: 14px;" /><el-button size="mini" type="danger" @click="onAddExt(1,index)">删除</el-button></el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<el-form-item label="是否保存模板" prop="save_template">
|
||||
@ -1437,7 +1458,7 @@ export default {
|
||||
symbol_group_id: [{ required: true, message: '交易对组不能为空', trigger: 'blur' }],
|
||||
quote_symbol: [{ required: true, message: '计价货币不能为空', trigger: 'blur' }],
|
||||
order_sn: [{ required: true, message: '订单号不能为空', trigger: 'blur' }],
|
||||
profit_num_ratio:[{ required: true, message: '止盈数量百分比不能为空', trigger: 'blur' }],
|
||||
profit_num_ratio: [{ required: true, message: '止盈数量百分比不能为空', trigger: 'blur' }]
|
||||
},
|
||||
currentExpandId: undefined,
|
||||
cacheRefresh: {},
|
||||
@ -1604,22 +1625,35 @@ export default {
|
||||
this.form.price = this.aicoinPrice || 0
|
||||
},
|
||||
onAddExt(type, index) {
|
||||
if (type === 0) {
|
||||
this.form.ext.push({
|
||||
reducePriceRatio: undefined,
|
||||
reduceNumRatio: undefined,
|
||||
reduceTakeProfitRatio: undefined,
|
||||
reduceStopLossRatio: undefined,
|
||||
|
||||
takeProfitRatio: undefined,
|
||||
addPositionPriceRatio: undefined,
|
||||
addPositionOrderType: 'LIMIT',
|
||||
addPositionType: 1,
|
||||
addPositionVal: undefined
|
||||
})
|
||||
if (type === 1) {
|
||||
this.form.ext.splice(index, 1)
|
||||
return false
|
||||
}
|
||||
this.form.ext.splice(index, 1)
|
||||
this.form.ext.push({
|
||||
// 类型 订单类型 加仓类型 加仓数值 价格百分比 止盈百分比 止损百分比
|
||||
addType: type === 0 ? 1 : 2,
|
||||
orderType: 'LIMIT',
|
||||
addPositionType: 1,
|
||||
addPositionVal: 0,
|
||||
priceRatio: 0,
|
||||
takeProfitRatio: 0,
|
||||
stopLossRatio: 0,
|
||||
// 止盈数量百分比 止盈后止盈价格百分比 止盈后止损价格百分比
|
||||
takeProfitNumRatio: 0,
|
||||
tpTpPriceRatio: 0,
|
||||
tpSlPriceRatio: 0
|
||||
|
||||
// reducePriceRatio: undefined,
|
||||
// reduceNumRatio: undefined,
|
||||
// reduceTakeProfitRatio: undefined,
|
||||
// reduceStopLossRatio: undefined,
|
||||
|
||||
// takeProfitRatio: undefined,
|
||||
// addPositionPriceRatio: undefined,
|
||||
// addPositionOrderType: 'LIMIT',
|
||||
// addPositionType: 1,
|
||||
// addPositionVal: undefined
|
||||
})
|
||||
},
|
||||
exchangeTypeFormat(row) {
|
||||
return this.selectDictLabel(this.exchangeTypes || [], row.exchangeType)
|
||||
@ -1973,9 +2007,9 @@ export default {
|
||||
cover_type: 0,
|
||||
price_pattern: 'percentage',
|
||||
profit: 0,
|
||||
profit_num_ratio:100,
|
||||
profit_tp_tp_price_ratio:0,
|
||||
profit_tp_sl_price_ratio:0,
|
||||
profit_num_ratio: 100,
|
||||
profit_tp_tp_price_ratio: 0,
|
||||
profit_tp_sl_price_ratio: 0,
|
||||
stop_price: '',
|
||||
save_template: '0',
|
||||
template_name: ''
|
||||
@ -2068,12 +2102,10 @@ export default {
|
||||
})
|
||||
} else {
|
||||
if (this.title === '批量添加') {
|
||||
|
||||
|
||||
const params = JSON.parse(JSON.stringify({ ...this.form, symbol_group_id: String(this.form.symbol_group_id), api_id: this.form.api_id.toString(),
|
||||
profit_num_ratio:this.form.profit_num_ratio||100,
|
||||
profit_tp_tp_price_ratio:this.form.profit_tp_tp_price_ratio||0,
|
||||
profit_tp_sl_price_ratio:this.form.profit_tp_sl_price_ratio||0, }))
|
||||
profit_num_ratio: this.form.profit_num_ratio || 100,
|
||||
profit_tp_tp_price_ratio: this.form.profit_tp_tp_price_ratio || 0,
|
||||
profit_tp_sl_price_ratio: this.form.profit_tp_sl_price_ratio || 0 }))
|
||||
delete params.symbol
|
||||
batchAddOrder(params).then(response => {
|
||||
if (response.code === 200) {
|
||||
@ -2094,9 +2126,9 @@ export default {
|
||||
reduce_num: this.form.reduce_num || 0,
|
||||
reduce_take_profit: this.form.reduce_take_profit || 0,
|
||||
reduce_stop_price: this.form.reduce_stop_price || 0,
|
||||
profit_num_ratio:this.form.profit_num_ratio||100,
|
||||
profit_tp_tp_price_ratio:this.form.profit_tp_tp_price_ratio||0,
|
||||
profit_tp_sl_price_ratio:this.form.profit_tp_sl_price_ratio||0,
|
||||
profit_num_ratio: this.form.profit_num_ratio || 100,
|
||||
profit_tp_tp_price_ratio: this.form.profit_tp_tp_price_ratio || 0,
|
||||
profit_tp_sl_price_ratio: this.form.profit_tp_sl_price_ratio || 0,
|
||||
api_id: this.form.api_id.toString()
|
||||
}).then(response => {
|
||||
if (response.code === 200) {
|
||||
|
||||
Reference in New Issue
Block a user