|
|
@@ -89,6 +89,7 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
viewModel.getUserAccount()
|
|
|
viewModel.resetAccountData()
|
|
|
} else if (messageEvent.messageType == EventConstent.FID_MoneyChangedNtf) {//资金账号变化通知
|
|
|
+ viewModel.queryContractTradePosition("2")
|
|
|
viewModel.getUserAccount()
|
|
|
viewModel.resetAccountData()
|
|
|
} else if (messageEvent.messageType == EventConstent.FID_OrderDealedNtf){
|
|
|
@@ -766,7 +767,7 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
var lastprice: Double? = 0.0
|
|
|
|
|
|
it!!.postValueOfPosition.bindOptional(context){ its ->
|
|
|
- if(its != lastprice){
|
|
|
+ if(its != lastprice || (its == lastprice && lastprice == 0.0)){
|
|
|
lastprice = its
|
|
|
text = NumberUtils.roundNum(
|
|
|
NumberUtils.doubleDistortion(its?.toString()),
|
|
|
@@ -816,38 +817,42 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
*/
|
|
|
viewModel.usedAccountData.bindOptional(context) {
|
|
|
if (isOpenEye.value == true) {
|
|
|
- ///// 0 - 占用/净值 1 - 净值/占用
|
|
|
- val parmasvalue =
|
|
|
- GlobalDataCollection.instance?.getSystemParamsValue(
|
|
|
- "087"
|
|
|
- )
|
|
|
- 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
|
|
|
+ if(it != null) {
|
|
|
+ it!!.postValueOfPosition.bindOptional(context) { its ->
|
|
|
+///// 0 - 占用/净值 1 - 净值/占用
|
|
|
+ val parmasvalue =
|
|
|
+ GlobalDataCollection.instance?.getSystemParamsValue(
|
|
|
+ "087"
|
|
|
+ )
|
|
|
+ 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
|
|
|
- }
|
|
|
+ } else {//0.净值=期末余额+浮动盈亏(收益权)-其他冻结-出金冻结
|
|
|
+ it?.currentbalance?.plus(it.valueOfposition_keep_watch_profit_and_loss)
|
|
|
+ ?.minus(it.otherfreezemargin)
|
|
|
+ ?.minus(it.outamountfreeze) ?: 1.0
|
|
|
+ }
|
|
|
|
|
|
- var risk = 0.0
|
|
|
+ var risk = 0.0
|
|
|
// if (it?.valueOfposition != 0.0) {
|
|
|
- if (worth != 0.0) {
|
|
|
- risk = it?.usedmargin?.div(worth) ?: 0.0
|
|
|
- }
|
|
|
+ if (worth != 0.0) {
|
|
|
+ risk = it?.usedmargin?.div(worth) ?: 0.0
|
|
|
+ }
|
|
|
// text = NumberUtils.roundNum(
|
|
|
// NumberUtils.doubleDistortion(risk.toString()), 4
|
|
|
// ).toPercentage2()
|
|
|
|
|
|
- text = risk.toString().toPercentage2()
|
|
|
+ text = risk.toString().toPercentage2()
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
text = "****"
|
|
|
}
|