예제 #1
0
    def get_candles_daily(self, market, exchange):
        client = self.clients[exchange]

        if exchange == exc.CRYPTOPIA:
            d = self.market_id_map(exchange)
            pairid = d[market]
            candles, v = client.candle_request(pairid)
            return models.conv_candle([candles, v], exchange)

        elif exchange == exc.BITTREX:
            market = models.conv_markets_to(market, exchange)
            #hack second client for candles
            r = self.clients[rex_API_v2].get_candles(market, "day")
            r = r['result']
            candles = models.conv_candle(r, exchange)
            return candles

        elif exchange == exc.KUCOIN:
            market = models.conv_markets_to(market, exchange)
            klines = client.get_historical_klines_tv(market,
                                                     client.RESOLUTION_1DAY,
                                                     '1 month ago UTC')
            return models.conv_candle(klines, exchange)

        elif exchange == exc.HITBTC:
            market = models.conv_markets_to(market, exchange)
            candles = client.get_candles_daily(market)
            candles = models.conv_candle(candles, exchange)
            return candles

        elif exchange == exc.BINANCE:
            market = models.conv_markets_to(market, exchange)
            klines = client.get_candles_daily(market)
            return models.conv_candle(klines, exchange)
예제 #2
0
    def get_candles_hourly(self, market, exchange):
        client = self.clients[exchange]

        if exchange == exc.CRYPTOPIA:
            pass            
        elif exchange==exc.BITTREX:   
            market = models.conv_markets_to(market, exchange)
            r = self.clients[rex_API_v2].get_candles(market,"hour")
            r = r['result']
            candles = models.conv_candle(r, exchange)
            return candles
        elif exchange==exc.KUCOIN:
            market = models.conv_markets_to(market, exchange)
            klines = client.get_historical_klines_tv(market, client.RESOLUTION_1HOUR, '1 week ago UTC')    
            return models.conv_candle(klines,exchange)

        elif exchange==exc.BINANCE:
            market = models.conv_markets_to(market, exchange)
            klines = client.get_candles_hourly(market)    
            return models.conv_candle(klines,exchange)
예제 #3
0
    def get_candles_minute(self, market, exchange):
        client = self.clients[exchange]
        market = models.conv_markets_to(market, exchange)
        self.logger.debug("get_candles_minute %s %s"%(market, exchange))

        if exchange == exc.CRYPTOPIA:
            pass            

        elif exchange==exc.BITTREX:            
            r = self.clients[rex_API_v2].get_candles(market,"oneMin")
            r = r['result']
            candles = models.conv_candle(r, exchange)
            return candles

        elif exchange==exc.KUCOIN:
            klines = client.get_historical_klines_tv(market, client.RESOLUTION_1MINUTE, '1 day ago UTC')
            return models.conv_candle(klines,exchange)

        elif exchange==exc.BINANCE:
            klines = client.get_candles_minute(market)  
            candles = models.conv_candle(klines,exchange)  
            return candles
예제 #4
0
    def get_candles_minute15(self, market, exchange):
        client = self.clients[exchange]
        market = models.conv_markets_to(market, exchange)
        self.logger.debug("get_candles_minute15 %s %s" % (market, exchange))

        if exchange == exc.CRYPTOPIA:
            pass

        elif exchange == exc.BITTREX:
            pass

        elif exchange == exc.KUCOIN:
            pass

        elif exchange == exc.BINANCE:
            klines = client.get_candles_minute15(market)
            candles = models.conv_candle(klines, exchange)
            return candles