예제 #1
0
        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;
        }
예제 #2
0
 public Transaction(CurrencyWalletPair _pair)
 {
     pair = _pair;
 }
예제 #3
0
 public void Store(CurrencyWalletPair pair)
 {
     _pairs.Add(pair);
 }
예제 #4
0
 public Transaction(CurrencyWalletPair _pair)
 {
     pair = _pair;
 }