|
@@ -1,5 +1,6 @@
|
|
|
import APP from '@/services';
|
|
import APP from '@/services';
|
|
|
import { useHolderprice, useProfitloss } from '@/services/bus/holdPosition';
|
|
import { useHolderprice, useProfitloss } from '@/services/bus/holdPosition';
|
|
|
|
|
+import { getMarketTradePropertyByGoodsId } from '@/services/bus/market';
|
|
|
import { QueryTradePositionRsp } from '@/services/go/ermcp/order/interface';
|
|
import { QueryTradePositionRsp } from '@/services/go/ermcp/order/interface';
|
|
|
import { Taaccount } from '@/services/go/TaAccount/interface';
|
|
import { Taaccount } from '@/services/go/TaAccount/interface';
|
|
|
import { Systemparam } from '@/services/go/useInfo/interface';
|
|
import { Systemparam } from '@/services/go/useInfo/interface';
|
|
@@ -114,8 +115,13 @@ export const useHazardRates = (positions: Ref<QueryTradePositionRsp[]>) => {
|
|
|
function handleProfitloss({ accountid }: Taaccount, isDecimalPace = true) {
|
|
function handleProfitloss({ accountid }: Taaccount, isDecimalPace = true) {
|
|
|
const decimalplace = getDecimalplace()
|
|
const decimalplace = getDecimalplace()
|
|
|
const result = getTaaccountPosition(accountid).reduce((acc: number, current: QueryTradePositionRsp) => {
|
|
const result = getTaaccountPosition(accountid).reduce((acc: number, current: QueryTradePositionRsp) => {
|
|
|
- const profitloos = useProfitloss(current)
|
|
|
|
|
- const temp = profitloos === '--' ? 0 : Number(profitloos)
|
|
|
|
|
|
|
+ const tradeproperty = getMarketTradePropertyByGoodsId(current.goodsid)
|
|
|
|
|
+ let temp = 0
|
|
|
|
|
+ if (tradeproperty === 1) {
|
|
|
|
|
+ // 资金 只算 收益权
|
|
|
|
|
+ const profitloos = useProfitloss(current)
|
|
|
|
|
+ temp = profitloos === '--' ? 0 : Number(profitloos)
|
|
|
|
|
+ }
|
|
|
return acc + temp
|
|
return acc + temp
|
|
|
}, 0)
|
|
}, 0)
|
|
|
return isDecimalPace ? result.toFixed(decimalplace) : result
|
|
return isDecimalPace ? result.toFixed(decimalplace) : result
|
|
@@ -141,15 +147,20 @@ export const useHazardRates = (positions: Ref<QueryTradePositionRsp[]>) => {
|
|
|
// 1. 风险净值=期末余额+市值+浮动盈亏(收益权)-其他冻结-出金冻结
|
|
// 1. 风险净值=期末余额+市值+浮动盈亏(收益权)-其他冻结-出金冻结
|
|
|
return currentbalance + price + profitloss - otherfreezemargin - outamountfreeze
|
|
return currentbalance + price + profitloss - otherfreezemargin - outamountfreeze
|
|
|
}
|
|
}
|
|
|
- // 净值期 末余额+市值+浮动盈亏(收益权
|
|
|
|
|
|
|
+ // 净值
|
|
|
|
|
+ // 根据系统参数“307 账户净值是否减冻结资金 - 0:不减 1:减“
|
|
|
|
|
+ //0.净值=期末余额+市值+浮动盈亏(收益权)
|
|
|
|
|
+ //1.净值=期末余额+市值+浮动盈亏(收益权)-其他冻结-出金冻结
|
|
|
function netWorth(taaccount: Taaccount) {
|
|
function netWorth(taaccount: Taaccount) {
|
|
|
- const { accountid, currentbalance } = taaccount
|
|
|
|
|
|
|
+ const { accountid, currentbalance, otherfreezemargin, outamountfreeze } = taaccount
|
|
|
// 浮动盈亏
|
|
// 浮动盈亏
|
|
|
|
|
+ const free = getSystemParam('037', '1') ? (otherfreezemargin + outamountfreeze) : 0
|
|
|
|
|
+
|
|
|
const profitloss = handleProfitloss(taaccount, false) as number
|
|
const profitloss = handleProfitloss(taaccount, false) as number
|
|
|
// 市值
|
|
// 市值
|
|
|
const price = handleHoldPrice(accountid)
|
|
const price = handleHoldPrice(accountid)
|
|
|
const decimalplace = getDecimalplace()
|
|
const decimalplace = getDecimalplace()
|
|
|
- return (currentbalance + profitloss + price).toFixed(decimalplace)
|
|
|
|
|
|
|
+ return (currentbalance + profitloss + price - free).toFixed(decimalplace)
|
|
|
}
|
|
}
|
|
|
// 风险率
|
|
// 风险率
|
|
|
function hazardRates(taaccount: Taaccount) {
|
|
function hazardRates(taaccount: Taaccount) {
|