Closed oldriverno1 closed 5 years ago
from poloniex import Poloniex
polo = Poloniex()
# Returns a dictionary like this
# bid_ask = {
# "trading_pair" = {
# "asks": ['price','volume'], #sorted low to high
# "bids": ['price','volume'], #sorted high to low
# "isFrozen": '0',
# "seq": type(int) }}
bid_ask = polo.returnOrderBook()
# For a specific pair
trading_pair = "BTC_ETH"
high_bid_price = float(bid_ask[trading_pair]['bids'][0][0])
low_ask_price = float(bid_ask[trading_pair]['asks'][0][0])
print(trading_pair)
print(f'Highest bid price: {high_bid_price}')
print(f'Lowest ask price: {low_ask_price}')
Thank you for the help, really appreciate it !
Hi, really appreciate the work. I have a question, is there any way to get the amount for lowest ask and highest bid ? can't find these information from the ticker. Sorry if this is a very simple question, still learning here.