This page was already viewed 3617times
The CryptoCurency eXchange Trading (CCXT) is a multi-language library (Javascript, Python, PHP) used to connect and trade with wolrdwide cryptocurrency exchanges, brokers and payment processing services. CCXT provides an API allowing developers an easy access to market data for usage in their script, codes and trading algoithms. This API connects to exchanges like (among others) binance, coinbase, huobi, okex and many others. CCXT is a very powerful for crypto-fetching and crypto-trading.
Get more information about this API by visiting the CCXT official documentation.
*The CryptoFetcher scriptFinseckto presents you the CryptoFetcher script. This script is a python implementation involving the CCXT api. This script fetch data from 4 well-known exchanges (bittrex, binance, coinbase & kraken), calculates and displays statistical and economical values from an example wallet made of 1.1 XMR and 2.2 ETH.
This implementation is an example of the CCXT API usage and is highly customizable to your needs.
To install CCXT on your system and make it fully operational, you are prompted to execute the following commands. The python ccxt library, pyfiglet are requested to be installed. Moreover, the libffi-dev and libssl-dev libraries may also be optionaly required if any problem.
#python ccxt is requiredclient@linux:#pip install ccxt #python figlet is requiredclient@linux:#pip install pyfiglet #[Optional] (troubleshooting) if libffi is requiredclient@linux:#apt install libffi-dev #[Optional] (troubleshooting) if libssl is requiredclient@linux:#apt install libssl-dev
Create a file called mainapp.py, and past the following code to it.
#!/usr/bin/python #Made by Remsflems import pyfiglet import ccxt ascii_banner = pyfiglet.figlet_format("CRYPTOfetcher") print(ascii_banner) print("Welcome to CRYPTOfetcher: a cryptocurrency wallet organizer (by remsflems)") print("VERSION: 1.1 - beta test") print("LAST update: 27/12/19") #LOAD exchanges bittrex = ccxt.bittrex() binance = ccxt.binance() coinbase = ccxt.coinbasepro() kraken = ccxt.kraken() #LOAD markets kraken.load_markets() coinbase.load_markets() bittrex.load_markets() binance.load_markets() ascii_banner = pyfiglet.figlet_format("MARKET") print(ascii_banner) assetlist=[["Ethereum","ETH"],["Monero","XMR"]] for asset in assetlist: acode=asset[1] aname=asset[0] print "{"+aname+" ["+acode+"]}" changelist=["USD","USDT","EUR","BTC","ETH"] exchangelist = [[bittrex,"BITTREX"],[kraken,"KRAKEN"],[coinbase,"COINBASE"],[binance,"BINANCE"]] for change in changelist: symbol=acode+"/"+change print " ["+symbol+"]" for exchange in exchangelist: try: name=exchange[1] price=exchange[0].fetch_ticker(symbol)['last'] print " ["+name+"] :"+str(price) #STORED SUPER VALUES FOR WALLET CALCULATIONS #SUPERVAL1 -> Binance price for XMR/ETH if name == "BINANCE" and acode=="XMR" and change=="ETH": SUPERVAL1 = price #SUPERVAL2 -> Coinbase price for ETH/EUR if name == "COINBASE" and acode=="ETH" and change=="EUR": SUPERVAL2 = price #SUPERVAL3 -> Coinbase price for ETH/USD if name == "COINBASE" and acode=="ETH" and change=="USD": SUPERVAL3 = price except: pass ascii_banner = pyfiglet.figlet_format("WALLET") print(ascii_banner) walletxmr="1.1" walleteth="2.2" print("[WALLET CONTENT]") print " [COINBASE] : ", walletxmr, "XMR" print " [BINANCE] : ", walleteth, "ETH" print("[ESTIMATED WALLET VALUE]") #detail: #BINANCE: XMR -> ETH. #COINBASE: ETH -> EUR. #COINBASE: ETH -> USD. #ethtotal=float(walleteth) + (float(walletxmr) * float(binance_xmreth_price)) ethtotal=float(walleteth) + (float(walletxmr) * float(SUPERVAL1)) print " [BINANCE] : " + str(ethtotal) + " ETH" eurtotal=ethtotal * float(SUPERVAL2) print " [COINBASE] : " + str(eurtotal) + " EUR" usdtotal=ethtotal * float(SUPERVAL3) print " [COINBASE] : " + str(usdtotal) + " USD"
To launch the python CryptoFetcher script, execute the following command.
client@linux:#python mainapp.py