public async Task StartAsync() { while (true) { bestValue.SmallestHighest("ask"); bestValue.SmallestHighest("bid"); best.MaxBid = bestValue.MaxValue; best.MinAsk = bestValue.MinValue; best.MaxUrl = bestValue.MaxUrl; best.MinUrl = bestValue.MinUrl; decimal suspectedProfit = (best.MaxBid - best.MinAsk) / best.MinAsk; bestValue.MaxValue = 0; bestValue.MinValue = 0; Print(suspectedProfit); if (exchanges.Checker(suspectedProfit) > 0) { switch (best.MinUrl) { case "Binance": await buySell.BinanceBuySell("buy"); break; case "Bitfinex": await bitfinexApiV1.ExecuteBuyOrderAsync(0.01m, 100, OrderExchange.Bitfinex, OrderSymbol.ETHBTC, OrderType.MarginMarket); break; case "Bitforex": await buySell.Bitforex("buy"); break; } switch (best.MaxUrl) { case "Binance": buySell.BinanceBuySell("sell").Wait(); break; case "Bitfinex": await bitfinexApiV1.ExecuteSellOrderAsync(0.01m, 100, OrderExchange.Bitfinex, OrderSymbol.ETHBTC, OrderType.MarginMarket); break; case "Bitforex": await buySell.Bitforex("sell"); break; } } Print(suspectedProfit); Thread.Sleep(1500); } }
public async Task Bitfinex(string BuyOrSell) { BitfinexAssets assets = new BitfinexAssets(); var user = new BitfinexApiV1("yIruCEm5k2TkExflzSf183xBp4HUt66G2BDx6WJqlL7HATRyJmcgp5UAiqYl0XsF", "BEqWhtDUPDIpNmaHFxA5ZhXLElcS74oal6yHLEx5sbE5gu46EsYLAfWAx1veyUr0"); Console.WriteLine("Successfull"); switch (BuyOrSell) { case "buy": await user.ExecuteBuyOrderAsync(1000, 1, OrderExchange.Bitfinex, OrderSymbol.ETHBTC, BitfinexApi.OrderType.MarginMarket); break; case "sell": await user.ExecuteSellOrderAsync(1000, 1, OrderExchange.Bitfinex, OrderSymbol.ETHBTC, BitfinexApi.OrderType.MarginMarket); break; } }