Esempio n. 1
0
        /// <summary>
        /// 设置股票账户资金
        /// </summary>
        /// <param name="tradeResult"></param>
        private void SetSecurityTradingAccount(String stockCaptialResult)
        {
            m_securityTradingAccount = null;
            if (stockCaptialResult == null || stockCaptialResult.Length == 0)
            {
                return;
            }
            SecurityTradingAccount stockTradingAccount = SecurityTradingAccount.ConvertToStockTradingAccount(stockCaptialResult);

            if (stockTradingAccount == null)
            {
                return;
            }
            m_securityTradingAccount = stockTradingAccount;
            LabelA lblCapitalBalance = m_mainFrame.GetLabel("lblCapitalBalance");

            if (lblCapitalBalance != null)
            {
                lblCapitalBalance.Text = stockTradingAccount.m_capitalBalance.ToString();
            }
            LabelA lblFrozenCash = m_mainFrame.GetLabel("lblFrozenCash");

            if (lblFrozenCash != null)
            {
                lblFrozenCash.Text = stockTradingAccount.m_frozenCash.ToString();
            }
            LabelA lblAvailable = m_mainFrame.GetLabel("lblAvailable");

            if (lblAvailable != null)
            {
                lblAvailable.Text = stockTradingAccount.m_available.ToString();
            }
            LabelA lblWithdrawQuota = m_mainFrame.GetLabel("lblWithdrawQuota");

            if (lblWithdrawQuota != null)
            {
                lblWithdrawQuota.Text = stockTradingAccount.m_withdrawQuota.ToString();
            }
            LabelA lblStockValue = m_mainFrame.GetLabel("lblStockValue");

            if (lblStockValue != null)
            {
                lblStockValue.Text = stockTradingAccount.m_stockValue.ToString();
            }
            LabelA lblTotalCapital = m_mainFrame.GetLabel("lblTotalCapital");

            if (lblTotalCapital != null)
            {
                lblTotalCapital.Text = stockTradingAccount.m_totalCapital.ToString();
            }

            DivA divCapital = m_mainFrame.GetDiv("divCapital");

            divCapital.Invalidate();
        }
Esempio n. 2
0
        /// <summary>
        /// 字符串转换成持仓对象
        /// </summary>
        /// <param name="tradingAccountResult"></param>
        /// <returns></returns>
        public static SecurityTradingAccount ConvertToStockTradingAccount(String tradingAccountResult)
        {
            if (tradingAccountResult == null || tradingAccountResult.Length == 0)
            {
                return(null);
            }
            String[] tradingAccountFields = tradingAccountResult.Split(Environment.NewLine.ToCharArray(),
                                                                       StringSplitOptions.RemoveEmptyEntries);
            if (tradingAccountFields == null || tradingAccountFields.Length < 6)
            {
                return(null);
            }
            int index = 0;
            SecurityTradingAccount stockTradingAccount = new SecurityTradingAccount();

            stockTradingAccount.m_capitalBalance = CStrA.ConvertStrToDouble(tradingAccountFields[index++]);
            stockTradingAccount.m_frozenCash     = CStrA.ConvertStrToDouble(tradingAccountFields[index++]);
            stockTradingAccount.m_available      = CStrA.ConvertStrToDouble(tradingAccountFields[index++]);
            stockTradingAccount.m_withdrawQuota  = CStrA.ConvertStrToDouble(tradingAccountFields[index++]);
            stockTradingAccount.m_stockValue     = CStrA.ConvertStrToDouble(tradingAccountFields[index++]);
            stockTradingAccount.m_totalCapital   = CStrA.ConvertStrToDouble(tradingAccountFields[index++]);
            return(stockTradingAccount);
        }