private bool Compare(CurrencyWalletPair exchange1, CurrencyWalletPair exchange2) { var quote1 = exchange1.LastTick(); var quote2 = exchange2.LastTick(); if (quote1 == null || quote2 == null) return false; string desc = string.Format("Arb detected, buy {1} sell {0}", quote1.SourceExchange, quote2.SourceExchange); CurrencyWalletPair ltcRebalance = new CurrencyWalletPair(exchange1.destinationWallet, exchange2.destinationWallet , dataStore); CurrencyWalletPair btcRebalance = new CurrencyWalletPair(exchange1.sourceWallet, exchange2.sourceWallet , dataStore); #region -- Execution -- var trade = new Trade(desc); trade.Transactions.Add(new Transaction(exchange1)); trade.Transactions.Add(new Transaction(exchange2)); trade.Transactions.Add(new Transaction(ltcRebalance)); trade.Transactions.Add(new Transaction(btcRebalance)); var result = trade.Execute(1); if (result <= 1) return false; //Loses money //notificationEngine.TradeSignal(quote1, quote2); notificationEngine.TradeSignal(trade); #endregion return true; }
public Transaction(CurrencyWalletPair _pair) { pair = _pair; }
public void Store(CurrencyWalletPair pair) { _pairs.Add(pair); }