bifitnex-trading/config.py
kroutony 1abfdefecd Add advanced indicators: MTF analysis, ADX, StochRSI, OBV, CMF, pivot points
- config.py: Add HTF_TIMEFRAME (1h) and HTF_CANDLE_LIMIT (50)
- data_fetcher.py: Fetch both 5m and 1h candles per symbol
- indicators.py: Add ADX, StochRSI, OBV+slope, CMF to 5m indicators;
  new functions for HTF indicators, pivot points, and their summaries
- main.py: Wire up HTF data flow (1h indicators + pivots → LLM summary)
- llm_analyzer.py: Rewrite prompt with MTF filter (1h trend alignment),
  require 2+ confirmations for BUY, confidence scoring guide

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 03:26:59 +00:00

70 lines
2.1 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
HTF_TIMEFRAME = "1h"
HTF_CANDLE_LIMIT = 50
# Trading parameters
MIN_ORDER_USDT = 5
MIN_ORDER_AMOUNT = {
"tBTCUST": 0.00004, "tETHUST": 0.0008, "tDOTUST": 0.2,
"tSUIUST": 2.0, "tSOLUST": 0.02, "tLTCUST": 0.04,
"tADAUST": 4.0, "tAVAX:UST": 0.08, "tUNIUST": 0.2,
"tLINK:UST": 0.2, "tXRPUST": 4.0, "tSHIB:UST": 141010.0,
"tDOGE:UST": 22.0, "tATOUST": 0.02, "tXLMUST": 4.0,
}
STOP_LOSS_PCT = 0.03
TAKE_PROFIT_PCT = 0.05
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"
# Cost basis sync
COST_TRACKING_FILE = "cost_tracking.json"
INIT_COST_BASIS_START_MS = 1773244800000 # 2026-03-11 00:00:00 +08:00
# Schedule
RUN_INTERVAL_MINUTES = 5
STATUS_REPORT_INTERVAL_MINUTES = 60