|
|
@@ -195,6 +195,37 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ textView {
|
|
|
+ //////交易状态 - 1:正常 2:受限 3:冻结 4:禁止建仓(人工受限) 5:禁止交易(人工冻结) 6:待激活 7:已注销
|
|
|
+ viewModel.usedAccountData.bindOptional(context){
|
|
|
+ if (it?.tradestatus?.toInt() == 1){
|
|
|
+ text = "正常"
|
|
|
+ textColorInt = R.color.rma_green_color
|
|
|
+ }else if (it?.tradestatus?.toInt() == 2){
|
|
|
+ text = "受限"
|
|
|
+ textColorInt = R.color.rma_red_color
|
|
|
+ }else if (it?.tradestatus?.toInt() == 3){
|
|
|
+ text = "冻结"
|
|
|
+ textColorInt = R.color.rma_red_color
|
|
|
+ }else if (it?.tradestatus?.toInt() == 4){
|
|
|
+ text = "禁止建仓"
|
|
|
+ textColorInt = R.color.rma_red_color
|
|
|
+ }else if (it?.tradestatus?.toInt() == 5){
|
|
|
+ text = "禁止交易"
|
|
|
+ textColorInt = R.color.rma_red_color
|
|
|
+ }else if (it?.tradestatus?.toInt() == 6){
|
|
|
+ text = "待激活"
|
|
|
+ textColorInt = R.color.rma_red_color
|
|
|
+ }else if (it?.tradestatus?.toInt() == 7){
|
|
|
+ text = "已注销"
|
|
|
+ textColorInt = R.color.rma_red_color
|
|
|
+ }
|
|
|
+ }
|
|
|
+ textSizeAuto = 27
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(20)
|
|
|
+ }
|
|
|
+
|
|
|
emptyView()
|
|
|
|
|
|
imageView {
|
|
|
@@ -268,12 +299,7 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
*/
|
|
|
viewModel.usedAccountData.bindOptional(context) {
|
|
|
if (isOpenEye.value == true){
|
|
|
- text = NumberUtils.roundNum(
|
|
|
- NumberUtils.doubleDistortion(
|
|
|
- it?.valueOfposition?.minus(it.raisedAmount)
|
|
|
- ?.plus(it.currentbalance).toString()
|
|
|
- ), 2
|
|
|
- )
|
|
|
+ text = NumberUtils.roundNum(it?.currentbalance?.toString(),2)
|
|
|
}else{
|
|
|
text = "****"
|
|
|
}
|
|
|
@@ -299,14 +325,23 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
|
|
|
textView {
|
|
|
/**
|
|
|
- * 可用取期末余额
|
|
|
+ * 当总盈亏为负时
|
|
|
+ * 可用=期末余额+总浮动盈亏-占用-冻结-其他冻结-手续费冻结-出金冻结
|
|
|
+ * 当总盈亏为正时
|
|
|
+ * 可用=期末余额-占用-冻结-其他冻结-手续费冻结-出金冻结
|
|
|
*/
|
|
|
viewModel.usedAccountData.bindOptional(context) {
|
|
|
if (isOpenEye.value == true){
|
|
|
- text = NumberUtils.roundNum(
|
|
|
- NumberUtils.doubleDistortion(it?.canUserAmount?.toString()),
|
|
|
- 2
|
|
|
- )
|
|
|
+ if (it?.valueOfposition_keep_watch_profit_and_loss ?: 0.0 > 0){
|
|
|
+ val parmasvalue = GlobalDataCollection.instance?.getSystemParamsValue("143")
|
|
|
+ if (parmasvalue == "1"){
|
|
|
+ text = NumberUtils.roundNum(NumberUtils.doubleDistortion(it?.canUserAmount?.plus(it.valueOfposition_keep_watch_profit_and_loss)?.toString()),2)
|
|
|
+ }else if (parmasvalue == "0"){
|
|
|
+ text = NumberUtils.roundNum(NumberUtils.doubleDistortion(it?.canUserAmount?.toString()),2)
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ text = NumberUtils.roundNum(NumberUtils.doubleDistortion(it?.canUserAmount?.plus(it.valueOfposition_keep_watch_profit_and_loss)?.toString()),2)
|
|
|
+ }
|
|
|
}else{
|
|
|
text = "****"
|
|
|
}
|
|
|
@@ -339,8 +374,10 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
viewModel.usedAccountData.bindOptional(context) {
|
|
|
if (isOpenEye.value == true){
|
|
|
text = NumberUtils.roundNum(
|
|
|
- NumberUtils.doubleDistortion(it?.valueOfposition?.toString()),
|
|
|
- 2
|
|
|
+ NumberUtils.doubleDistortion(
|
|
|
+ it?.valueOfposition?.minus(it.raisedAmount)
|
|
|
+ ?.plus(it.currentbalance).toString()
|
|
|
+ ), 2
|
|
|
)
|
|
|
}else{
|
|
|
text = "****"
|
|
|
@@ -416,7 +453,7 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
viewModel.usedAccountData.bindOptional(context) {
|
|
|
if (isOpenEye.value == true){
|
|
|
text = NumberUtils.roundNum(
|
|
|
- NumberUtils.doubleDistortion(it?.keep_watch_profit_and_loss?.toString()),
|
|
|
+ NumberUtils.doubleDistortion(it?.valueOfposition_keep_watch_profit_and_loss?.toString()),
|
|
|
2
|
|
|
)
|
|
|
}else{
|
|
|
@@ -449,18 +486,23 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
///// 0 - 占用/净值 1 - 净值/占用
|
|
|
val parmasvalue = GlobalDataCollection.instance?.getSystemParamsValue("143")
|
|
|
var risk = 0.0
|
|
|
- if (parmasvalue == "0"){
|
|
|
- if (it?.valueOfposition != 0.0){
|
|
|
- risk = it?.usedmargin?.div(it.valueOfposition) ?: 0.0
|
|
|
- }
|
|
|
-
|
|
|
- }else if (parmasvalue == "1"){
|
|
|
- if (it?.valueOfposition != 0.0){
|
|
|
- risk = it?.valueOfposition?.div(it.usedmargin) ?: 0.0
|
|
|
- }
|
|
|
+ if (it?.valueOfposition != 0.0){
|
|
|
+ risk = it?.usedmargin?.div((it.currentbalance.plus(
|
|
|
+ it.valueOfposition_keep_watch_profit_and_loss
|
|
|
+ ).minus(it.otherfreezemargin).minus(it.outamountfreeze))) ?: 0.0
|
|
|
}
|
|
|
-
|
|
|
- text = risk.toString().toPercentage()
|
|
|
+// if (parmasvalue == "0"){
|
|
|
+//
|
|
|
+//
|
|
|
+// }else if (parmasvalue == "1"){
|
|
|
+// if (it?.usedmargin != 0.0){
|
|
|
+// risk = (it?.currentbalance?.plus(
|
|
|
+// it.valueOfposition_keep_watch_profit_and_loss
|
|
|
+// )?.minus(it.otherfreezemargin)?.minus(it.outamountfreeze))?.div(it.usedmargin) ?: 0.0
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ text = NumberUtils.roundNum(NumberUtils.doubleDistortion(risk.toString()),4).toPercentage()
|
|
|
}else{
|
|
|
text = "****"
|
|
|
}
|