def mercados(exch='allcoin', moedas=['ETH', 'LTC', 'BTG']): if not exch: exch = ccxt.allcoin() if exch == 'allcoin': exch = ccxt.allcoin() else: exch = ccxt.allcoin() markets = exch.load_markets() market_pairs = list(markets.keys()) aux = [] for pair in market_pairs: if (str(moedas[0]) in pair or str(moedas[1]) in pair or str(moedas[2]) in pair) and 'BTC' in pair: aux.append(pair) return (aux)
def get_allcoin_captura(self): allcoin = ccxt.allcoin() ohclv = allcoin.fetch_ohlcv(symbol=self.symbol, timeframe=self.time_frame, since=self.time1) ohclv = np.array(ohclv) mercado = self.symbol l_timestamp = list(ohclv[:, 0] / 1000) l_date = [] l_open = list(ohclv[:, 1]) l_high = list(ohclv[:, 2]) l_close = list(ohclv[:, 3]) l_low = list(ohclv[:, 4]) l_volume = list(ohclv[:, 5]) for i in range(len(ohclv)): timestamp = l_timestamp[i] t = datetime.datetime.fromtimestamp(timestamp) #lista_date.append(str(t.year)+'-'+str(t.month)+'-'+str(t.day)) l_date.append(t) #l_timestamp.append(ohclv[i][0]/1000) #l_close.append(ohclv[i][2]) struct_df = { "datetime": l_date, "timestamp": l_timestamp, "close": l_close, "high": l_high, "low": l_low, "open": l_open, "volume": l_volume, } allcoin = pd.DataFrame(struct_df) return (allcoin)
def ccxt_get_allcoin(time_frame = "1d"): #### Pega dados allcoin #### allcoin = ccxt.allcoin() ohclv = allcoin.fetch_ohlcv(symbol="LTC/BTC",timeframe=time_frame,since=time1) ohclv = np.array(ohclv) mercado = 'ltc/btc' l_timestamp = list(ohclv[:,0]/1000) l_date = [] l_open = list(ohclv[:,1]) l_high = list(ohclv[:,2]) l_close = list(ohclv[:,3]) l_low = list(ohclv[:,4]) l_volume = list(ohclv[:,5]) for i in range(len(ohclv)): timestamp = l_timestamp[i] t = datetime.datetime.fromtimestamp(timestamp) #lista_date.append(str(t.year)+'-'+str(t.month)+'-'+str(t.day)) l_date.append(t) #l_timestamp.append(ohclv[i][0]/1000) #l_close.append(ohclv[i][2]) struct_df = { "datetime": l_date, "timestamp":l_timestamp, "close":l_close, "high":l_high, "low":l_low, "open":l_open, "volume":l_volume, } allcoin_btc_ltc = pd.DataFrame(struct_df) return(allcoin_btc_ltc)
import numpy as np import ccxt #exchanges = ["Mercado", "Binance", "Bitfinex", "Bittrex", "Cex", "Cryptopia", "Exmo", "Gatecoin", "Hitbtc", #"Huobipro", "Kraken", "Kucoin", "Livecoin", "Okex", "Poloniex", "Qryptos", "Quadrigacx", "Southxchange", "Yobit"] exchanges = [ "Cex", "Poloniex", "Qryptos", "mercado", "foxbit", "negociecoins", "bleutrade", "braziliex" ] allcoin = ccxt.allcoin() clients = [getattr(ccxt, e.lower())() for e in exchanges] symbols = [ "ADA/BTC", "BCH/BTC", "BTG/BTC", "BTS/BTC", "CLAIM/BTC", "DASH/BTC", "DOGE/BTC", "EDO/BTC", "EOS/BTC", "ETC/BTC", "ETH/BTC", "FCT/BTC", "ICX/BTC", "IOTA/BTC", "LSK/BTC", "LTC/BTC", "MAID/BTC", "NEO/BTC", "OMG/BTC", "QTUM/BTC", "STR/BTC", "TRX/BTC", "VEN/BTC", "XEM/BTC", "XLM/BTC", "XMR/BTC", "XRP/BTC", "ZEC/BTC" ] ask = np.zeros((len(symbols), len(clients))) bid = np.zeros((len(symbols), len(clients))) for row, symbol in enumerate(symbols): for col, client in enumerate(clients): try: book = client.fetch_order_book(symbol)
import ccxt exchanges = [ ccxt._1broker(), ccxt._1btcxe(), ccxt.acx(), ccxt.allcoin(), ccxt.anxpro(), ccxt.bibox(), ccxt.binance(), ccxt.bit2c(), ccxt.bitbank(), ccxt.bitbay(), ccxt.bitfinex(), ccxt.bitfinex2(), ccxt.bitflyer(), ccxt.bithumb(), ccxt.bitkk(), ccxt.bitlish(), ccxt.bitmarket(), ccxt.bitmex(), ccxt.bitso(), ccxt.bitstamp(), ccxt.bitstamp1(), ccxt.bittrex(), ccxt.bitz(), ccxt.bl3p(), ccxt.bleutrade(), ccxt.braziliex(), ccxt.btcbox(), ccxt.btcchina(),
import ccxt import datetime import time # OK! speed bitkk ——》bitforex-》 huobiru ->coinex exchange = ccxt.allcoin({ 'proxies': { 'http': 'http://144.202.27.74:8888', # no auth 'https': 'https://144.202.27.74:8888', # no auth } }) data = exchange.fetch_ticker('BTC/USDT') print(data) # exchange = ccxt.coinex() # timeStart1 = datetime.datetime.now() # data = exchange.fetch_ticker('BTC/USDT') # timeEnd1 = datetime.datetime.now() # print(data) # print("iso t: %s" % timeStart1.isoformat()) # print(timeEnd1-timeStart1) # exchange = ccxt.huobiru() # print("exchange:",exchange["url"]) # timeStart1 = datetime.datetime.now() # data = exchange.fetch_ticker('EOS/USDT') # timeEnd1 = datetime.datetime.now() # print(data)