Пример #1
0
        internal Account(Newtonsoft.Json.Linq.JToken json) : this()
        {
            IsDeactivated             = (bool)json["deactivated"];
            IsWithdrawalHalted        = (bool)json["withdrawal_halted"];
            IsSweepEnabled            = (bool)json["sweep_enabled"];
            DepositHalted             = (bool)json["deposit_halted"];
            OnlyPositionClosingTrades = (bool)json["only_position_closing_trades"];

            UpdatedAt = (DateTime)json["updated_at"];

            AccountUrl   = new Url <Account>((string)json["url"]);
            PortfolioUrl = new Url <AccountPortfolio>((string)json["portfolio"]);
            UserUrl      = new Url <User>((string)json["user"]);
            PositionsUrl = new Url <AccountPositions>((string)json["positions"]);

            AccountNumber = (string)json["account_number"];
            AccountType   = (string)json["type"];

            Sma = (decimal?)json["sma"];
            SmaHeldForOrders  = (decimal?)json["sma_held_for_orders"];
            BuyingPower       = (decimal)json["buying_power"];
            Cash              = (decimal)json["cash"];
            CashHeldForOrders = (decimal)json["cash_held_for_orders"];
            UnclearedDeposits = (decimal)json["uncleared_deposits"];
            UnsettledFunds    = (decimal)json["unsettled_funds"];

            // mark MarginBalance, CashBalance null if they do not exist

            try { CashBalances = new CashBalance(json["cash_balances"]); }
            catch { CashBalances = null; }

            try { MarginBalances = new MarginBalance(json["margin_balances"]); }
            catch { MarginBalances = null; }

            MaxAchEarlyAccessAmount = (decimal)json["max_ach_early_access_amount"];
        }
Пример #2
0
 public Account()
 {
     CashBalances = new CashBalance();
 }