deploy: 2026-03-20 07:49
This commit is contained in:
3
config/__init__.py
Normal file
3
config/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from config.settings import Settings
|
||||
|
||||
settings = Settings()
|
||||
54
config/settings.py
Normal file
54
config/settings.py
Normal file
@@ -0,0 +1,54 @@
|
||||
"""Global application settings loaded from environment variables."""
|
||||
|
||||
from typing import List
|
||||
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
"""Application configuration powered by pydantic-settings.
|
||||
|
||||
Values are loaded from environment variables or a .env file.
|
||||
"""
|
||||
|
||||
# -- Exchange --
|
||||
EXCHANGE_ID: str = "binance"
|
||||
API_KEY: str = ""
|
||||
API_SECRET: str = ""
|
||||
SANDBOX_MODE: bool = True
|
||||
|
||||
# -- Trading --
|
||||
TRADING_PAIRS: List[str] = ["BTC/USDT", "ETH/USDT"]
|
||||
DEFAULT_LEVERAGE: int = 1
|
||||
MAX_LEVERAGE: int = 3
|
||||
|
||||
# -- ICT Parameters --
|
||||
SWING_LENGTH: int = 50
|
||||
FVG_JOIN_CONSECUTIVE: bool = False
|
||||
OB_CLOSE_MITIGATION: bool = False
|
||||
LIQUIDITY_RANGE_PERCENT: float = 0.01
|
||||
MIN_CONFLUENCE_SCORE: int = 3
|
||||
|
||||
# -- Timeframes --
|
||||
HTF_TIMEFRAME: str = "4h"
|
||||
MTF_TIMEFRAME: str = "1h"
|
||||
LTF_TIMEFRAME: str = "15m"
|
||||
|
||||
# -- Risk Management --
|
||||
MAX_RISK_PER_TRADE: float = 0.02
|
||||
MAX_DAILY_LOSS: float = 0.05
|
||||
MAX_CONCURRENT_POSITIONS: int = 3
|
||||
MAX_DRAWDOWN: float = 0.15
|
||||
|
||||
# -- Notification --
|
||||
TELEGRAM_BOT_TOKEN: str = ""
|
||||
TELEGRAM_CHAT_ID: str = ""
|
||||
|
||||
# -- Database --
|
||||
DB_PATH: str = "data/trading.db"
|
||||
|
||||
# -- Logging --
|
||||
LOG_LEVEL: str = "INFO"
|
||||
LOG_FILE: str = "logs/bot.log"
|
||||
|
||||
model_config = {"env_file": ".env", "env_file_encoding": "utf-8"}
|
||||
50
config/strategies.py
Normal file
50
config/strategies.py
Normal file
@@ -0,0 +1,50 @@
|
||||
"""ICT strategy parameter presets."""
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Dict
|
||||
|
||||
|
||||
@dataclass
|
||||
class ICTStrategyParams:
|
||||
"""Parameters for the ICT SMC strategy."""
|
||||
|
||||
# Swing detection
|
||||
swing_length: int = 50
|
||||
|
||||
# Fair Value Gap
|
||||
fvg_join_consecutive: bool = False
|
||||
|
||||
# Order Blocks
|
||||
ob_close_mitigation: bool = False
|
||||
|
||||
# Liquidity
|
||||
liquidity_range_percent: float = 0.01
|
||||
|
||||
# Confluence
|
||||
min_confluence_score: int = 3
|
||||
|
||||
# Timeframes
|
||||
htf: str = "4h"
|
||||
mtf: str = "1h"
|
||||
ltf: str = "15m"
|
||||
|
||||
# Exit
|
||||
trailing_stop_activation_pct: float = 0.01 # activate after 1% profit
|
||||
trailing_stop_distance_pct: float = 0.005 # trail by 0.5%
|
||||
time_exit_candles: int = 48 # exit after N candles
|
||||
|
||||
|
||||
# Pre-built presets
|
||||
STRATEGY_PRESETS: Dict[str, ICTStrategyParams] = {
|
||||
"default": ICTStrategyParams(),
|
||||
"aggressive": ICTStrategyParams(
|
||||
min_confluence_score=2,
|
||||
swing_length=30,
|
||||
trailing_stop_activation_pct=0.005,
|
||||
),
|
||||
"conservative": ICTStrategyParams(
|
||||
min_confluence_score=4,
|
||||
swing_length=70,
|
||||
trailing_stop_activation_pct=0.02,
|
||||
),
|
||||
}
|
||||
27
config/trading_pairs.py
Normal file
27
config/trading_pairs.py
Normal file
@@ -0,0 +1,27 @@
|
||||
"""Trading pair configuration and helpers."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import List
|
||||
|
||||
|
||||
@dataclass
|
||||
class TradingPairConfig:
|
||||
"""Configuration for a single trading pair."""
|
||||
|
||||
symbol: str
|
||||
min_order_size: float = 0.0
|
||||
max_leverage: int = 3
|
||||
enabled: bool = True
|
||||
|
||||
|
||||
# Default pairs for MVP (Phase 1)
|
||||
DEFAULT_PAIRS: List[TradingPairConfig] = [
|
||||
TradingPairConfig(symbol="BTC/USDT", min_order_size=0.001),
|
||||
TradingPairConfig(symbol="ETH/USDT", min_order_size=0.01),
|
||||
]
|
||||
|
||||
|
||||
def get_enabled_pairs(pairs: List[TradingPairConfig] | None = None) -> List[str]:
|
||||
"""Return list of enabled symbol strings."""
|
||||
source = pairs or DEFAULT_PAIRS
|
||||
return [p.symbol for p in source if p.enabled]
|
||||
Reference in New Issue
Block a user