Example #1
0
        public void GDax()
        {
            ExchangeMonitorConfig config = new ExchangeMonitorConfig(ExchangeName.GDax);

            monitor = new ExchangeMonitor(config);
            Assert.IsTrue(Coin.ethereum.Best(Coin.bitcoin, true).askPrice > 0);
        }
Example #2
0
        public void AllExchanges()
        {
            monitor = new ExchangeMonitor(
                new ExchangeMonitorConfig());

            int count = monitor.allCoins.Count();

            Assert.IsTrue(count > 600); // Cryptopia is the largest with about 500
        }
Example #3
0
 public RestExchange(
     ExchangeMonitor exchangeMonitor,
     ExchangeName exchangeName,
     int maxRequestsPerMinute,
     string baseUrl)
     : base(exchangeMonitor, exchangeName, maxRequestsPerMinute)
 {
     restClient = new RestClient(baseUrl);
 }
Example #4
0
        public void BasicExchange()
        {
            ExchangeMonitorConfig config = new ExchangeMonitorConfig(exchangeName);

            monitor = new ExchangeMonitor(config);
            TradingPair pair = popularQuoteCoin.Best(popularBaseCoin, true);

            Assert.IsTrue(pair.askPrice > 0);
        }
Example #5
0
        public void CryptopiaMyWish()
        {
            ExchangeMonitorConfig config = new ExchangeMonitorConfig(ExchangeName.Cryptopia);

            monitor = new ExchangeMonitor(config);
            Coin        wish = Coin.FromName("MyWish");
            TradingPair pair = wish.Best(Coin.bitcoin, true);

            Assert.IsTrue(pair.askPrice > 0);
        }
Example #6
0
        public void Idex()
        {
            ExchangeMonitorConfig config = new ExchangeMonitorConfig(ExchangeName.Idex);

            monitor = new ExchangeMonitor(config);
            Coin        omg  = Coin.FromName("OmiseGO");
            TradingPair pair = omg.Best(Coin.ethereum, true);

            Assert.IsTrue(pair.askPrice > 0);
        }
Example #7
0
        public void AEX()
        {
            ExchangeMonitorConfig config = new ExchangeMonitorConfig(ExchangeName.AEX);

            monitor = new ExchangeMonitor(config);
            Coin        ardor = Coin.FromName("Ardor");
            TradingPair pair  = ardor.Best(Coin.bitcoin, true);

            Assert.IsTrue(pair.askPrice > 0);
        }
Example #8
0
        void Worker_DoWork(
            object sender,
            DoWorkEventArgs e)
        {
            ExchangeMonitorConfig config = new ExchangeMonitorConfig(
                ExchangeName.Binance,
                ExchangeName.Cryptopia,
                ExchangeName.Kucoin);

            exchangeMonitor = new ExchangeMonitor(config);
        }
Example #9
0
 public RestExchange(
     ExchangeMonitor exchangeMonitor,
     ExchangeName exchangeName,
     int maxRequestsPerMinute,
     string baseUrl,
     Method method = Method.GET)
     : base(exchangeMonitor, exchangeName, maxRequestsPerMinute)
 {
     restClient  = new RestClient(baseUrl);
     this.method = method;
 }
Example #10
0
 /// <summary>
 /// Every 60 seconds the number of calls can not be more than 120 times.
 /// </summary>
 public AEXExchange(
     ExchangeMonitor exchangeMonitor)
     : base(exchangeMonitor, ExchangeName.AEX, 120, "https://api.aex.com")
 {
     client = new RestClient("https://www.aex.com");
     exchangeMonitor.AddAlias("BitcoinGod", "Bitcoin God");
     exchangeMonitor.AddAlias("Tether USD", "Tether");
     exchangeMonitor.AddAlias("CanYa", "CanYaCoin");
     exchangeMonitor.AddAlias("New Economy Movement", "NEM");
     exchangeMonitor.AddAlias("Lightning Bitcoin", "Lightning Bitcoin [Futures]");
     exchangeMonitor.AddAlias("UnitedBitcoin", "United Bitcoin");
 }
Example #11
0
        public void AllTradingPairs()
        {
            monitor = new ExchangeMonitor(
                new ExchangeMonitorConfig(
                    ExchangeName.Binance,
                    ExchangeName.Cryptopia,
                    ExchangeName.Kucoin));

            Coin omg   = Coin.FromName("OmiseGO");
            int  count = omg.allTradingPairs.Count();

            Assert.IsTrue(count >= 5); // ~2 each (BTC and ETH)
        }
Example #12
0
        public void BitcoinPairs()
        {
            monitor = new ExchangeMonitor(
                new ExchangeMonitorConfig(
                    ExchangeName.Binance,
                    ExchangeName.Cryptopia,
                    ExchangeName.Kucoin));

            Coin        ark  = Coin.FromName("Ark");
            TradingPair pair = Coin.bitcoin.Best(ark, true);

            Assert.IsTrue(pair == null);

            TradingPair otherPair = ark.Best(Coin.bitcoin, true);

            Assert.IsTrue(otherPair != null);
        }
Example #13
0
        public PriceTarget()
        {
            ExchangeMonitorConfig config = new ExchangeMonitorConfig(
                ExchangeName.Binance,
                ExchangeName.Cryptopia,
                ExchangeName.Kucoin,
                ExchangeName.GDax);

            config.AddCoinMap(
                new[] { "TetherUS", "USDT", "Tether" },
                new[] { "TenX", "TenXPay" });

            config.BlacklistCoins("TetherUS", "Bitcoin Cash");

            monitor = new ExchangeMonitor(config);

            AddMonitor("Monero");
            AddMonitor("OmiseGO");
        }
Example #14
0
        public GoogleSheetPriceMonitor()
        {
            ExchangeMonitorConfig config = new ExchangeMonitorConfig(
                ExchangeName.Binance,
                ExchangeName.Cryptopia,
                ExchangeName.Kucoin,
                ExchangeName.AEX,
                ExchangeName.GDax,
                ExchangeName.Idex);

            exchangeMonitor = new ExchangeMonitor(config);

            sheet        = new GoogleSheet("1RoFMncCxV4ExqFQCRKSOmo-7WBSGc7F-9HjLc-5OT2c");
            refreshTimer = new Timer()
            {
                AutoReset = false,
                Interval  = TimeSpan.FromSeconds(10).TotalMilliseconds
            };
            refreshTimer.Elapsed += RefreshTimer_Elapsed;
        }
Example #15
0
        public async Task OrderBook()
        {
            ExchangeMonitorConfig config = new ExchangeMonitorConfig(exchangeName);

            monitor = new ExchangeMonitor(config);
            Exchange exchange = monitor.FindExchange(exchangeName);

            OrderBook orderBook = await exchange.GetOrderBook(popularQuoteCoin, popularBaseCoin);

            Assert.IsTrue(orderBook.asks.Length > 0);
            Assert.IsTrue(orderBook.asks[0].price > 0);
            Assert.IsTrue(orderBook.asks[0].volume > 0);
            Assert.IsTrue(orderBook.bids.Length > 0);
            Assert.IsTrue(orderBook.bids[0].price > 0);
            Assert.IsTrue(orderBook.bids[0].volume > 0);

            Assert.IsTrue(orderBook.asks[0].price >= orderBook.bids[0].price);
            Assert.IsTrue(orderBook.asks[1].price >= orderBook.asks[0].price);
            Assert.IsTrue(orderBook.bids[0].price >= orderBook.bids[1].price);
        }
