This script sends a request to https://bitquery.io/ API, retriving the price data for historical DEX trades on BSC.
- Installation
- Bitquery API
- Create Client Object
- Last Trade Price
- Historical Trade Price
- Add Prices To CSV File
git clone https://github.com/Jimmy-sha256/DEX_Price_History
virtualenv --python=/usr/bin/python3.10 venv
source venv/bin/activate
pip install -r requirements.txt
Create an account:
Generate an API Key:
from bit_query import BitQuery as bq
api_key = 'Insert BitQuery API Key Here'
client = bq(api_key)
MREX = '0x76837d56d1105bb493cddbefeddf136e7c34f0c4'
client.dex_price(MREX)
XRX = '0xb25583e5e2db32b7fcbffe3f5e8e305c36157e54'
date = '2022-12-09 09:43:56'
client.dex_price(XRX, date)
REX = '0x5e0b09b04d6990e76dfe9bf84552a940fd0be05e'
csv_file = 'REX-0x5e0b09b04d6990e76dfe9bf84552a940fd0be05e.csv'
client.add_price_csv(csv_file, REX)