public async Task <bool> Delete(ExchangeCoin contract) { var entity = ContractToEntity(contract); var result = await _ecRepo.Delete(entity); return(result); }
public async Task <ExchangeCoin> Update(ExchangeCoin contract) { var entity = ContractToEntity(contract); entity = await _ecRepo.Update(entity); return(EntityToContract(entity)); }
private ExchangeCoin BalanceToExchangeCoin(Balance balance, Exchange exchange) { var exCoin = new ExchangeCoin { Exchange = exchange, Quantity = balance.Available + balance.Frozen, Symbol = balance.Symbol }; return(exCoin); }
private async Task <ExchangeCoin> GetFullCoin(ExchangeCoin exchangeCoin) { var coinBuys = await _cbBldr.GetLatest(exchangeCoin.Symbol, exchangeCoin.Quantity, exchangeCoin.Exchange); var orders = await _eoBldr.GetLatest(exchangeCoin.Symbol, exchangeCoin.Exchange); exchangeCoin.OpenOrderList = orders.ToList(); exchangeCoin.CoinBuyList = coinBuys.ToList(); return(exchangeCoin); }
private ExchangeCoin EntityToContract(Entities.Portfolio.ExchangeCoin entity) { var contract = new ExchangeCoin { ExchangeCoinId = entity.Id, Exchange = entity.Exchange, Quantity = entity.Quantity, Symbol = entity.Symbol }; return(contract); }
private Entities.Portfolio.ExchangeCoin ContractToEntity(ExchangeCoin contract) { var entity = new Entities.Portfolio.ExchangeCoin { Id = contract.ExchangeCoinId, AverageBuy = contract.AverageBuy, Exchange = contract.Exchange, Quantity = contract.Quantity, Symbol = contract.Symbol }; return(entity); }
/// <summary> /// Create an exchange coin from a ExchangeHub Balance object /// </summary> /// <param name="balance">Balance object to convert</param> /// <returns>new ExchangeCoin object</returns> public ExchangeCoin CreateExchangeCoin(ExchangeHub.Contracts.Balance balance) { var exchangeCoin = new ExchangeCoin { Quantity = balance.Available + balance.Frozen, Symbol = balance.Symbol, Exchange = StringToExchange(currentExchange), CoinBuyList = new List <CoinBuy>(), ExchangeCoinId = 0, OpenOrderList = new List <ExchangeOrder>() }; return(exchangeCoin); }
public void GetExchangCoinTest() { var balance = testObjs.GetExchangeHubBalances().Where(b => b.Symbol.Equals("BTC")).FirstOrDefault(); var expected = new ExchangeCoin { Quantity = 0.025M, Symbol = "BTC", Exchange = Cryptobitfolio.Business.Entities.Exchange.Binance, CoinBuyList = new List <CoinBuy>(), ExchangeCoinId = 0, OpenOrderList = new List <Cryptobitfolio.Business.Contracts.Trade.ExchangeOrder>() }; var exchangeCoin = exchangeBuilder.CreateExchangeCoin(balance); Assert.NotNull(exchangeCoin); Assert.Equal(expected.Exchange, exchangeCoin.Exchange); Assert.Equal(expected.Quantity, exchangeCoin.Quantity); Assert.Equal(expected.Symbol, exchangeCoin.Symbol); }