|
|
@@ -239,21 +239,17 @@ open class AccountData(
|
|
|
} else {
|
|
|
if (it.averageprice == "" || it.averageprice == "0") {
|
|
|
Profit = 0.0
|
|
|
- } else {
|
|
|
+ } else {// 买方向 = (最新价)*持仓数量*合约单位-持仓总金额*方向(买【1】:卖【-1】)
|
|
|
if (it.buyorsell == "1") { //卖方向
|
|
|
Profit = NumberUtils.roundNum(
|
|
|
- (quoteDayData.getPrice().minus(
|
|
|
- it.averageprice?.toDouble() ?: 0.0
|
|
|
- )).times(it.curpositionqty?.toDouble() ?: 0.0)
|
|
|
- .times(goodsInfo2.agreeunit).times(-1).toString(),
|
|
|
+ (quoteDayData.getPrice()).times(it.curpositionqty?.toDouble() ?: 0.0)
|
|
|
+ .times(goodsInfo2.agreeunit).minus((it.curholderamount?.toDouble() ?: 0.0).times(-1)).toString(),
|
|
|
2
|
|
|
).toDouble()
|
|
|
} else {
|
|
|
Profit = NumberUtils.roundNum(
|
|
|
- (quoteDayData.getPrice().minus(
|
|
|
- it.averageprice?.toDouble() ?: 0.0
|
|
|
- )).times(it.curpositionqty?.toDouble() ?: 0.0)
|
|
|
- .times(goodsInfo2.agreeunit).toString(),
|
|
|
+ (quoteDayData.getPrice()).times(it.curpositionqty?.toDouble() ?: 0.0)
|
|
|
+ .times(goodsInfo2.agreeunit).minus(it.curholderamount?.toDouble() ?: 0.0).toString(),
|
|
|
2
|
|
|
).toDouble()
|
|
|
}
|