cryptop2ptradingplatform-f8.../alembic/versions/002_seed_cryptocurrencies.py
Automated Action b9798f0eaf Implement comprehensive crypto P2P trading platform
- Complete FastAPI application with JWT authentication
- SQLite database with SQLAlchemy ORM and Alembic migrations
- User registration/login with secure password hashing
- Multi-cryptocurrency wallet system with balance tracking
- Advertisement system for buy/sell listings with fund locking
- Order management with automatic payment integration
- Payment provider API integration with mock fallback
- Automatic crypto release after payment confirmation
- Health monitoring endpoint and CORS configuration
- Comprehensive API documentation with OpenAPI/Swagger
- Database models for users, wallets, ads, orders, and payments
- Complete CRUD operations for all entities
- Security features including fund locking and order expiration
- Detailed README with setup and usage instructions

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-26 14:48:18 +00:00

79 lines
2.1 KiB
Python

"""Seed cryptocurrencies
Revision ID: 002
Revises: 001
Create Date: 2024-01-01 00:01:00.000000
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '002'
down_revision = '001'
branch_labels = None
depends_on = None
def upgrade() -> None:
# Insert popular cryptocurrencies
cryptocurrencies_table = sa.table(
'cryptocurrencies',
sa.column('symbol', sa.String),
sa.column('name', sa.String),
sa.column('is_active', sa.Boolean),
sa.column('min_trade_amount', sa.Float),
sa.column('max_trade_amount', sa.Float),
sa.column('precision', sa.Integer)
)
op.bulk_insert(
cryptocurrencies_table,
[
{
'symbol': 'BTC',
'name': 'Bitcoin',
'is_active': True,
'min_trade_amount': 0.00001,
'max_trade_amount': 10.0,
'precision': 8
},
{
'symbol': 'ETH',
'name': 'Ethereum',
'is_active': True,
'min_trade_amount': 0.001,
'max_trade_amount': 100.0,
'precision': 8
},
{
'symbol': 'USDT',
'name': 'Tether',
'is_active': True,
'min_trade_amount': 1.0,
'max_trade_amount': 100000.0,
'precision': 6
},
{
'symbol': 'USDC',
'name': 'USD Coin',
'is_active': True,
'min_trade_amount': 1.0,
'max_trade_amount': 100000.0,
'precision': 6
},
{
'symbol': 'BNB',
'name': 'Binance Coin',
'is_active': True,
'min_trade_amount': 0.01,
'max_trade_amount': 1000.0,
'precision': 8
}
]
)
def downgrade() -> None:
op.execute("DELETE FROM cryptocurrencies WHERE symbol IN ('BTC', 'ETH', 'USDT', 'USDC', 'BNB')")