Automated Action 3a29a346a9 Initial implementation of cryptocurrency data API service using CoinCap API
* Created FastAPI application structure
* Added database models for assets, exchanges, markets, and rates
* Integrated with CoinCap API
* Implemented REST API endpoints
* Setup SQLite persistence with Alembic migrations
* Added comprehensive documentation

Generated with BackendIM... (backend.im)
2025-05-14 12:18:27 +00:00

98 lines
2.5 KiB
Markdown

# Cryptocurrency Data API Service
A FastAPI backend service that provides cryptocurrency data via CoinCap API. This service acts as a wrapper around the CoinCap API, providing additional features like data caching, persistence, and a clean REST API.
## Features
- RESTful API for accessing cryptocurrency data
- Proxies CoinCap API to provide cryptocurrency market data
- Data models for assets, exchanges, markets, and conversion rates
- Persistent storage using SQLite
- Database migrations using Alembic
- OpenAPI documentation
## API Endpoints
The API provides the following endpoints:
### Health Check
- `GET /health` - Check if the service is up and running
### Assets
- `GET /api/v1/assets` - Get a list of assets with optional filtering
- `GET /api/v1/assets/{asset_id}` - Get details for a specific asset
- `GET /api/v1/assets/{asset_id}/markets` - Get markets for a specific asset
- `GET /api/v1/assets/{asset_id}/history` - Get historical data for a specific asset
### Exchanges
- `GET /api/v1/exchanges` - Get a list of exchanges
- `GET /api/v1/exchanges/{exchange_id}` - Get details for a specific exchange
### Markets
- `GET /api/v1/markets` - Get a list of markets with optional filtering
### Rates
- `GET /api/v1/rates` - Get conversion rates
- `GET /api/v1/rates/{rate_id}` - Get a specific conversion rate
## Prerequisites
- Python 3.8 or higher
- SQLite
## Installation
1. Clone the repository:
```
git clone <repository-url>
cd cryptocurrency-data-api-service
```
2. Create a virtual environment and activate it:
```
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```
3. Install dependencies:
```
pip install -r requirements.txt
```
4. Apply migrations:
```
alembic upgrade head
```
## Usage
Start the server:
```
uvicorn main:app --reload
```
The API will be available at http://localhost:8000
### API Documentation
After starting the server, you can access the interactive API documentation:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
## Environment Variables
The following environment variables can be configured:
- `COINCAP_API_KEY` - Your CoinCap API key (default is provided for development)
- `DB_PATH` - Path to SQLite database file (default: `/app/storage/db/db.sqlite`)
## License
[MIT License](LICENSE)
## Credits
- [FastAPI](https://fastapi.tiangolo.com/) - Web framework for building APIs
- [CoinCap API](https://docs.coincap.io/) - Cryptocurrency data provider