|
|
@@ -624,54 +624,49 @@ class MoneyInfoUI(
|
|
|
* 风险率
|
|
|
*/
|
|
|
viewModel.usedAccountData.bindOptional(context) {
|
|
|
- ///// 0 - 占用/净值 1 - 净值/占用
|
|
|
- val parmasvalue =
|
|
|
- GlobalDataCollection.instance?.getSystemParamsValue(
|
|
|
- "087"
|
|
|
- )
|
|
|
-// var worth = 0.0
|
|
|
-// if (parmasvalue == "1") {//1.风险净值=期末余额+市值+浮动盈亏(收益权)-其他冻结-出金冻结
|
|
|
-// worth = it?.currentbalance?.plus(
|
|
|
-// it.valueOfposition
|
|
|
-// )?.plus(it.valueOfposition_keep_watch_profit_and_loss)
|
|
|
-// ?.minus(it.otherfreezemargin)
|
|
|
-// ?.minus(it.outamountfreeze) ?: 0.0
|
|
|
-//
|
|
|
-//
|
|
|
-// } else {//0.净值=期末余额+浮动盈亏(收益权)-其他冻结-出金冻结
|
|
|
-// worth = it?.currentbalance?.plus(it.valueOfposition_keep_watch_profit_and_loss)
|
|
|
-// ?.minus(it.otherfreezemargin)
|
|
|
-// ?.minus(it.outamountfreeze) ?: 1.0
|
|
|
-// }
|
|
|
- val worth: Double
|
|
|
- worth =
|
|
|
- if (parmasvalue == "1") {//1.风险净值=期末余额+市值+浮动盈亏(收益权)-其他冻结-出金冻结
|
|
|
- it?.currentbalance?.plus(
|
|
|
- it.valueOfposition
|
|
|
- )
|
|
|
- ?.plus(it.valueOfposition_keep_watch_profit_and_loss)
|
|
|
- ?.minus(it.otherfreezemargin)
|
|
|
- ?.minus(it.outamountfreeze) ?: 0.0
|
|
|
-
|
|
|
|
|
|
- } else {//0.净值=期末余额+浮动盈亏(收益权)-其他冻结-出金冻结
|
|
|
- it?.currentbalance?.plus(it.valueOfposition_keep_watch_profit_and_loss)
|
|
|
- ?.minus(it.otherfreezemargin)
|
|
|
- ?.minus(it.outamountfreeze) ?: 1.0
|
|
|
- }
|
|
|
+ if (it != null) {
|
|
|
+ it!!.postValueOfPosition.bindOptional(context) { its ->
|
|
|
+ if (its != null) {
|
|
|
+ ///// 0 - 占用/净值 1 - 净值/占用
|
|
|
+ val parmasvalue =
|
|
|
+ GlobalDataCollection.instance?.getSystemParamsValue(
|
|
|
+ "087"
|
|
|
+ )
|
|
|
|
|
|
- var risk = 0.0
|
|
|
- if (worth != 0.0) {
|
|
|
- risk = it?.usedmargin?.div(worth) ?: 0.0
|
|
|
- }
|
|
|
+ val worth: Double
|
|
|
+ worth =
|
|
|
+ if (parmasvalue == "1") {//1.风险净值=期末余额+市值+浮动盈亏(收益权)-其他冻结-出金冻结
|
|
|
+ it?.currentbalance?.plus(
|
|
|
+ it.valueOfposition
|
|
|
+ )
|
|
|
+ ?.plus(its)
|
|
|
+ ?.minus(it.otherfreezemargin)
|
|
|
+ ?.minus(it.outamountfreeze) ?: 0.0
|
|
|
+
|
|
|
+
|
|
|
+ } else {//0.净值=期末余额+浮动盈亏(收益权)-其他冻结-出金冻结
|
|
|
+ it?.currentbalance?.plus(its)
|
|
|
+ ?.minus(it.otherfreezemargin)
|
|
|
+ ?.minus(it.outamountfreeze) ?: 1.0
|
|
|
+ }
|
|
|
+
|
|
|
+ var risk = 0.0
|
|
|
+ if (worth != 0.0) {
|
|
|
+ risk = it?.usedmargin?.div(worth) ?: 0.0
|
|
|
+ }
|
|
|
// text =
|
|
|
// NumberUtils.roundNum(NumberUtils.doubleDistortion(risk.toString()), 4)
|
|
|
// .toPercentage()
|
|
|
|
|
|
- text = risk.toString().toPercentage2()
|
|
|
- }
|
|
|
- textSizeAuto = 36
|
|
|
- textColorInt = R.color.rma_black_33
|
|
|
+ text = risk.toString().toPercentage2()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ textSizeAuto = 36
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}.lparams(wrapContent, wrapContent)
|
|
|
|
|
|
}.lparams(matchParent, autoSize(100))
|