Add check_symbols.py for ETH perpetuals filtering and enhance backtester with size handling
- Introduced `check_symbols.py` to load and filter ETH perpetual markets from the OKX exchange using CCXT. - Updated the backtester to normalize signals to a 5-tuple format, incorporating size management for trades. - Enhanced portfolio functions to support variable size and leverage adjustments based on initial capital. - Added a new method in `CryptoQuantClient` for chunked historical data fetching to avoid API limits. - Improved market symbol normalization in `market.py` to handle different formats. - Updated regime strategy parameters based on recent research findings for optimal performance.
This commit is contained in:
@@ -94,8 +94,20 @@ def get_ccxt_symbol(symbol: str, market_type: MarketType) -> str:
|
||||
"""
|
||||
if market_type == MarketType.PERPETUAL:
|
||||
# OKX perpetual format: BTC/USDT:USDT
|
||||
quote = symbol.split('/')[1] if '/' in symbol else 'USDT'
|
||||
return f"{symbol}:{quote}"
|
||||
if '/' in symbol:
|
||||
base, quote = symbol.split('/')
|
||||
return f"{symbol}:{quote}"
|
||||
elif '-' in symbol:
|
||||
base, quote = symbol.split('-')
|
||||
return f"{base}/{quote}:{quote}"
|
||||
else:
|
||||
# Assume base is symbol, quote is USDT default
|
||||
return f"{symbol}/USDT:USDT"
|
||||
|
||||
# For spot, normalize dash to slash for CCXT
|
||||
if '-' in symbol:
|
||||
return symbol.replace('-', '/')
|
||||
|
||||
return symbol
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user