Includes: Bitfinex API integration, technical indicators, LLM signal generation, risk management, Slack notifications. Recent fixes: - SELL orders use position value instead of total balance - SELL signals always close full position - Failed orders added to rejected list for Slack reporting - Position/exposure limits auto-cap to remaining room - BUY order minimum raised to 10% of portfolio Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
57 lines
1.7 KiB
Python
57 lines
1.7 KiB
Python
import os
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
# Bitfinex API
|
|
BFX_API_KEY = os.getenv("BFX_API_KEY", "")
|
|
BFX_API_SECRET = os.getenv("BFX_API_SECRET", "")
|
|
BFX_BASE_URL = "https://api-pub.bitfinex.com"
|
|
BFX_AUTH_URL = "https://api.bitfinex.com"
|
|
|
|
# Slack
|
|
SLACK_WEBHOOK_URL = os.getenv("SLACK_WEBHOOK_URL", "")
|
|
|
|
# Top USDT trading pairs on Bitfinex (verified active)
|
|
# Note: some use "tXXXUST" format, others use "tXXX:UST" (5+ char base)
|
|
TOP_15_SYMBOLS = [
|
|
"tBTCUST", "tETHUST", "tSOLUST", "tXRPUST", "tADAUST",
|
|
"tDOGE:UST", "tAVAX:UST", "tDOTUST", "tLINK:UST", "tLTCUST",
|
|
"tSHIB:UST", "tATOUST", "tUNIUST", "tSUIUST", "tXLMUST",
|
|
]
|
|
|
|
# Symbol display names for readability
|
|
SYMBOL_NAMES = {
|
|
"tBTCUST": "BTC/USDT", "tETHUST": "ETH/USDT", "tSOLUST": "SOL/USDT",
|
|
"tXRPUST": "XRP/USDT", "tADAUST": "ADA/USDT", "tDOGE:UST": "DOGE/USDT",
|
|
"tAVAX:UST": "AVAX/USDT", "tDOTUST": "DOT/USDT", "tLINK:UST": "LINK/USDT",
|
|
"tLTCUST": "LTC/USDT", "tSHIB:UST": "SHIB/USDT", "tATOUST": "ATOM/USDT",
|
|
"tUNIUST": "UNI/USDT", "tSUIUST": "SUI/USDT", "tXLMUST": "XLM/USDT",
|
|
}
|
|
|
|
# Candle settings
|
|
CANDLE_TIMEFRAME = "5m"
|
|
CANDLE_LIMIT = 100
|
|
|
|
# Trading parameters
|
|
MIN_ORDER_USDT = 5
|
|
STOP_LOSS_PCT = 0.02
|
|
TAKE_PROFIT_PCT = 0.03
|
|
MAX_POSITION_PCT = 0.30 # Max 30% of portfolio per coin
|
|
MAX_TOTAL_EXPOSURE_PCT = 1.00 # No cap — use full balance
|
|
|
|
# Mode
|
|
PAPER_TRADING = os.getenv("PAPER_TRADING", "true").lower() == "true"
|
|
|
|
# Cache
|
|
CACHE_DIR = "cache/"
|
|
CANDLES_CACHE_DIR = os.path.join(CACHE_DIR, "candles/")
|
|
INDICATORS_CACHE_DIR = os.path.join(CACHE_DIR, "indicators/")
|
|
|
|
# Positions file
|
|
POSITIONS_FILE = "positions.json"
|
|
|
|
# Schedule
|
|
RUN_INTERVAL_MINUTES = 5
|
|
STATUS_REPORT_INTERVAL_MINUTES = 60
|