public Task <BestPriceToSellViewModel> GetBestPriceToSellAsync(TemBTCOrderBook orderBook, double btc_amount) { return(Task.Factory.StartNew(() => { decimal min_value = 2000; double withdrawal_fee_percent = (0.75 / 100); decimal withdrawal_fee_brl = 9; var best_price_to_sell_vm = new BestPriceToSellViewModel(); if (orderBook.Bids != null) { var prices_to_sell = orderBook.Bids; var best_price_to_sell = prices_to_sell.FirstOrDefault(p => p.Quantity >= btc_amount || ((decimal)p.Quantity * p.Price) > min_value); best_price_to_sell_vm.Exchange = "TemBTC"; if (prices_to_sell != null) { best_price_to_sell_vm.Price = best_price_to_sell.Price; best_price_to_sell_vm.Amount = best_price_to_sell.Quantity; var fee = (((decimal)btc_amount * best_price_to_sell.Price) * (decimal)withdrawal_fee_percent) + withdrawal_fee_brl; best_price_to_sell_vm.Valeu = (decimal)btc_amount * best_price_to_sell.Price; best_price_to_sell_vm.Fee = fee; } } return best_price_to_sell_vm; })); }
public Task <BestPriceToSellViewModel> GetBestPriceToSellAsync(IIIxbitOrderBook orderBook, double btc_amount) { return(Task.Factory.StartNew(() => { decimal min_value = 1000; double withdrawal_fee_percent = (0.25 / 100); decimal withdrawal_fee_brl = 9.90m; var best_price_to_sell_vm = new BestPriceToSellViewModel(); var prices_to_sell = orderBook.BuyOrders; var best_price_to_sell = prices_to_sell.FirstOrDefault(p => ((decimal)p.Quantity * p.Price) > min_value); if (best_price_to_sell != null) { best_price_to_sell.Price *= orderBook.ExchangeRate; if (best_price_to_sell != null) { best_price_to_sell_vm.Exchange = "3xBit"; best_price_to_sell_vm.ExchangeRate = orderBook.ExchangeRate; best_price_to_sell_vm.Price = best_price_to_sell.Price; best_price_to_sell_vm.Amount = best_price_to_sell.Quantity; var fee = (((decimal)btc_amount * best_price_to_sell.Price) * (decimal)withdrawal_fee_percent) + withdrawal_fee_brl; best_price_to_sell_vm.Valeu = ((decimal)btc_amount * best_price_to_sell.Price); best_price_to_sell_vm.Fee = fee; } } return best_price_to_sell_vm; })); }
public Task <BestPriceToSellViewModel> GetBestPriceToSellAsync(BraziliexOrderBook braziliexOrderBook, double btc_amount) { return(Task.Factory.StartNew(() => { decimal min_value = 2000; double withdrawal_fee_percent = (0.75 / 100); decimal withdrawal_fee_brl = 9; var best_price_to_sell_vm = new BestPriceToSellViewModel(); var prices_to_sell = braziliexOrderBook.Bids; var best_price_to_sell = prices_to_sell.Where(p => p.Amount >= btc_amount || ((decimal)p.Amount * p.Price) > min_value).FirstOrDefault(); if (prices_to_sell != null) { best_price_to_sell_vm.Exchange = "Braziliex"; best_price_to_sell_vm.Price = best_price_to_sell.Price; best_price_to_sell_vm.Amount = best_price_to_sell.Amount; var fee = (((decimal)btc_amount * best_price_to_sell.Price) * (decimal)withdrawal_fee_percent) + withdrawal_fee_brl; best_price_to_sell_vm.Valeu = (decimal)btc_amount * best_price_to_sell.Price; best_price_to_sell_vm.Fee = fee; } return best_price_to_sell_vm; })); }
public Task <BestPriceToSellViewModel> GetBestPriceToSellAsync(BitcointoyouOrderBook orderBook, double btc_amount) { return(Task.Factory.StartNew(() => { decimal min_value = 2000; double withdrawal_fee_percent = (1.89 / 100); decimal withdrawal_fee_brl = 9.70m; var best_price_to_sell_vm = new BestPriceToSellViewModel(); var prices_to_sell = orderBook.Bids; decimal best_price_to_sell = 0; double amount_to_sell = 0; for (int i = 0; i < (prices_to_sell.Length / 2) - 1; i++) { var value = (prices_to_sell[i, 0] * prices_to_sell[i, 1]); if (value > min_value) { best_price_to_sell = prices_to_sell[i, 0]; amount_to_sell = (double)prices_to_sell[i, 1]; break; } } best_price_to_sell_vm.Exchange = "Bitcointoyou"; if (prices_to_sell != null) { best_price_to_sell_vm.Price = best_price_to_sell; best_price_to_sell_vm.Amount = btc_amount; var fee = (((decimal)btc_amount * best_price_to_sell) * (decimal)withdrawal_fee_percent) + withdrawal_fee_brl; best_price_to_sell_vm.Valeu = ((decimal)btc_amount * best_price_to_sell); best_price_to_sell_vm.Fee = fee; } return best_price_to_sell_vm; })); }