auto_trade_sys/check_db_values.py
薇薇安 f8058083e3 1
2026-02-13 23:29:33 +08:00

25 lines
871 B
Python

import sys
import os
from pathlib import Path
# Add backend to sys.path
backend_dir = Path(__file__).parent / 'backend'
sys.path.insert(0, str(backend_dir))
from database.models import GlobalStrategyConfig, TradingConfig
from database.connection import db
print("Checking DB values...")
keys = ['TAKE_PROFIT_PERCENT', 'TAKE_PROFIT_1_PERCENT', 'STOP_LOSS_PERCENT']
print("--- GlobalStrategyConfig ---")
for key in keys:
val = GlobalStrategyConfig.get_value(key)
print(f"{key}: {val} (Type: {type(val)})")
print("\n--- TradingConfig (All Accounts) ---")
rows = db.execute_query("SELECT account_id, config_key, config_value FROM trading_config WHERE config_key IN ('TAKE_PROFIT_PERCENT', 'TAKE_PROFIT_1_PERCENT', 'STOP_LOSS_PERCENT') ORDER BY account_id")
for row in rows:
print(f"Account {row['account_id']} - {row['config_key']}: {row['config_value']}")