コード例 #1
0
        public static CurrencyPair Map(Poloniex poloniex)
        {
            var names = poloniex.CurrencyPair.Trim().Split('_');

            return(new CurrencyPair
            {
                BaseVolume = double.Parse(poloniex.BaseVolume, CultureInfo.InvariantCulture),
                CurrencyPairName = poloniex.CurrencyPair,
                High = double.Parse(poloniex.High24Hr, CultureInfo.InvariantCulture),
                Last = double.Parse(poloniex.Last, CultureInfo.InvariantCulture),
                Low = double.Parse(poloniex.Low24Hr, CultureInfo.InvariantCulture),
                Volume = double.Parse(poloniex.QuoteVolume, CultureInfo.InvariantCulture),
                PercentChange = double.Parse(poloniex.PercentChange, CultureInfo.InvariantCulture),
                FirstCurrency = names[0],
                SecondCurrency = names[1]
            });
        }
コード例 #2
0
 public PoloniexTradeMACD(Poloniex exch, string pair, IMessenger messenger)
 {
     m_exch = exch;
     m_pair = pair;
     m_msg  = messenger;
 }
コード例 #3
0
        public async Task <ITickers> GetTicker([FromBody] CompositeStockExchangeObject compositeStockExchangeObject)
        {
            decimal exchangeRate = compositeStockExchangeObject.ExchangeRate;

            Common.StockExchange.Types.StockExchange selectedStockExchange = compositeStockExchangeObject.StockExchange;
            string selectedPairs = compositeStockExchangeObject.SelectedPairs;

            IStockExchanges stockExchanges;

            switch (selectedStockExchange)
            {
            case Common.StockExchange.Types.StockExchange.Binance:
                stockExchanges = new Binance();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Bitfinex:
                stockExchanges = new Bitfinex();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Bitmex:
                stockExchanges = new Bitmex();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Bitstamp:
                stockExchanges = new Bitstamp();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Bittrex:
                stockExchanges = new Bittrex();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Cex:
                stockExchanges = new Cex();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Exmo:
                stockExchanges = new Exmo();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Gdax:
                stockExchanges = new Gdax();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Gemini:
                stockExchanges = new Gemini();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Kraken:
                stockExchanges = new Kraken();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Poloniex:
                stockExchanges = new Poloniex();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.QuadrigaCx:
                stockExchanges = new QuadrigaCx();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            default:
                throw new NullStockExchangeException("Invalid StockExchange Selection");
            }
        }
コード例 #4
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;*/
        }