fix refactoring
This commit is contained in:
parent
e884f0c9e6
commit
08b8da7c8f
@ -429,7 +429,12 @@ class TradingEnvironment:
|
|||||||
def _update_features(self):
|
def _update_features(self):
|
||||||
"""Update technical indicators with new data"""
|
"""Update technical indicators with new data"""
|
||||||
self._initialize_features() # Recalculate all features
|
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):
|
async def fetch_initial_data(self, exchange, symbol="ETH/USDT", timeframe="1m", limit=1000):
|
||||||
"""Fetch initial historical data for the environment"""
|
"""Fetch initial historical data for the environment"""
|
||||||
try:
|
try:
|
||||||
@ -2344,6 +2349,7 @@ async def get_latest_candle(exchange, symbol):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to fetch latest candle: {e}")
|
logger.error(f"Failed to fetch latest candle: {e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
async def fetch_ohlcv_data(exchange, symbol, timeframe, limit):
|
async def fetch_ohlcv_data(exchange, symbol, timeframe, limit):
|
||||||
"""Fetch OHLCV data with proper handling for both async and standard CCXT"""
|
"""Fetch OHLCV data with proper handling for both async and standard CCXT"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user