package cn.muchinfo.rma.view.base.future

import androidx.lifecycle.MutableLiveData
import cn.muchinfo.rma.global.GlobalDataCollection
import cn.muchinfo.rma.global.data.AccountData
import cn.muchinfo.rma.view.base.BaseViewModel

class FutureViewModel : BaseViewModel() {
    /**
     * 使用的当前的资金账户信息
     */
    val usedAccountData : MutableLiveData<AccountData> = MutableLiveData()

    /**
     * 更新交易下单的account
     */
    fun initAccountData(){
        val accountDataList = GlobalDataCollection.instance?.accountDataList
        if (accountDataList.isNullOrEmpty().not()){
            usedAccountData.postValue(GlobalDataCollection.instance?.accountData)
        }
    }

    fun getAccountInfo(accountInfo: AccountData?): String {
        return accountInfo?.accountname + "(" + accountInfo?.accountid + ")"
    }
}