Skip to content

Instantly share code, notes, and snippets.

@yyolk
Created August 3, 2021 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yyolk/94933977373843ee3aa6a8392186bc6b to your computer and use it in GitHub Desktop.
Save yyolk/94933977373843ee3aa6a8392186bc6b to your computer and use it in GitHub Desktop.
simple price aggregate with ccxt
import ccxt
def get_price(exchange_client, pair) -> float:
return exchange_client.fetch_ticker(pair).get("last")
if __name__ == "__main__":
binance = (ccxt.binance(), "XRP/USDT")
bitfinex = (ccxt.bitfinex(), "XRP/USD")
bitstamp = (ccxt.bitstamp(), "XRP/USD")
hitbtc = (ccxt.hitbtc(), "XRP/USDT")
kraken = (ccxt.kraken(), "XRP/USD")
results = [
get_price(*item) for item in [binance, bitfinex, bitstamp, hitbtc, kraken]
]
print("Resultas are", results)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment