01 Refactor currency handling in client models and calculations: Update models to store values in GTQ instead of centavos, adjust cost basis calculations, and modify API responses and frontend currency formatting to reflect the new structure.
Some checks failed
CI / lint (push) Has been cancelled
CI / tests (3.10) (push) Has been cancelled
CI / tests (3.9) (push) Has been cancelled
/ release (push) Has been cancelled
/ pullrequest (push) Has been cancelled

This commit is contained in:
padreug 2025-07-06 00:00:48 +02:00
parent 8c3faeec3f
commit 8d442b7c6f
5 changed files with 16 additions and 69 deletions

View file

@ -36,16 +36,16 @@ class ClientTransactionAPI(BaseModel):
lamassu_transaction_id: Optional[str] = None
# Internal Models for Client Dashboard (Database storage in centavos)
# Internal Models for Client Dashboard (Database storage in GTQ)
class ClientDashboardSummary(BaseModel):
"""Internal model - client dashboard summary stored in centavos"""
"""Internal model - client dashboard summary stored in GTQ"""
user_id: str
total_sats_accumulated: int
total_fiat_invested: int # Confirmed deposits (in centavos)
pending_fiat_deposits: int # Pending deposits awaiting confirmation (in centavos)
current_sats_fiat_value: float # Current fiat value of total sats (in centavos)
average_cost_basis: float # Average sats per fiat unit
current_fiat_balance: int # Available balance for DCA (in centavos)
total_fiat_invested: float # Confirmed deposits in GTQ
pending_fiat_deposits: float # Pending deposits awaiting confirmation in GTQ
current_sats_fiat_value: float # Current fiat value of total sats in GTQ
average_cost_basis: float # Average sats per GTQ
current_fiat_balance: float # Available balance for DCA in GTQ
total_transactions: int
dca_mode: str # 'flow' or 'fixed'
dca_status: str # 'active' or 'inactive'
@ -54,10 +54,10 @@ class ClientDashboardSummary(BaseModel):
class ClientTransaction(BaseModel):
"""Internal model - client transaction stored in centavos"""
"""Internal model - client transaction stored in GTQ"""
id: str
amount_sats: int
amount_fiat: int # Stored in centavos (GTQ * 100) for precision
amount_fiat: float # Amount in GTQ (e.g., 150.75)
exchange_rate: float
transaction_type: str # 'flow', 'fixed', 'manual'
status: str