public void InitExchange() { var exchangeSymbols = ExchangeConnecter.RequestExchangeState(); foreach (var symbolObj in exchangeSymbols) { AddSymbol(symbolObj); } }
public Controller(string startAsset) { exchangeState = new ExchangeState(); exchangeConnection = new ExchangeConnecter(exchangeState); parser = new Parser(exchangeState); exchangeState.InitExchange(); exchangeConnection.InitValues(); graph = new GraphNet(exchangeState); exchangeConnection.Start(); var orderGen = new OrderGenerator(graph, exchangeState); // todo: put this in a method while (true) { try { var tick = parser.ParseData(exchangeConnection.GetRawData()); UpdateEdge(tick); if (exchangeConnection.isEmpty()) { var path = graph.BellmanFord(startAsset); if (path.Count > 0 && path[0] != "NA" && path[0] == startAsset) { var order = orderGen.GenerateOrder(path, 2.0); var we = graph.GetSumEdgeWeight(path); Console.WriteLine("-----------------------"); Console.WriteLine(order); Console.WriteLine("Profit Rate: " + Math.Pow(10, -we) * 1); } } } catch (Exception e) { Console.WriteLine(e.Message); } } }