93 lines
3.2 KiB
Python
93 lines
3.2 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from crypto_spot_bot.config import Settings
|
|
|
|
|
|
@pytest.fixture
|
|
def make_settings():
|
|
def factory(tmp_path: Path, **overrides) -> Settings:
|
|
values = dict(
|
|
trading_mode="paper",
|
|
host="127.0.0.1",
|
|
port=8787,
|
|
bybit_testnet=False,
|
|
bybit_api_key="",
|
|
bybit_api_secret="",
|
|
starting_balance_usdt=100.0,
|
|
auto_select_symbols=True,
|
|
top_symbols_count=6,
|
|
symbols=(),
|
|
base_interval="1",
|
|
kline_limit=240,
|
|
loop_interval_seconds=5,
|
|
fast_trading_enabled=False,
|
|
fast_loop_interval_seconds=1.0,
|
|
fast_entry_cooldown_seconds=20,
|
|
max_entries_per_minute=12,
|
|
websocket_enabled=False,
|
|
min_signal_confidence=0.64,
|
|
max_spread_percent=0.18,
|
|
min_24h_turnover_usdt=1_000_000.0,
|
|
pattern_analysis_enabled=True,
|
|
pattern_score_weight=0.18,
|
|
learning_enabled=True,
|
|
learning_lookback_trades=120,
|
|
learning_min_samples=3,
|
|
learning_max_adjustment=0.12,
|
|
llm_advisor_enabled=False,
|
|
ollama_base_url="http://192.168.0.210:11434",
|
|
ollama_model="gemma4:e4b",
|
|
llm_advisor_min_interval_seconds=180,
|
|
llm_advisor_timeout_seconds=45,
|
|
llm_advisor_max_adjustment=0.06,
|
|
min_position_usdt=1.0,
|
|
max_position_usdt=20.0,
|
|
max_symbol_exposure_usdt=20.0,
|
|
max_total_exposure_usdt=80.0,
|
|
max_open_positions=6,
|
|
max_positions_per_symbol=1,
|
|
grid_trading_enabled=True,
|
|
grid_entry_confidence=0.58,
|
|
grid_buy_zone=0.45,
|
|
grid_max_position_usdt=8.0,
|
|
rebound_trading_enabled=True,
|
|
rebound_entry_confidence=0.58,
|
|
rebound_min_probability=0.58,
|
|
rebound_max_position_usdt=6.0,
|
|
time_series_forecast_enabled=True,
|
|
time_series_min_candles=120,
|
|
time_series_validation_window=30,
|
|
time_series_forecast_horizon=3,
|
|
time_series_ewma_lambda=0.94,
|
|
time_series_min_edge_percent=0.04,
|
|
time_series_max_adjustment=0.08,
|
|
time_series_lstm_enabled=True,
|
|
time_series_lstm_lookback=32,
|
|
time_series_lstm_units=6,
|
|
time_series_lstm_ridge=0.0001,
|
|
time_series_lstm_model_path=tmp_path / "lstm_forecaster.json",
|
|
stop_loss_percent=0.02,
|
|
take_profit_percent=0.035,
|
|
trailing_stop_percent=0.015,
|
|
min_hold_seconds=180,
|
|
entry_cooldown_seconds=180,
|
|
max_daily_drawdown_usdt=6.0,
|
|
min_cash_reserve_usdt=5.0,
|
|
taker_fee_rate=0.001,
|
|
slippage_rate=0.0003,
|
|
enable_live_trading=False,
|
|
live_trading_confirm="",
|
|
live_order_max_usdt=10.0,
|
|
database_path=tmp_path / "tradebot.sqlite3",
|
|
log_path=tmp_path / "tradebot.log",
|
|
env_file_path=tmp_path / ".env",
|
|
)
|
|
values.update(overrides)
|
|
return Settings(**values)
|
|
|
|
return factory
|