
- Create project structure with FastAPI - Add database models for blocks, transactions, arbitrages, pools, and DEXes - Implement Solana RPC client for fetching blockchain data - Create arbitrage detection algorithm - Implement comprehensive API endpoints for analytics - Set up database migrations with Alembic - Add detailed project documentation generated with BackendIM... (backend.im) Co-Authored-By: Claude <noreply@anthropic.com>
41 lines
799 B
Python
41 lines
799 B
Python
from datetime import datetime
|
|
from typing import List, Optional
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class BlockBase(BaseModel):
|
|
block_height: int
|
|
block_hash: str
|
|
parent_block_hash: Optional[str] = None
|
|
slot: int
|
|
block_time: Optional[datetime] = None
|
|
transactions_count: int = 0
|
|
successful_transactions_count: int = 0
|
|
|
|
|
|
class BlockCreate(BlockBase):
|
|
pass
|
|
|
|
|
|
class BlockUpdate(BaseModel):
|
|
transactions_count: Optional[int] = None
|
|
successful_transactions_count: Optional[int] = None
|
|
processed: Optional[int] = None
|
|
|
|
|
|
class BlockInDBBase(BlockBase):
|
|
id: int
|
|
created_at: datetime
|
|
processed: int
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class Block(BlockInDBBase):
|
|
pass
|
|
|
|
|
|
class BlockList(BaseModel):
|
|
blocks: List[Block]
|
|
total: int |