|  |  |  | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Param; | 
|---|
|  |  |  | import org.web3j.abi.datatypes.Int; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.math.BigDecimal; | 
|---|
|  |  |  | import java.util.HashMap; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public List<String> selectWholeHoldOrderSymbolsByMemberId(@Param("memberId") Long memberId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public int updateForcePriceBySymbolAndMemberId(@Param("forcePrice") BigDecimal forcePrice, @Param("memberId") Long memberId, @Param("symbol") String symbol); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | profitOrLoss = profitOrLoss.add(calProfitOrLoss(holdOrderEntity, memberEntity)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | log.info("{}, {}, {}, {}, {}, {}", totalBondAmount, symbolFeeAmount, symbolFeeAmount, openPrice, profitOrLoss, leverRatio); | 
|---|
|  |  |  | log.info("{}, {}, {}, {}, {}, {}", totalBondAmount, symbolBondAmount, symbolFeeAmount, openPrice, profitOrLoss, leverRatio); | 
|---|
|  |  |  | BigDecimal sub = walletContract.getTotalBalance().add(profitOrLoss).subtract(symbolFeeAmount).subtract(totalBondAmount); | 
|---|
|  |  |  | log.info("sub -- {}", sub); | 
|---|
|  |  |  | BigDecimal divide = sub.divide(symbolBondAmount, 8, BigDecimal.ROUND_DOWN); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | BigDecimal forcePrice = openPrice.subtract(divide.multiply(divide2)); | 
|---|
|  |  |  | log.info("forcePrice -- {}", forcePrice); | 
|---|
|  |  |  | holdOrderDao.updateForcePriceBySymbolAndMemberId(forcePrice, memberId, symbol); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | from contract_hold_order | 
|---|
|  |  |  | where position_type=2 and member_id=#{memberId} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <update id="updateForcePriceBySymbolAndMemberId"> | 
|---|
|  |  |  | update contract_hold_order | 
|---|
|  |  |  | set force_closing_price=#{forcePrice}, is_can_closing=1 | 
|---|
|  |  |  | where member_id=#{memberId} and symbol=#{symbol} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  | </mapper> | 
|---|