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 exchangeObject(exchange_in): exchanges = [ccxt.acx(),ccxt.bitbay(),ccxt.bitfinex(),ccxt.bitflyer(),ccxt.bithumb(),ccxt.bitlish(),ccxt.bitmarket(),ccxt.bitmex(),ccxt.bitso(), ccxt.bitstamp(),ccxt.bitstamp1(),ccxt.bittrex(),ccxt.bl3p(),ccxt.bleutrade(),ccxt.btcbox(),ccxt.btcchina(),ccxt.btcexchange(),ccxt.btcmarkets(),ccxt.btctradeua(),ccxt.btcturk(), ccxt.btcx(),ccxt.bxinth(),ccxt.ccex(),ccxt.cex(),ccxt.chbtc(),ccxt.chilebit(),ccxt.coincheck(),ccxt.coinfloor(),ccxt.coingi(),ccxt.coinmarketcap(),ccxt.coinmate(), ccxt.coinsecure(),ccxt.coinspot(),ccxt.cryptopia(),ccxt.dsx(),ccxt.exmo(),ccxt.flowbtc(),ccxt.foxbit(),ccxt.fybse(),ccxt.fybsg(),ccxt.gatecoin(),ccxt.gateio(),ccxt.gdax(), ccxt.gemini(),ccxt.getbtc(),ccxt.hitbtc(),ccxt.huobi(),ccxt.huobicny(),ccxt.independentreserve(),ccxt.itbit(),ccxt.jubi(),ccxt.kraken(),ccxt.kucoin(), ccxt.kuna(),ccxt.lakebtc(),ccxt.liqui(),ccxt.livecoin(),ccxt.luno(),ccxt.mercado(),ccxt.mixcoins(),ccxt.nova(),ccxt.okcoincny(),ccxt.okcoinusd(),ccxt.okex(),ccxt.paymium(), ccxt.poloniex(),ccxt.qryptos(),ccxt.quadrigacx(),ccxt.southxchange(),ccxt.surbitcoin(),ccxt.therock(),ccxt.tidex(),ccxt.urdubit(),ccxt.vaultoro(),ccxt.vbtc(), ccxt.virwox(),ccxt.wex(),ccxt.xbtce(),ccxt.yobit(),ccxt.yunbi(),ccxt.zaif(),ccxt.zb()] for count, exchange in enumerate([str(x) for x in exchanges]): if exchange_in.lower() in exchange: return exchanges[count] break
def __init__(self): self.coinmarketcap = Pymarketcap() self.bittrex = ccxt.bittrex() #self.poloniex = ccxt.poloniex() self.quadrigacx = ccxt.quadrigacx() self.quadrigacx.userAgent = self.quadrigacx.userAgents['chrome']; self.exchanges = {'Bittrex':self.bittrex,'Quadrigacx':self.quadrigacx,'coinmarketcap':self.coinmarketcap} self.loadMarkets() self.btc = {'name':'BTC','Cmc':{'last': '0', 'current':'0','color':'black','1h':'0','24h':'0','7d':'0'}, 'Bittrex':{'last':'0','currentBTC':'0','lastBTC':'0','current':'0','color':'black','bid':'0','ask':'0','high':'0','low':'0','vol':'0','sell':'0','buy':'0','change':'0'}, 'Quadrigacx':{'last':'0','currentBTC':'0','lastBTC':'0', 'current':'0','color':'black','bid':'0','ask':'0','high':'0','low':'0','vol':'0','sell':'0','buy':'0','change':'0'}} self.eth = {'name':'ETH','Cmc': {'last':'0', 'current':'0','color':'black','1h':'0','24h':'0','7d':'0'}, 'Bittrex': {'last':'0','currentBTC':'0','lastBTC':'0', 'current':'0','color':'black','bid':'0','ask':'0','high':'0','low':'0','vol':'0','sell':'0','buy':'0','change':'0'}, 'Quadrigacx': {'last':'0','currentBTC':'0','lastBTC':'0', 'current':'0','color':'black','bid':'0','ask':'0','high':'0','low':'0','vol':'0','sell':'0','buy':'0','change':'0'}} self.zec = {'name':'ZEC','Cmc': {'last':'0', 'current':'0','color':'black','1h':'0','24h':'0','7d':'0'}, 'Bittrex': {'last':'0','currentBTC':'0','lastBTC':'0', 'current':'0','color':'black','bid':'0','ask':'0','high':'0','low':'0','vol':'0','sell':'0','buy':'0','change':'0'}} self.ltc = {'name':'LTC','Cmc': {'last': '0', 'current': '0','color':'black','1h':'0','24h':'0','7d':'0'}, 'Bittrex': {'last':'0','currentBTC':'0','lastBTC':'0', 'current':'0','color':'black','bid':'0','ask':'0','high':'0','low':'0','vol':'0','sell':'0','buy':'0','change':'0'}, 'Quadrigacx': {'last':'0','currentBTC':'0','lastBTC':'0', 'current':'0','color':'black','bid':'0','ask':'0','high':'0','low':'0','vol':'0','sell':'0','buy':'0','change':'0'}} self.coins = [self.btc,self.eth,self.zec,self.ltc]
import exchange_basics import ccxt import json, time """ Script to prepare the json data that we eff with """ quadrigacx = ccxt.quadrigacx() binance = ccxt.binance() g = { 'nodes': [], 'links': [], 'collection_date': time.strftime('%d/%m/%Y %H:%M') } node_set = set() conversion_set = exchange_basics.analyze_raw_tickers( exchange_basics.get_tickers(binance)) for conversion in conversion_set: currencies = conversion[0].split('/') if currencies[0] not in node_set: g['nodes'].append({'id': currencies[0]}) node_set.add(currencies[0]) if currencies[1] not in node_set: g['nodes'].append({'id': currencies[1]}) node_set.add(currencies[1])
'secret': '9aHjPmW+EtRRKN/OiZGjXh8OxyThnDL4mMDre4Ghvn8wjMniAr5jdEZJLN/knW6FHeQyiz3dPIL5ytnF0Y6Xwg==', 'password': '******', # GDAX requires a password! }) gdax.urls[ 'api'] = 'https://api-public.sandbox.gdax.com' # use the testnet for GDAX hitbtc = ccxt.hitbtc({ 'apiKey': '18339694544745d9357f9e7c0f7c41bb', 'secret': '8340a60fb4e9fc73a169c26c7a7926f5', }) quadrigacx = ccxt.quadrigacx({ 'apiKey': 'jKvWkMqrOj', 'secret': 'f65a2e3bf3c73171ee14e389314b2f78', 'uid': '395037', # QuadrigaCX requires uid! }) try: # fetch account balance from the exchange gdaxBalance = gdax.fetch_balance() # output the result dump(green(gdax.name), 'balance', gdaxBalance) # fetch another one hitbtcBalance = hitbtc.fetch_balance() # output the result
gdax = ccxt.gdax({ 'apiKey': '92560ffae9b8a01d012726c698bcb2f1', # standard 'secret': '9aHjPmW+EtRRKN/OiZGjXh8OxyThnDL4mMDre4Ghvn8wjMniAr5jdEZJLN/knW6FHeQyiz3dPIL5ytnF0Y6Xwg==', 'password': '******', # GDAX requires a password! }) gdax.urls['api'] = 'https://api-public.sandbox.gdax.com' # use the testnet for GDAX hitbtc = ccxt.hitbtc({ 'apiKey': '18339694544745d9357f9e7c0f7c41bb', 'secret': '8340a60fb4e9fc73a169c26c7a7926f5', }) quadrigacx = ccxt.quadrigacx({ 'apiKey': 'jKvWkMqrOj', 'secret': 'f65a2e3bf3c73171ee14e389314b2f78', 'uid': '395037', # QuadrigaCX requires uid! }) try: # fetch account balance from the exchange gdaxBalance = gdax.fetch_balance() # output the result dump(green(gdax.name), 'balance', gdaxBalance) # fetch another one hitbtcBalance = hitbtc.fetch_balance() # output the result dump(green(hitbtc.name), 'balance', hitbtcBalance)
ccxt.lbank(), ccxt.liqui(), ccxt.livecoin(), ccxt.luno(), ccxt.lykke(), ccxt.mercado(), ccxt.mixcoins(), ccxt.negociecoins(), ccxt.nova(), ccxt.okcoincny(), ccxt.okcoinusd(), ccxt.okex(), ccxt.paymium(), ccxt.poloniex(), ccxt.qryptos(), ccxt.quadrigacx(), ccxt.quoinex(), ccxt.southxchange(), ccxt.surbitcoin(), ccxt.therock(), ccxt.tidex(), ccxt.urdubit(), ccxt.vaultoro(), ccxt.vbtc(), ccxt.virwox(), ccxt.wex(), ccxt.xbtce(), ccxt.yobit(), ccxt.yunbi(), ccxt.zaif(), ccxt.zb()