private bool Compare(IExchange exchange1, IExchange exchange2) { var quote1 = exchange1.GetLastQuote(); var quote2 = exchange2.GetLastQuote(); if (quote1 == null || quote2 == null) return false; if (quote1.Bid <= quote2.Ask) return false; #region -- Prepare -- string desc = string.Format("Arb detected, buy {1} sell {0}", quote1.SourceExchange, quote2.SourceExchange); Console.WriteLine(desc); decimal qty = 1; //Determine this based on how much cash is left #endregion #region -- Execution -- var trade = new Trade(desc); /* trade.Transactions.Add(new MarketOrderBuyBTCTransaction(exchange1, qty, quote1.Bid)); trade.Transactions.Add(new MarketOrderSellBTCTransaction(exchange2, qty, quote1.Bid)); */ //notificationEngine.TradeSignal(quote1, quote2); notificationEngine.TradeSignal(trade); #endregion return true; }
private bool Compare(IExchange exchange1, IExchange exchange2) { var quote1 = exchange1.GetLastQuote(); var quote2 = exchange2.GetLastQuote(); if (quote1 == null || quote2 == null) { return(false); } if (quote1.Bid <= quote2.Ask) { return(false); } #region -- Prepare -- string desc = string.Format("Arb detected, buy {1} sell {0}", quote1.SourceExchange, quote2.SourceExchange); Console.WriteLine(desc); decimal qty = 1; //Determine this based on how much cash is left #endregion #region -- Execution -- var trade = new Trade(desc); /* * trade.Transactions.Add(new MarketOrderBuyBTCTransaction(exchange1, qty, quote1.Bid)); * trade.Transactions.Add(new MarketOrderSellBTCTransaction(exchange2, qty, quote1.Bid)); */ //notificationEngine.TradeSignal(quote1, quote2); notificationEngine.TradeSignal(trade); #endregion return(true); }