|
|
@@ -1,9 +1,8 @@
|
|
|
-import APP from '@/services';
|
|
|
+import { hasSystemParam } from '@/hooks/system';
|
|
|
import { useHolderprice, useProfitloss } from '@/services/bus/holdPosition';
|
|
|
import { getMarketTradePropertyByGoodsId } from '@/services/bus/market';
|
|
|
import { QueryTradePositionRsp } from '@/services/go/ermcp/order/interface';
|
|
|
import { Taaccount } from '@/services/go/TaAccount/interface';
|
|
|
-import { Systemparam } from '@/services/go/useInfo/interface';
|
|
|
import { Ref } from 'vue';
|
|
|
|
|
|
export const tableColumns = [
|
|
|
@@ -105,8 +104,7 @@ export const useHazardRates = (positions: Ref<QueryTradePositionRsp[]>) => {
|
|
|
function getDecimalplace() {
|
|
|
return positions.value.length > 0 ? positions.value[0].decimalplace : 2
|
|
|
}
|
|
|
- // 获取系统参数
|
|
|
- const getSystemParam = (paramcode: string, value: string) => APP.getRef('systemParams').value.find((param: Systemparam) => param.paramcode === paramcode)?.paramvalue === value
|
|
|
+
|
|
|
// 获取当前资金账号对应的头寸
|
|
|
function getTaaccountPosition(accountid: number) {
|
|
|
return positions.value.filter(e => e.accountid === accountid)
|
|
|
@@ -141,7 +139,7 @@ export const useHazardRates = (positions: Ref<QueryTradePositionRsp[]>) => {
|
|
|
const profitloss = handleProfitloss(taaccount, false) as number
|
|
|
|
|
|
// 市值
|
|
|
- const price = getSystemParam('087', '1') ? handleHoldPrice(accountid) : 0
|
|
|
+ const price = hasSystemParam('087', '1') ? handleHoldPrice(accountid) : 0
|
|
|
// 风险净值 根据系统参数“087 风险净值是否加上市值 - 0:不加 1:加“
|
|
|
// 0. 风险净值=期末余额+浮动盈亏(收益权)-其他冻结-出金冻结
|
|
|
// 1. 风险净值=期末余额+市值+浮动盈亏(收益权)-其他冻结-出金冻结
|
|
|
@@ -154,7 +152,7 @@ export const useHazardRates = (positions: Ref<QueryTradePositionRsp[]>) => {
|
|
|
function netWorth(taaccount: Taaccount) {
|
|
|
const { accountid, currentbalance, otherfreezemargin, outamountfreeze } = taaccount
|
|
|
// 浮动盈亏
|
|
|
- const free = getSystemParam('037', '1') ? (otherfreezemargin + outamountfreeze) : 0
|
|
|
+ const free = hasSystemParam('037', '1') ? (otherfreezemargin + outamountfreeze) : 0
|
|
|
|
|
|
const profitloss = handleProfitloss(taaccount, false) as number
|
|
|
// 市值
|
|
|
@@ -171,7 +169,7 @@ export const useHazardRates = (positions: Ref<QueryTradePositionRsp[]>) => {
|
|
|
// 风险率 根据系统参数“132 风险率计算公式”:
|
|
|
// 1. 风险率=占用/风险净值
|
|
|
// 2. 风险率=(占用-授信金额)/(风险净值-授信金额)
|
|
|
- const credit = getSystemParam('132', '1') ? 0 : mortgagecredit
|
|
|
+ const credit = hasSystemParam('132', '1') ? 0 : mortgagecredit
|
|
|
let result = 0
|
|
|
if (riskValue && (riskValue - credit)) {
|
|
|
result = (usedmargin - credit) / (riskValue - credit)
|
|
|
@@ -193,7 +191,7 @@ export const useHazardRates = (positions: Ref<QueryTradePositionRsp[]>) => {
|
|
|
result = currentbalance + profitloss - freeze
|
|
|
} else {
|
|
|
// *系统参数”113“(当日浮动盈利是否可用) 0:不可用 1:可用
|
|
|
- const isUse = getSystemParam('113', '1')
|
|
|
+ const isUse = hasSystemParam('113', '1')
|
|
|
if (isUse) {
|
|
|
// 账户总浮动盈亏为正 且 113 = 1 :=期末余额+总浮动盈亏-占用-冻结-其它冻结-手续费冻结-出金冻结
|
|
|
result = currentbalance + profitloss - freeze
|