A Streamlit connection component to connect Streamlit apps to the CoinMarketCap API for cryptocurrency market data.
- Easy integration with Streamlit applications.
- Access to real-time and historical cryptocurrency data including prices, market caps, and trading volumes.
- Efficient handling of API rate limits.
- Simple configuration using API key.
Install coinmarketcap_connection
via pip:
pip install coinmarketcap_connection
Set your CoinMarketCap API key in the secrets.toml file for Streamlit apps as described in the Streamlit documentation.
Import
from coinmarketcap_connection import CoinMarketCapConnection
Initialize
cmc_connection = CoinMarketCapConnection("YOUR_CONNECTION_NAME")
Use the connection to fetch the latest cryptocurrency data or historical data.
Fetch Latest Cryptocurrency Data
latest_data = cmc_connection.fetch_latest_data(limit=100)
Fetch Historical Cryptocurrency Data
historical_data = cmc_connection.fetch_historical_data(cryptocurrency_id=1, start_date='2023-01-01', end_date='2023-01-31')
For detailed documentation, visit CoinMarketCap API documentation.