public void TestKucoinClient() { List <String> coins = new List <String> { "ETH", "BTC", "BCH", "NEO" }; TradingAgent agent = new TradingAgent(100.0d, coins); KuCoinApi.NetCore.KuCoinApiClient kucoinClient = agent.GetKucoinClient(); Assert.NotNull(kucoinClient); }
public void TestDecideTransaction() { List <String> coins = new List <String> { "ETH", "BTC", "BCH", "NEO" }; TradingAgent agent = new TradingAgent(100.0d, coins); KuCoinApi.NetCore.KuCoinApiClient kucoinClient = agent.GetKucoinClient(); KuCoinApi.NetCore.Entities.Tick[] ticks = kucoinClient.GetTicks(); agent.GetCoinInfo(ticks, coins); agent.DecideTransaction(); // Buying power has changed due to buy transaction being carried out. Assert.NotEqual(100.0d, agent.GetBuyingPower()); }
// Input 0: kucoin client for obtaining exchange rates, 1: String List of coins to search for. private static void Update(KuCoinApi.NetCore.KuCoinApiClient kucoinClient, List <String> coins) { int seconds = 10000, minutes = 1, hours = 1; KuCoinApi.NetCore.Entities.Tick[] ticks; ticks = kucoinClient.GetTicks(); if (ticks == null) { throw new ArgumentNullException("ERR: Ticks received from KucoinAPI is null"); } Console.WriteLine(agent.GetCoinInfo(ticks, coins)); agent.DecideTransaction(); Thread.Sleep(seconds * minutes * hours); }
private static void RunSimulation() { List <String> coins = new List <String> { "ETH", "BTC", "BCH", "NEO" }; agent = new TradingAgent(100000.0d, coins); KuCoinApi.NetCore.KuCoinApiClient kucoinClient = agent.GetKucoinClient(); //Main update loop while (true) { /* bot checks realtime data every x mins/seconds * Currently set to update every 10 seconds */ Update(kucoinClient, coins); } }