Async Spot Price Fetching for Faster Concurrent Asset Price Lookups

9 hours ago
21

This updated Python script employs asynchronous operations to significantly speed up the price retrieval process. After querying Binance and Coinbase to find their common supported crypto assets, it now uses aiohttp and asyncio for concurrent calls to the Coinbase public API, fetching USD spot prices for all shared assets in parallel. The code no longer iterates through each asset sequentially; instead, it launches all HTTP requests simultaneously, dramatically reducing runtime. The entire process—from identifying shared listings to logging results and execution time—is streamlined and recorded in a single log file, providing a much faster and more efficient snapshot of the current crypto market.

https://github.com/PythonCryptoDev369/trade/blob/6ea3d591b3226f7996144f371851e56e71e3dfaa/trade.py

BTC -> bc1qm9f4qt0fvmf08x9fq7kaw0jm9p470cvhvv9amj
ETH -> 0x168973848BC0f159f0cac1313564176002e4d93D
XRP -> rsCmjwyXKg4QjLFwKcNUnyc7nCr6m6ti22

Loading comments...