-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.py
More file actions
129 lines (114 loc) · 4.04 KB
/
config.py
File metadata and controls
129 lines (114 loc) · 4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import os
# Server Settings
SERVER_HOST = "0.0.0.0"
SERVER_PORT = 8760
# Queue Settings
BUFFER_SIZE = 1000
# New ROI Hedging Configuration
HEDGE_CONFIG = {
"enabled": True, # Enable new system
"price_safe_zone": 0.05, # % PRICE CHANGE to exit safe-zone
"under_hedge_usd": 0.01, # $ buffer for paired closing
"anti_spam_seconds": 2, # Protection against frequent operations
"retry_attempts": 3, # Attempts on insufficient balance
"retry_delays": [10, 30, 60], # Delays between attempts (sec)
# UNLIMITED number of levels
"levels": [
{
"roi_pct": -0.5, # ROI change threshold in %
"coef": 0.5, # Hedge size multiplier
"sl_pct": 1.0, # Initial Stop Loss (%)
"move_trigger_pct": 0.3, # Stop move trigger (%)
"move_sl_pct": 0.15 # Where to move Stop (%)
},
{
"roi_pct": -1.5, # ROI change threshold in %
"coef": 0.5, # Hedge size multiplier
"sl_pct": 1.5, # Initial Stop Loss (%)
"move_trigger_pct": 0.5, # Stop move trigger (%)
"move_sl_pct": 0.25 # Where to move Stop (%)
},
{
"roi_pct": -3.0, # ROI change threshold in %
"coef": 1.0, # Hedge size multiplier
"sl_pct": 2.0, # Initial Stop Loss (%)
"move_trigger_pct": 1.0, # Stop move trigger (%)
"move_sl_pct": 0.5 # Where to move Stop (%)
}
],
}
# Unified Stage Structure: Step 0 - Entry, Steps 1+ - Averaging
TRADING_STAGES = [
# Step 0: Entry (not averaging)
{
"step": 0,
"tf": "3", # Timeframe for indicators
"tp": 0.5, # Final TP after adjustment
"po_percent": { # Percentage for pending order
"long": 2.0,
"short": 2.0
},
"multiplier": None, # Volume multiplier (none for entry)
"required_price_change": 0.0 # Required price change for averaging
},
# Step 1: First Averaging
{
"step": 1,
"tf": "5", # Timeframe
"tp": 0.4, # Take Profit
"multiplier": 2.0, # Averaging volume multiplier
"required_price_change": 0.0001 # Required price change for averaging
},
# Step 2: Second Averaging
{
"step": 2,
"tf": "10", # Timeframe
"tp": 0.5, # Take Profit
"multiplier": 4.0, # Averaging volume multiplier
"required_price_change": 0.02 # Required price change for averaging
},
# Step 3: Third Averaging
{
"step": 3,
"tf": "120", # Timeframe
"tp": 0.6, # Take Profit
"multiplier": 10.0, # Averaging volume multiplier
"required_price_change": 0.1 # Required price change for averaging
}
]
# Max Open Positions Limit
MAX_OPEN_POSITIONS = 5
# Leverage
LEVERAGE = 10
# Placeholder
STOP_LOSS = 3.0
# For Simulations
MIN_BALANCE = 0.01
COMMISSION = 0.001
# OKX Settings
API_KEY = "YOUR_API_KEY"
API_SECRET = "YOUR_SECRET_KEY"
PASSPHRASE = "YOUR_PASSPHRASE" # Added generally needed for OKX
# TP Reschedule Multiplier on Failure
TP_MULTIPLIER = 2
# Pause during Reschedule
TP_RETRY_DELAY = 0.2
# Number of TP Set Attempts
TP_MAX_ATTEMPTS = 20
# Number of SL Set Attempts
SL_MAX_ATTEMPTS = 20
# Multiplier, same as for Take Profit
SL_MULTIPLIER = TP_MULTIPLIER
# Reschedule Pause
SL_RETRY_DELAY = 0.2
# Telegram Settings
TELEGRAM_TOKEN = "YOUR_TELEGRAM_TOKEN"
TELEGRAM_CHAT_ID = "YOUR_CHAT_ID"
# Logging
LOG_LEVEL = "INFO"
# Additional Settings
SYMBOLS_FILE = "symbols.txt"
# Max concurrent tasks for coin info requests
MAX_CONCURRENT_TASKS = 5
# Balance update interval (5 sec)
BALANCE_UPDATE_INTERVAL = 5