Package: dexapi
dexapiPython wrapper for bitquery.io DEX APIInstallationInstall the latest version from PyPI is by using pip:pip install dexapiAlternatively, install directly from the GitHub repository:pip install git+https://github.com/kayrauygun/dexapi.gitFunctionsCreatedexAPIobject using following code:importdexapiapi=dexapi.dexAPI("API_KEY",network="NETWORK_NAME")Available networks are "ethereum" and "bsc".List of Exchangesget_exchangesfunction returns DEXs with highest volume (in USD)  in network between two datetimes.dexapi.dexAPI.get_exchanges(start_time,end_time,limit)start_time:str | datetime, optional, default = first day of current year, format = "YYYY-MM-DD",
datetime.date(YYYY,MM,DD), "YYYY-MM-DDTHH:MM:SS" (ISO8601DateTime), datetime.datetime(YYYY,MM,DD,HH,MM,SS),
if hours, minutes, seconds are not specified it will be taken as 00:00:00end_time:str | datetime, optional, default = now, format = "YYYY-MM-DD",
datetime.date(YYYY,MM,DD), "YYYY-MM-DDTHH:MM:SS" (ISO8601DateTime), datetime.datetime(YYYY,MM,DD,HH,MM,SS),
if hours, minutes, seconds are not specified it will be taken as 23:59:59limit:int, optional, default = 20, maximum number of entries function returnsreturn:* dataframe, columns = [
"exchange": DEX name,
"protocol": protocol DEX uses,
"count": number of trades,
"tradeAmount": total volume in USD,
"exchangeAddress": address of exchange on network
]*Example usage:importdexapiapi=dexapi.dexAPI("API_KEY",network="ethereum")api.get_exchanges("2022-03-01","2022-03-15",20)List of Pairsget_pairsfunction returns pairs with highest volume (in USD) in the DEX between two datetimes.dexapi.dexAPI.get_pairs(exchange_address,start_time,end_time,limit)exchange_address:str, address of exchange on networkstart_time:str | datetime, optional, default = first day of current year, format = "YYYY-MM-DD",
datetime.date(YYYY,MM,DD), "YYYY-MM-DDTHH:MM:SS" (ISO8601DateTime), datetime.datetime(YYYY,MM,DD,HH,MM,SS),
if hours, minutes, seconds are not specified it will be taken as 00:00:00end_time:str | datetime, optional, default = now, format = "YYYY-MM-DD",
datetime.date(YYYY,MM,DD), "YYYY-MM-DDTHH:MM:SS" (ISO8601DateTime), datetime.datetime(YYYY,MM,DD,HH,MM,SS),
if hours, minutes, seconds are not specified it will be taken as 23:59:59limit:int, optional, default = 20, maximum number of entries function returnsreturn:dataframe, columns = [
"exchange": DEX name,
"protocol": protocol DEX uses,
"currency1": first leg of swaps,
"currency2": second leg of swap,
"smartContract": address of smart contract trades pair on network
]Example usage:importdexapiapi=dexapi.dexAPI("API_KEY",network="ethereum")api.get_exchanges("0x1f98431c8ad98523631ae4a59f267346ea31f984","2022-03-01","2022-03-15",50)List of Tradesget_tradesfunction returns most recent trades use the smart contract between two times.dexapi.dexAPI.get_trades(smart_contract,start_time,end_time,limit)smart_contract:str, address of smart contract on networkstart_time:str | datetime, optional, default = today 00:00:00, format = "YYYY-MM-DD",
datetime.date(YYYY,MM,DD), "YYYY-MM-DDTHH:MM:SS" (ISO8601DateTime), datetime.datetime(YYYY,MM,DD,HH,MM,SS),
if hours, minutes, seconds are not specified it will be taken as 00:00:00end_time:str | datetime, optional, default = now, format = "YYYY-MM-DD",
datetime.date(YYYY,MM,DD), "YYYY-MM-DDTHH:MM:SS" (ISO8601DateTime), datetime.datetime(YYYY,MM,DD,HH,MM,SS),
if hours, minutes, seconds are not specified it will be taken as 23:59:59limit:int, optional, default = 1000, maximum number of entries function returnsreturn:dataframe, columns = [
"exchange": DEX name,
"protocol": protocol DEX uses,
"timestamp": timestamp of block,
"block": block height,
"buyCurrency": currency DEX buys,
"sellCurrency": currency DEX sells,
"price": price of "buyCurrency" in terms of "sellCurrency",
"tradeAmount": volume in USD
"transaction": transaction hash
]Example usage:importdexapiapi=dexapi.dexAPI("API_KEY",network="ethereum")api.get_trades("0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640","2022-03-15","2022-03-15",1500)Historical Balanceget_balancesfunction returns the balance of the smart contract address at a specific time.dexapi.dexAPI.get_balances(address,time)address: *str, address of the smart contract on networktime:str | datetime, optional, default = now, format = "YYYY-MM-DD",
datetime.date(YYYY,MM,DD), "YYYY-MM-DDTHH:MM:SS" (ISO8601DateTime), datetime.datetime(YYYY,MM,DD,HH,MM,SS),
if hours, minutes, seconds are not specified it will be taken as 23:59:59return:dataframe, columns = [
"currency": currency symbol,
"value": number of tokens owned by address,
"currencyAddress": address of currency,
]Example usage:importdexapiapi=dexapi.dexAPI("API_KEY",network="ethereum")api.get_trades("0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640","2022-03-15T14:55:55")