Phase 1.1: Add exchange configuration
- Add exchange constants to shared/constants.json: - eurTradeMin: 100, eurTradeMax: 3000, eurTradeIncrement: 20 - premiumPercentage: 5 - priceRefreshSeconds: 60, priceStalenessSeconds: 300 - Add exchangeStatuses and tradeDirections to shared constants - Add ExchangeStatus and TradeDirection enums to models.py - Update shared_constants.py to export new exchange constants - Update validate_constants.py to validate new enums and fields
This commit is contained in:
parent
c89e0312fa
commit
30e5d0828e
4 changed files with 84 additions and 1 deletions
|
|
@ -3,7 +3,14 @@
|
|||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from models import ROLE_ADMIN, ROLE_REGULAR, AppointmentStatus, InviteStatus
|
||||
from models import (
|
||||
ROLE_ADMIN,
|
||||
ROLE_REGULAR,
|
||||
AppointmentStatus,
|
||||
ExchangeStatus,
|
||||
InviteStatus,
|
||||
TradeDirection,
|
||||
)
|
||||
|
||||
|
||||
def validate_shared_constants() -> None:
|
||||
|
|
@ -44,6 +51,24 @@ def validate_shared_constants() -> None:
|
|||
f"Expected: {expected_appointment_statuses}, Got: {got}"
|
||||
)
|
||||
|
||||
# Validate exchange statuses
|
||||
expected_exchange_statuses = {s.name: s.value for s in ExchangeStatus}
|
||||
if constants.get("exchangeStatuses") != expected_exchange_statuses:
|
||||
got = constants.get("exchangeStatuses")
|
||||
raise ValueError(
|
||||
f"Exchange status mismatch. "
|
||||
f"Expected: {expected_exchange_statuses}, Got: {got}"
|
||||
)
|
||||
|
||||
# Validate trade directions
|
||||
expected_trade_directions = {d.name: d.value for d in TradeDirection}
|
||||
if constants.get("tradeDirections") != expected_trade_directions:
|
||||
got = constants.get("tradeDirections")
|
||||
raise ValueError(
|
||||
f"Trade direction mismatch. "
|
||||
f"Expected: {expected_trade_directions}, Got: {got}"
|
||||
)
|
||||
|
||||
# Validate booking constants exist with required fields
|
||||
booking = constants.get("booking", {})
|
||||
required_booking_fields = [
|
||||
|
|
@ -56,6 +81,20 @@ def validate_shared_constants() -> None:
|
|||
if field not in booking:
|
||||
raise ValueError(f"Missing booking constant '{field}' in constants.json")
|
||||
|
||||
# Validate exchange constants exist with required fields
|
||||
exchange = constants.get("exchange", {})
|
||||
required_exchange_fields = [
|
||||
"eurTradeMin",
|
||||
"eurTradeMax",
|
||||
"eurTradeIncrement",
|
||||
"premiumPercentage",
|
||||
"priceRefreshSeconds",
|
||||
"priceStalenessSeconds",
|
||||
]
|
||||
for field in required_exchange_fields:
|
||||
if field not in exchange:
|
||||
raise ValueError(f"Missing exchange constant '{field}' in constants.json")
|
||||
|
||||
# Validate validation rules exist (structure check only)
|
||||
validation = constants.get("validation", {})
|
||||
required_fields = ["telegram", "signal", "nostrNpub"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue