public List <SendHolding> PrepareSendHoldings() { var holdingList = new List <SendHolding>(); if (AccountHoldings == null || !AccountHoldings.Any()) { return(holdingList); } foreach (var holding in AccountHoldings) { if (decimal.Parse(holding.Amount) > 0) { holdingList.Add(new SendHolding { Amount = UnitConversion.ToDecimal(BigInteger.Parse(holding.Amount), GetTokenDecimals(holding.Symbol)), ChainName = holding.ChainName, Name = GetTokenName(holding.Symbol), Symbol = holding.Symbol, Icon = "phantasma_logo", Fungible = IsTokenFungible(holding.Symbol), Ids = holding.Ids }); } } return(holdingList); }
/// <summary> /// Clears this instance of <see cref="InteractiveBrokersAccountData"/> /// </summary> public void Clear() { AccountProperties.Clear(); CashBalances.Clear(); AccountHoldings.Clear(); FinancialAdvisorConfiguration.Clear(); }
public void Buy(string symbol, uint quantity, decimal price) { if (!AccountHoldings.ContainsKey(symbol)) { AccountHoldings.Add(symbol, new Holding(symbol, price, quantity)); } else { AccountHoldings[symbol].Quantity += quantity; } decimal transactionCost = GetTransactionCost(quantity, price); Balance -= (transactionCost + Commission); }