MultiversX Tracker is Live!

Is there a working example of how to make trades and get historical data in Binance Smart Chain using python?

Binance

Cryptocoins Exchanges / Binance 262 Views

I am currently using the python-bscscan documentation with my wallet address to access token transfers for a given contract address. Here is the link to the documentation: https://bscscan-python.pankotsias.com/bscscan.modules.html#module-bscscan.modules.accounts/

This is my code that I have so far:

from bscscan import BscScan async def get_contents(): async with BscScan(bsc_address) as client: print( await client.get_bep20_token_transfer_events_by_address( address="0x0000000000000000000000000000000000001004", startblock=0, endblock=999999999, sort="asc" ) ) asyncio.run(get_contents())

When I run this snippet of code, I get the following error: RuntimeError Traceback (most recent call last) in () 10 ) 11 ) ---> 12 asyncio.run(get_contents())

/usr/lib/python3.7/asyncio/runners.py in run(main, debug) 32 if events._get_running_loop() is not None: 33 raise RuntimeError( ---> 34 "asyncio.run() cannot be called from a running event loop") 35 36 if not coroutines.iscoroutine(main):

RuntimeError: asyncio.run() cannot be called from a running event loop

Other StackOverflow posts have suggested installing nest_asyncio, using an if/else conditional with the if statement containing the main() and else containing asyncio.run(). I have tried both ways but still, get the same error.

I am unsure why I am receiving this error. If I could get some clarification as to how to move forward, that would be great. Also, if there are other examples of Binance Smart Chain python available, I would appreciate some more resources.

submitted by /u/Optimal_Chard6537
[link] [comments]
Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments