Last active
October 13, 2022 07:34
-
-
Save jimtin/fd753b7e249eebedb156412caeecbea9 to your computer and use it in GitHub Desktop.
Function to query the full list of Binance trading pairs and extract a given quote asset. Part of the series How to Build a Crypto Trading Bot with Binance and Python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Function to query Binance for all symbols with a base asset of BUSD | |
def query_quote_asset_list(quote_asset_symbol): | |
# Retrieve a list of symbols from Binance. Returns as a dictionary | |
symbol_dictionary = Spot().exchange_info() | |
# Convert into a dataframe | |
symbol_dataframe = pandas.DataFrame(symbol_dictionary['symbols']) | |
# Extract only those symbols with a base asset of BUSD and status of TRADING | |
quote_symbol_dataframe = symbol_dataframe.loc[symbol_dataframe['quoteAsset'] == quote_asset_symbol] | |
quote_symbol_dataframe = quote_symbol_dataframe.loc[quote_symbol_dataframe['status'] == "TRADING"] | |
# Return base_symbol_dataframe | |
return quote_symbol_dataframe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment