fix refactoring

This commit is contained in:
Dobromir Popov 2025-03-10 16:38:37 +02:00
parent e884f0c9e6
commit 08b8da7c8f

View File

@ -430,6 +430,11 @@ class TradingEnvironment:
"""Update technical indicators with new data"""
self._initialize_features() # Recalculate all features
async def fetch_new_data(env, exchange, symbol="ETH/USDT", timeframe="1m", limit=1000):
"""Fetch new data for the environment"""
# Call the environment's fetch_initial_data method
return await env.fetch_initial_data(exchange, symbol, timeframe, limit)
async def fetch_initial_data(self, exchange, symbol="ETH/USDT", timeframe="1m", limit=1000):
"""Fetch initial historical data for the environment"""
try:
@ -2345,6 +2350,7 @@ async def get_latest_candle(exchange, symbol):
logger.error(f"Failed to fetch latest candle: {e}")
return None
async def fetch_ohlcv_data(exchange, symbol, timeframe, limit):
"""Fetch OHLCV data with proper handling for both async and standard CCXT"""
try: