コード例 #1
0
        private static void PopulateExchanges(string securityJsonFilename)
        {
            m_security = new ApiSecurity(securityJsonFilename);
            foreach (var exch in m_security.ApiKeys.Keys)
            {
                var c = m_security.ApiKeys[exch];
                //Console.WriteLine("{0} '{1}' '{2}'", exch, c.ApiKey, c.ApiSecret);
            }

            ApiCredentials creds;

            /*creds = m_security.ApiKeys["B2C2"];                             // BINANCE
             * b2c2 = B2C2.Create(creds);
             * Exchanges[CryptoExch.B2C2] = b2c2;*/

            creds   = m_security.ApiKeys["BINANCE"];                        // BINANCE
            binance = Binance.Create(creds);
            Exchanges[CryptoExch.BINANCE] = binance;

            creds    = m_security.ApiKeys["BITFINEX"];                      // BITFINEX
            bitfinex = Bitfinex.Create(creds);
            Exchanges[CryptoExch.BITFINEX] = bitfinex;

            creds    = m_security.ApiKeys["BITFLYER"];                      // BITFLYER
            bitflyer = BitFlyer.Create(creds);
            Exchanges[CryptoExch.BITFLYER] = bitflyer;

            creds    = m_security.ApiKeys["BITSTAMP"];                      // BITSTAMP
            bitstamp = Bitstamp.Create(creds, "client_id");
            Exchanges[CryptoExch.BITSTAMP] = bitstamp;

            creds   = m_security.ApiKeys["BITTREX"];                        // BITTREX
            bittrex = Bittrex.Create(creds);
            Exchanges[CryptoExch.BITTREX] = bittrex;

            creds = m_security.ApiKeys["GDAX"];                             // GDAX
            gdax  = GDAX.Create(creds, "mickey+mouse");
            Exchanges[CryptoExch.GDAX] = gdax;

            creds  = m_security.ApiKeys["HITBTC"];                          // HITBTC
            hitbtc = HitBTC.Create(creds);
            Exchanges[CryptoExch.HITBTC] = hitbtc;

            creds = m_security.ApiKeys["ITBIT"];                            // ITBIT
            itbit = ItBit.Create(creds);
            Exchanges[CryptoExch.ITBIT] = itbit;

            creds  = m_security.ApiKeys["KRAKEN"];                          // KRAKEN
            kraken = Kraken.Create(creds);
            Exchanges[CryptoExch.KRAKEN] = kraken;

            creds    = m_security.ApiKeys["POLONIEX"];                      // POLONIEX
            poloniex = Poloniex.Create(creds);
            Exchanges[CryptoExch.POLONIEX] = poloniex;

            /*creds = m_security.ApiKeys["BLEUTRADE"];                        // BLEUTRADE
             * bleutrade = Bleutrade.Create(creds);
             * Exchanges[CryptoExch.BLEUTRADE] = bleutrade;
             *
             * creds = m_security.ApiKeys["BLINKTRADE"];                       // BLINKTRADE
             * blinktrade = BlinkTrade.Create(creds);
             * Exchanges[CryptoExch.BLINKTRADE] = blinktrade;*/

            gemini = Gemini.Instance;
            Exchanges[CryptoExch.GEMINI] = Gemini.Instance;

            // For each exchange, subscribe to the various events
            foreach (var exchange in Exchanges.Values)
            {
                exchange.UpdateOrderBookEvent += Exchanges_UpdateOrderBookEvent;
                exchange.UpdateOrdersEvent    += Exchanges_UpdateOrdersEvent;
                exchange.UpdateTickerEvent    += Exchanges_UpdateTickerEvent;

                /*var ws = exchange as IExchangeWebSocket;
                 * if (ws != null)
                 *  ws.StartWebSocket(null);*/
            }

            /*Exchanges[CryptoExch.VAULTORO] = Vaultoro.Instance;
             * Exchanges[CryptoExch.CHANGELLY] = Changelly.Instance;
             * Exchanges[CryptoExch.BITHUMB] = Bithumb.Instance;
             * Exchanges[CryptoExch.BITMEX] = BitMEX.Instance;
             * Exchanges[CryptoExch.BITSQUARE] = Bitsquare.Instance;
             * Exchanges[CryptoExch.BTCC] = BTCC.Instance;
             * //Exchanges[CryptoExch.BTER] = BTER.Instance;
             * Exchanges[CryptoExch.CEX] = Cex.Instance;
             * //Exchanges[CryptoExch.COINIGY] = Coinigy.Instance;
             * Exchanges[CryptoExch.COINONE] = Coinone.Instance;
             * Exchanges[CryptoExch.GATEIO] = GateIO.Instance;
             * Exchanges[CryptoExch.HUOBI] = Huobi.Instance;
             * Exchanges[CryptoExch.KORBIT] = Korbit.Instance;
             * Exchanges[CryptoExch.KUCOIN] = Kucoin.Instance;
             * Exchanges[CryptoExch.OKCOIN] = OkCoin.Instance;
             * Exchanges[CryptoExch.OKEX] = OKEx.Instance;
             * Exchanges[CryptoExch.WEX] = Wex.Instance;
             * Exchanges[CryptoExch.XCRYPTO] = XCrypto.Instance;*/
        }