def __init__(self, enable_limit=False, usd_limit=5, reverse=False, depth=100, symbol="BTC/USDT", enable_recursion=False): self.usd_limit = usd_limit self.enable_limit = enable_limit self.reverse = reverse self.depth = depth self.symbol = symbol self.inOrder = False self.enable_recursion = enable_recursion if (reverse): self.A = ccxt.kraken({ 'enableRateLimit': True # this option enables the built-in rate limiter (no ip ban) }) self.B = ccxt.binance({ 'enableRateLimit': True # this option enables the built-in rate limiter (no ip ban) }) else: self.A = ccxt.binance({ 'enableRateLimit': True # this option enables the built-in rate limiter (no ip ban) }) self.B = ccxt.kraken({ 'enableRateLimit': True # this option enables the built-in rate limiter (no ip ban) })
def CreateExchanges(self): # Création des exchanges exchanges = [] # Add the desired exchanges here, for instance kraken and poloniex: kraken = ccxt.kraken({ #'apiKey' : 'your key here', #'secret':'your secret here' }) exchanges.append(kraken) poloniex = ccxt.poloniex({ #'apiKey' : 'your key here', #'secret':'your secret here' }) exchanges.append(poloniex) self.loadMarkets(exchanges) # Assign default precision to avoid error on gdax for exchange in exchanges: for symbol in exchange.symbols: if 'amount' not in exchange.markets[symbol]['precision']: exchange.markets[symbol]['precision']['amount'] = 8 return exchanges
def __init__(self): #try except #Initiate exchange data with objects for each exchange binance = ccxt.binance() bittrex = ccxt.bittrex() bitfinex = ccxt.bitfinex() kraken = ccxt.kraken() kucoin = ccxt.kucoin() #Dictionary with the ccxt objects self.exchanges = { 'binance': binance, 'bittrex': bittrex, 'bitfinex': bitfinex, 'kraken': kraken, 'kucoin': kucoin } #Get a list of tickers from Binance exchange to use throughout self.ticker_list = [] self.get_tickers_list() #CREATE A DATAFRAME FOR THE PRICE AND VOLUME DATA self.volume = pd.DataFrame(index=self.ticker_list, columns=list(self.exchanges.keys())) self.pricedf = pd.DataFrame(index=self.ticker_list, columns=list(self.exchanges.keys())) self.spread = pd.DataFrame(index=self.ticker_list, columns=list(self.exchanges.keys()))
def getKrakenPrices(type): print() print("### KraKen ###") kraken = ccxt.kraken() #kraken_markets = kraken.load_markets() #load markets on kraken #kraken_symbols = kraken.symbols #kraken_currencies = kraken.currencies global kraken_tickers for c in coinsSet: try: kraken_tickers = kraken.fetch_ticker( c + "/" + intCurrency ) #extract die ticker prys in plaas van die orderbooks. Sodat konstant oor exchanges is. ook minder API counter hits if kraken_tickers == None: while kraken_tickers == None: pass time.sleep(20) kraken_tickers = kraken.fetch_ticker( c + "/" + intCurrency ) #extract die ticker prys in plaas van die orderbooks. Sodat konstant oor exchanges is. ook minder API counter hits #kraken_bid = EURZAR*(kraken_orderbook['bids'][0][0] if len (kraken_orderbook['bids']) > 0 else None) kraken_ask = EURZAR * (kraken_tickers[type]) ex1Prices[c] = (kraken_ask) print("Unit: " + c + " ; Prices: " + str(ex1Prices[c])) time.sleep(delay) #extraction is unstable, have to implement delay except: print("Timeout exception. Waiting....") time.sleep(20)
def get_kraken_trades(): global since global ipair # pairs ?? same as for order depth? pairs = ['ADA/USD', 'DAI/USD', 'DASH/USD', 'ETH/USD', 'LTC/USD', 'XTZ/USD', 'BTC/USD', 'EOS/USD', 'XRP/USD', 'USDT/USD'] try: if ipair>=len(pairs): ipair=0 pair = pairs[ipair] kraken = ccxt.kraken() default_since = 24*60*60*1000 * 10 # ten days history data = kraken.fetch_trades(symbol=pair, since=since.get(pair, default_since)) if len(data) > 2: since[pair] = data[-2]['timestamp'] save_tickerdata2(data=data, collection_name=f'kraken_trades_{pair}') ipair+=1 except BaseException as e: raise BaseException( f"{e} kraken_trades")
def getPrice(symbol='BTC/USD', exchange=None): if Config.isTesting(): return '100.00 (T)' if exchange is None: exchange = ccxt.kraken() # if the symbol hasn't been used before: if Config.price.get(symbol) is None: Config.price[symbol] = {'price': 'N/A', 'time': 0} price = Config.price.get(symbol) current_epoch = datetime.now().timestamp() diff = price.get('last_update', 0) + Config.DEFAULT_TIMECACHE if diff <= current_epoch: logging.debug('getPrice() :: fetching new price from exchange') new_price = exchange.fetch_ticker(symbol).get('bid', 'N/A') Config.price[symbol] = { 'price': new_price, 'last_update': current_epoch } else: logging.debug('getPrice() :: cached copy used') return Config.price.get(symbol).get('price')
def _createExchangeObject(self, exchange): ''' Depricated ... now instantiating class using "eval" in __init__''' if exchange == "Binance": exchange = ccxt.binance() elif exchange == "Bitfinex": exchange = ccxt.bitfinex2() elif exchange == "Bitmex": exchange = ccxt.bitmex() elif exchange == "BitStamp": exchange = ccxt.binance() elif exchange == "Bittrex": exchange = ccxt.binance() elif exchange == "Bithumb": exchange = ccxt.bithumb() elif exchange == "CCTX": exchange = ccxt.cctx() elif exchange == "GDAX": exchange = ccxt.gdax() elif exchange == "HitBC": exchange = ccxt.hitbc() elif exchange == "Huobipro": exchange = ccxt.huobipro() elif exchange == "Kraken": exchange = ccxt.kraken() elif exchange == "OKEx": exchange = ccxt.okex() else: raise "Exception ExchangeCCXT::_createExchangeObject - ccxt Exchange not valid" return exchange
def __init__(self, exchange="kraken", ticker="XLM/USD", cash=1000, loss_percent=0.99999, gain_percent=1.00005): ''' Constructor for our Account class. Initialize some variables ''' if (exchange is "kraken"): self.exchange = ccxt.kraken() self.starting_cash = cash self.current_cash = cash self.loss_percent = loss_percent self.gain_percent = gain_percent self.ticker = ticker self.current_shares = 0 # shares # get current price self.current_price = self.get_price() # calculate sell for loss price sell_for_loss_price = self.current_price * self.loss_percent # calculate sell for gain price sell_for_gain_price = self.current_price * self.gain_percent self.portfolio_value = [] # our portfolio's value # calculate our buy target self.buy_target = self.get_buy_target() return
def Account_Balance(exchange): factory = getattr(ccxt, exchange)() factory.apiKey = getattr(keychain, exchange).Christian('API') factory.secret = getattr(keychain, exchange).Christian('Secret') balances = factory.fetch_total_balance() usd_Balance = 0 usdt_usd = ccxt.kraken().fetch_ticker('USDT/USD')['last'] try: btc_usd = ccxt.bitmex().fetch_ticker('BTC/USD')['last'] except: btc_usd = ccxt.coinbase().fetch_ticker('BTC/USD')['last'] print(btc_usd) for currency in balances: if balances[currency] != 0: time.sleep(0.1) if currency == 'BTC': balance = balances[currency] * btc_usd elif currency == 'USDT': balance = balances[currency] * usdt_usd else: try: btc_pair = factory.fetch_ticker(f'{currency}/BTC')['last'] balance = balances[currency] * btc_pair * btc_usd except Exception as e: print(e) print(currency, balance) usd_Balance = usd_Balance + balance return [usd_Balance, btc_usd]
def main(): # 1- Load exchange. exchange = ccxt.kraken() market = exchange.load_markets() # 2- Find possible tri-pairs (trairs) within the exchange. trair = find_trairs(exchange) #print (trair) # Define the coin of interest for each trair. # The coin of interest is the coin we want to profit on with the trade. # define_coins_of_insterest, set one coin of interest for each trair. interesting_coins = ['BTC', 'EUR', 'ETH'] coins_of_interest = define_coins_of_interest(exchange, trair, interesting_coins) #print(coins_of_interest) trair = sort_pairs(trair, coins_of_interest) #print (trair) # 3. Seek for unbalances in the trairs. try: while True: for t in range(len(trair)): unbalance = find_unbalance(exchange, trair[t], coins_of_interest[t]) time.sleep(DELAY) except KeyboardInterrupt: pass # 4. Trade profitable unbalances. input('End of the application, press enter to finish')
async def get_kraken(ticker = "BTC/USD"): data = {} load_dotenv() kraken_public_key = os.getenv("KRAKEN_PUBLIC_KEY") kraken_secret_key = os.getenv("KRAKEN_SECRET_KEY") kraken = ccxt.kraken({"apiKey": kraken_public_key, "secret": kraken_secret_key}) data = kraken.fetch_ticker(ticker) return data
def create_exchanges(): """ instantiate the markets to include more exchanges use this function. new exchanges need to be hand-coded here """ coinbasepro = ccxt.coinbasepro({ 'apiKey': api_keys.coinbasepro['apiKey'], 'secret': api_keys.coinbasepro['secret'], }) poloniex = ccxt.poloniex({ 'apiKey': api_keys.poloniex['apiKey'], 'secret': api_keys.poloniex['secret'], }) bittrex = ccxt.bittrex({ 'apiKey': api_keys.bittrex['apiKey'], 'secret': api_keys.bittrex['secret'], }) binance = ccxt.binance({ 'apiKey': api_keys.binance['apiKey'], 'secret': api_keys.binance['secret'], }) bitfinex = ccxt.bitfinex({ 'apiKey': api_keys.bitfinex['apiKey'], 'secret': api_keys.bitfinex['secret'], }) kraken = ccxt.kraken({ 'apiKey': api_keys.kraken['apiKey'], 'secret': api_keys.kraken['secret'], }) bitmex = ccxt.bitmex({ 'apiKey': api_keys.bitmex['apiKey'], 'secret': api_keys.bitmex['secret'], }) okex = ccxt.okex({ 'apiKey': api_keys.okex['apiKey'], 'secret': api_keys.okex['secret'], }) exchanges = [ coinbasepro, poloniex, bittrex, binance, bitfinex, kraken, bitmex, okex ] timing_limits = [.35, .35, 1, .35, 2, 1, 1, .35] # requesting period limit per exchange for exchange, timing in zip(exchanges, timing_limits): g_storage.timer[exchange.name] = [0, timing] # exchanges.pop(exchanges.index(kraken)) return exchanges
def load_exchange(): try: exchange = ccxt.kraken() market = exchange.load_markets() except ccxt.RequestTimeout: time.sleep(DELAY) exchange, market = load_exchange() return exchange, market
def fetch_historical_data(crypto=SYMBOL, interval='1m', limit=720): kraken = ccxt.kraken() interval_in_min = {'1m':1,'5m':5, '30m':30, '1h':60, '1d':1440, '1w':10080} no_of_data = limit * interval_in_min[interval] print(no_of_data) past_datetime = (datetime.datetime.now() + datetime.timedelta(minutes=240-no_of_data)).strftime('%Y-%m-%d %H:%M:%S') data = kraken.fetch_ohlcv(crypto, interval, kraken.parse8601(past_datetime)) time.sleep(1) return get_dataframe(data)
def test(): kraken = ccxt.kraken({ 'apiKey': kraken_key, 'secret': kraken_secret, 'verbose': False, # switch it to False if you don't want the HTTP log }) print(kraken.fetch_balance()) print(kraken.fetch_my_trades()) print(dir(kraken))
def __init__(self, api_keys, logfile=False): self.api_keys = { 'api_key': api_keys['kraken_keys']['api_key'], 'secret_key': api_keys['kraken_keys']['secret_key'] } self.exchange = ccxt.kraken({ 'apiKey': self.api_keys['api_key'], 'secret': self.api_keys['secret_key'] }) self.logfile = logfile
def Collect_Gain_Report(): print("started billing") from account.models import Trading_Platform, MyUser import ccxt # noqa: E402 for user in MyUser.objects.all(): context = {} for exchange in ['Quadrigacx', 'Quoine', 'Kraken', 'Bitfinex']: try: api_credentials = Trading_Platform.objects.get( user=user, trading_platform=exchange) except: api_credentials = 404 if exchange == "Quadrigacx" and api_credentials != 404: context['Quadrigacx_data'] = ccxt.quadrigacx({ "uid": str(api_credentials.client_id), "apiKey": api_credentials.api_key, "secret": api_credentials.secret }) context['Quadrigacx_transactions'], context[ 'Quadrigacx_data'] = context[ 'Quadrigacx_data'].privatePostUserTransactions(), dir( context['Quadrigacx_data']) elif exchange == "Quoine" and api_credentials != 404: context['Quoinex_data'] = ccxt.quoinex({ "apiKey": api_credentials.api_key, "secret": api_credentials.secret }) context['Quoinex_transactions'], context[ 'Quoinex_data'] = context['Quoinex_data'].privateGetTrades( ), dir(context['Quoinex_data']) elif exchange == "Kraken" and api_credentials != 404: context['Kraken_data'] = ccxt.kraken({ "apiKey": api_credentials.api_key, "secret": api_credentials.secret }) context['Kraken_transactions'] = context[ 'Kraken_data'].privatePostTradesHistory() elif exchange == "Bitfinex" and api_credentials != 404: context['Bitfinex_data'] = ccxt.bitfinex({ "apiKey": api_credentials.api_key, "secret": api_credentials.secret }) context['Bitfinex_transactions'] = context[ 'Bitfinex_data'].privatePostMytrades() print(context)
def __init__(self): self.ex = ccxt.kraken({ # 'verbose': True, 'apiKey': s.exchange_api_key, 'secret': s.exchange_sk, 'timeout': 20000, # 'session': cfscrape.create_scraper(), # To avoid Cloudflare block => still fails with 520 Origin Error 'enableRateLimit': True, 'rateLimit': 1000 # Rate Limit set to 1 sec to avoid issues }) self.ex.load_markets()
def main(): exchange = ccxt.kraken() market = exchange.load_markets() trair = find_trairs(exchange) print(trair) #print (exchange.fetch_order_book('BTC/EUR')) #print (exchange.symbols) ask = [] bid = []
def init_supported_exchanges(): objects = { "binance": ccxt.binance(), "bitfinex": ccxt.bitfinex(), "bitflyer": ccxt.bitflyer(), "bitstamp": ccxt.bitstamp(), "bittrex": ccxt.bittrex(), "coinbase": ccxt.coinbase(), "kraken": ccxt.kraken(), "poloniex": ccxt.poloniex() } return objects
class BtcRateTicker: bitmex = ccxt.bitmex() coinbase = ccxt.coinbase() kraken = ccxt.kraken() async def get_btc_usd_rates(self): symb = 'BTC/USD' bitmex_rates = self.bitmex.fetch_ticker(symb)['average'] coinbase_rates = self.coinbase.fetch_ticker( symb)['info']['spot']['data']['amount'] kraken_rates = self.kraken.fetch_ticker(symb)['ask'] return bitmex_rates, coinbase_rates, kraken_rates
def __init__(self, channels=[]): self.channels = channels self.check_tradepair() # Disabbling logging. logger = logging.getLogger() logger.disabled = True self.kraken = ccxt.kraken() self.kraken.load_products() self.pub = Publisher(channels)
def fetch_data(): """Fetches the latest prices.""" print("Fetching data...") load_dotenv() kraken_public_key = os.getenv("KRAKEN_PUBLIC_KEY") kraken_secret_key = os.getenv("KRAKEN_SECRET_KEY") kraken = ccxt.kraken({"apiKey": kraken_public_key, "secret": kraken_secret_key}) close = kraken.fetch_ticker("BTC/USD")["close"] datetime = kraken.fetch_ticker("BTC/USD")["datetime"] df = pd.DataFrame({"close": [close]}) df.index = pd.to_datetime([datetime]) return df
def main(): exchange = ccxt.kraken() #timestamps are multiplied by 1000 to represent miliseconds last_time = int(time.time() - 60) * 1000 if exchange.hasFetchOHLCV: data = exchange.fetch_ohlcv("BTC/USD", '1m', since=last_time) for d in data: print_ohlcv(d) print(exchange.iso8601(exchange.milliseconds()))
def fetch_data(crypto=SYMBOL, max_window=MAX_WINDOW): """Fetches the latest prices.""" #db = sqlite3.connect("algo_trader_history.sqlite" ) kraken = ccxt.kraken({"apiKey": kraken_public_key, "secret": kraken_secret_key}) data = kraken.fetch_ticker(crypto) data = [[data['timestamp'], data["open"], data["high"] ,data["low"], data["close"], data["baseVolume"]]] df = get_dataframe(data) try: df.to_sql(HISTORY_TABLE, CONNECTION, if_exists="append", index=True) except sqlite3.IntegrityError: pass df = pd.read_sql(f"select * from {HISTORY_TABLE} ORDER BY date DESC limit {max_window}", CONNECTION, index_col='date', parse_dates='date') return df
def fiat_markets(): """ Retrieves all tickers from an exchange (Kraken for now) and returns only fiat markets """ kraken = ccxt.kraken() tickers = kraken.fetch_tickers() fiat_tickers = [] crypto_tickers = [] for x in tickers: if tickers[x]['symbol'].split('/')[1] in FIAT: fiat_tickers.append(tickers[x]) else: crypto_tickers.append(tickers[x]) # fiat_tickers = [tickers[x] for x in tickers for y in FIAT if y in tickers[x]['symbol']] # print(fiat_tickers) return fiat_tickers, crypto_tickers
def getMarketPrice(EXCHANGE, SYMBOL): if EXCHANGE == "poloniex": exchange = ccxt.poloniex() elif EXCHANGE == "bittrex": exchange = ccxt.bittrex() elif EXCHANGE == "kraken": exchange = ccxt.kraken() markets = exchange.load_markets() book = ccxt.poloniex().fetch_order_book(SYMBOL, {'depth': 10}) # print(book) bid = book['bids'][0][0] if len(book['bids']) > 0 else None ask = book['asks'][0][0] if len(book['asks']) > 0 else None spread = (ask - bid) if (bid and ask) else None print({'bid': bid, 'ask': ask, 'spread': spread}, exchange.id, 'market price') return spread
def get_exchange_symbols(): assets = Assets() slugs = get_coincap_slugs() exchanges = ['binance', 'bitfinex', 'bittrex', 'poloniex', 'kraken'] coins = {} # loop through exchanges, grab symbols for exchange_str in exchanges: if exchange_str == 'binance': exchange = ccxt.binance() elif exchange_str == 'bitfinex': exchange = ccxt.bitfinex() elif exchange_str == 'bittrex': exchange = ccxt.bittrex() elif exchange_str == 'poloniex': exchange = ccxt.poloniex() elif exchange_str == 'kraken': exchange = ccxt.kraken() else: exchange = None if exchange: exchange.load_markets() for sym in exchange.symbols: if '/BTC' in sym: sym = sym.replace('/BTC', '') if sym not in coins: coins[sym] = {'exchanges': [exchange_str]} else: coins[sym]['exchanges'].append(exchange_str) # handle felix and coincap assets for coin in coins: if coin in assets: coins[coin]['exchanges'].append('felix') if coin in slugs: coins[coin]['id'] = slugs[coin]['id'] coins[coin]['name'] = slugs[coin]['name'] else: coins[coin]['id'] = None coins[coin]['name'] = None sorted_coins = collections.OrderedDict(sorted(coins.items())) return sorted_coins
def initialize(self): for exchange_name in self.exchanges.keys(): if exchange_name == EXCHANGE_BITFINEX: self.exchanges[exchange_name]["client"] = ccxt.bitfinex2({ 'apiKey': self.exchanges[EXCHANGE_BITFINEX]["api_key"], 'secret': self.exchanges[EXCHANGE_BITFINEX]["api_secret"], 'enableRateLimit': True }) self.exchanges[exchange_name]["client_"] = ccxt.bitfinex({ 'apiKey': self.exchanges[EXCHANGE_BITFINEX]["api_key"], 'secret': self.exchanges[EXCHANGE_BITFINEX]["api_secret"], 'enableRateLimit': True }) elif exchange_name == EXCHANGE_BINANCE: self.exchanges[exchange_name]["client"] = ccxt.binance({ 'apiKey': self.exchanges[EXCHANGE_BINANCE]["api_key"], 'secret': self.exchanges[EXCHANGE_BINANCE]["api_secret"], 'enableRateLimit': True, 'options': { 'adjustForTimeDifference': True } }) elif exchange_name == EXCHANGE_KRAKEN: self.exchanges[exchange_name]["client"] = ccxt.kraken({ 'apiKey': self.exchanges[EXCHANGE_KRAKEN]["api_key"], 'secret': self.exchanges[EXCHANGE_KRAKEN]["api_secret"], 'enableRateLimit': True }) elif exchange_name == EXCHANGE_OANDA: self.exchanges[exchange_name]["client"] = oanda.oanda(self.exchanges[EXCHANGE_OANDA]["account_id"], \ self.exchanges[EXCHANGE_OANDA]["account_token"]) else: print("Please configure a valid Exchange.") sys.exit(1)
def test_get_common_symbols(): print("Testing get_common_symbols()...") a = ccxt.exmo() b = ccxt.hitbtc() c = ccxt.kraken() d = ccxt.binance() e = ccxt.huobi() f = "myMadeUpExchangeName" g = "binance" s0 = "BTC/USDT" s1 = "LTC/BTC" s3 = "Not real" assert get_common_symbols(a, b) is not None, "Should have some in common" assert s0 in get_common_symbols(a, b), s0 + " is in both of these." assert get_common_symbols(a, f) is None, "Made up exchange" assert len(get_common_symbols(a, b)) == 14, "Should have consistent length." print("Passed get_common_symbols() test...")
import asciichart # ----------------------------------------------------------------------------- this_folder = os.path.dirname(os.path.abspath(__file__)) root_folder = os.path.dirname(os.path.dirname(this_folder)) sys.path.append(root_folder + '/python') sys.path.append(this_folder) # ----------------------------------------------------------------------------- import ccxt # noqa: E402 # ----------------------------------------------------------------------------- exchange = ccxt.kraken() symbol = 'LTC/EUR' # each ohlcv candle is a list of [ timestamp, open, high, low, close, volume ] index = 4 # use close price from each ohlcv candle length = 80 height = 15 def print_chart(exchange, symbol, timeframe): # get a list of ohlcv candles ohlcv = exchange.fetch_ohlcv(symbol, timeframe) # get the ohlCv (closing price, index == 4)
# -*- coding: utf-8 -*- import os import sys root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(root + '/python') import ccxt # noqa: E402 kraken = ccxt.kraken({ 'apiKey': 'YOUR_API_KEY', 'secret': 'YOUR_SECRET', }) kraken.load_markets() for symbol in kraken.symbols: print( symbol, 'Available leverage levels', 'Buy:', kraken.markets[symbol]['info']['leverage_buy'], 'Sell:', kraken.markets[symbol]['info']['leverage_sell'] ) # THIS IS A KRAKEN-SPECIFIC EXAMPLE. # THE LEVERAGE WILL NOT WORK WITH OTHER EXCHANGES THE SAME WAY. # USE IMPLICIT METHODS FOR MARGIN/LEVERAGED ORDERS WITH OTHER EXCHANGES: # https://github.com/ccxt/ccxt/wiki/Manual#implicit-api-methods
import asciichart # ----------------------------------------------------------------------------- this_folder = os.path.dirname(os.path.abspath(__file__)) root_folder = os.path.dirname(os.path.dirname(this_folder)) sys.path.append(root_folder + '/python') sys.path.append(this_folder) # ----------------------------------------------------------------------------- import ccxt # noqa: E402 # ----------------------------------------------------------------------------- kraken = ccxt.kraken() gdax = ccxt.gdax() symbol = 'BTC/USD' # each ohlcv candle is a list of [ timestamp, open, high, low, close, volume ] index = 4 # use close price from each ohlcv candle def print_chart(exchange, symbol, timeframe): print("\n" + exchange.name + ' ' + symbol + ' ' + timeframe + ' chart:') # get a list of ohlcv candles ohlcv = exchange.fetch_ohlcv(symbol, timeframe)
# ----------------------------------------------------------------------------- import ccxt # noqa: E402 # ----------------------------------------------------------------------------- # common constants msec = 1000 minute = 60 * msec hold = 30 # ----------------------------------------------------------------------------- exchange = ccxt.kraken({ 'rateLimit': 3000, 'enableRateLimit': True, # 'verbose': True, }) # ----------------------------------------------------------------------------- from_datetime = '2017-09-01 00:00:00' from_timestamp = exchange.parse8601(from_datetime) # ----------------------------------------------------------------------------- now = exchange.milliseconds() # ----------------------------------------------------------------------------- data = []
# -*- coding: utf-8 -*- import os import sys #------------------------------------------------------------------------------ root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(root) #------------------------------------------------------------------------------ import ccxt # noqa: E402 #------------------------------------------------------------------------------ kraken = ccxt.kraken({ 'apiKey': "hEvQNMDIeoCJbr7W/ZBb5CGOrx3G0lWF5B3zqa1JBxdZlEaL8EK+D0Mw", 'secret': "JaE9wI6Nwgh5oRxiHcVxurwzwBxwc05W/qv/k1srGg4s3EYuXPpNkLLM5NYbbWpM8rCyijIeDavRuqWbU0ZV9A==", 'verbose': True, # switch it to False if you don't want the HTTP log }) print(kraken.fetch_balance())