Example #16
0
        public void CryptopiaClosedBooks()
        {
            monitor = new ExchangeMonitor(
                new ExchangeMonitorConfig(exchangeName));
            Coin doge = Coin.FromName("Dogecoin");

            Assert.IsTrue(doge != null);

            Coin monero = Coin.FromName("Monero");

            Assert.IsTrue(monero != null);
            TradingPair pair = monero.Best(doge, true);

            Assert.IsTrue(pair == null || pair.isInactive);

            Coin omg = Coin.FromName("OmiseGo");

            Assert.IsTrue(omg != null);
            TradingPair omgPair = omg.Best(doge, true);

            Assert.IsTrue(omgPair == null || omgPair.isInactive);
        }
 private void AddAalarm(ExchangeMonitor.Engine.ViewModel.Data data)
 {
     if (InvokeRequired)
     {
         this.Invoke(new Action<ExchangeMonitor.Engine.ViewModel.Data>(AddAalarm), new object[] { data });
         return;
     }
     try
     {
         var color = Color.LightGray;
         var result = new StringBuilder();
         result.Append("[").Append(DateTime.Now.ToString()).Append("] ").Append(data.Ticker).Append(Environment.NewLine);
         if (data.BollingerUpper < data.Rate)
         {
             result.Append("Went over Bollinger.").Append(Environment.NewLine);
             PlaySound();
             color = Color.LightGreen;
         }
         else if (data.BollingerLower > data.Rate)
         {
             result.Append("Went under Bollinger.").Append(Environment.NewLine);
             PlaySound();
             color = Color.LightPink;
         }
         else
         {
             result.Append("Restored within Bollinger").Append(Environment.NewLine);
         }
         result.Append("Rate: ").Append(data.Rate.ToString()).Append(Environment.NewLine);
         result.Append("Bol. Upper: ").Append(data.BollingerUpper.ToString()).Append(Environment.NewLine);
         result.Append("Bol. Lower: ").Append(data.BollingerLower.ToString());
         AddAalarm(result.ToString(), color);
     }
     catch
     {
         return;
     }
 }
Example #18
0
 /// <summary>
 /// No stated throttle limit, going with the same as Crytpopia
 /// </summary>
 public KucoinExchange(
     ExchangeMonitor exchangeMonitor)
     : base(exchangeMonitor, ExchangeName.Kucoin, 1_000_000 / 1_440, "https://api.kucoin.com")
Example #19
0
 /// <summary>
 /// Every 60 seconds the number of calls can not be more than 120 times.
 /// </summary>
 public AEXExchange(
     ExchangeMonitor exchangeMonitor)
     : base(exchangeMonitor, ExchangeName.AEX, 120, "https://api.aex.com")
 {
     client = new RestClient("https://www.aex.com");
 }
Example #20
0
 /// <summary>
 /// No stated throttle limit, going with the same as Crytpopia
 /// </summary>
 public IdexExchange(
     ExchangeMonitor exchangeMonitor)
     : base(exchangeMonitor, ExchangeName.Idex, 1_000_000 / 1_440,
Example #21
0
 public GDaxExchange(
     ExchangeMonitor exchangeMonitor)
     : base(exchangeMonitor, ExchangeName.GDax, 3 * 60, "https://api.gdax.com")
 {
     exchangeMonitor.AddAlias("Ether", "Ethereum");
 }
        private void AddDataToGrid(ExchangeMonitor.Engine.ViewModel.Data data)
        {
            try
            {
                if (InvokeRequired)
                {
                    this.Invoke(new Action<ExchangeMonitor.Engine.ViewModel.Data>(AddDataToGrid), new object[] { data });
                    return;
                }

                int rowIndex = GetIndexForTicker(data.Ticker);
                if (rowIndex != -1) SetRowValues(rowIndex, data);
                else SetRowValues(DataGrid.Rows.Add(), data);

                DataGrid.Refresh();

            }
            catch (Exception)
            {
                return;
            }
        }
 public void Cleanup()
 {
     monitor.Stop();
     monitor = null;
 }
 private void SetRowValues(int index, ExchangeMonitor.Engine.ViewModel.Data data)
 {
     DataGrid.Rows[index].Cells[0].Value = DateTime.Now.ToString();
     DataGrid.Rows[index].Cells[1].Value = data.Ticker;
     DataGrid.Rows[index].Cells[2].Value = data.Name;
     DataGrid.Rows[index].Cells[3].Value = data.Rate.ToString();
     DataGrid.Rows[index].Cells[4].Value = data.BollingerUpper.ToString();
     DataGrid.Rows[index].Cells[5].Value = data.BollingerLower.ToString();
 }