|
|
@@ -17,6 +17,7 @@ export const useSBYJOrder = (selectedRow?: Model.SBYJMyOrderRsp) => {
|
|
|
const orderComputedList = computed(() => {
|
|
|
orderList.value.forEach((e) => {
|
|
|
e.tHDetailEx.depositRate = calcDepositRate(e)
|
|
|
+ e.tHDetailEx.floatPL = floatpl(e)
|
|
|
})
|
|
|
return orderList.value
|
|
|
})
|
|
|
@@ -25,9 +26,19 @@ export const useSBYJOrder = (selectedRow?: Model.SBYJMyOrderRsp) => {
|
|
|
const detail = computed(() => {
|
|
|
if (selectedRow) {
|
|
|
selectedRow.depositRate = calcDepositRate(selectedRow)
|
|
|
+ selectedRow.tHDetailEx.floatPL = floatpl(selectedRow)
|
|
|
}
|
|
|
return selectedRow
|
|
|
- })
|
|
|
+ })
|
|
|
+
|
|
|
+ const floatpl = ({ tHDetailEx }: Model.SBYJMyOrderRsp) => {
|
|
|
+ const quote = futuresStore.getGoodsQuote(tHDetailEx.goodsID)
|
|
|
+ const { ask = 0, bid = 0, agreeunit = 0 } = quote.value ?? {}
|
|
|
+ const price = tHDetailEx.buyOrSell === BuyOrSell.Buy ? bid : ask // 根据方向取买卖价
|
|
|
+ // 计算浮动盈亏 (价格 * 手数 * 合约乘数 - 持仓金额) * 方向标识
|
|
|
+ const float = price ? price * tHDetailEx.holderQty * agreeunit - tHDetailEx.holderAmount : 0
|
|
|
+ return float * (tHDetailEx.buyOrSell === BuyOrSell.Buy ? 1 : -1)
|
|
|
+ }
|
|
|
|
|
|
// 计算定金率
|
|
|
const calcDepositRate = ({ tHDetailEx }: Model.SBYJMyOrderRsp) => {
|