cleanup and removed dummy data
This commit is contained in:
@ -114,42 +114,32 @@ class BaseDataInput:
|
||||
FIXED_FEATURE_SIZE = 7850
|
||||
features = []
|
||||
|
||||
# OHLCV features for ETH (300 frames x 4 timeframes x 5 features = 6000 features)
|
||||
# OHLCV features for ETH (up to 300 frames x 4 timeframes x 5 features)
|
||||
for ohlcv_list in [self.ohlcv_1s, self.ohlcv_1m, self.ohlcv_1h, self.ohlcv_1d]:
|
||||
# Ensure exactly 300 frames by padding or truncating
|
||||
# Use actual data only, up to 300 frames
|
||||
ohlcv_frames = ohlcv_list[-300:] if len(ohlcv_list) >= 300 else ohlcv_list
|
||||
|
||||
# Pad with zeros if not enough data
|
||||
while len(ohlcv_frames) < 300:
|
||||
# Create a dummy OHLCV bar with zeros
|
||||
dummy_bar = OHLCVBar(
|
||||
symbol="ETH/USDT",
|
||||
timestamp=datetime.now(),
|
||||
open=0.0, high=0.0, low=0.0, close=0.0, volume=0.0,
|
||||
timeframe="1s"
|
||||
)
|
||||
ohlcv_frames.insert(0, dummy_bar)
|
||||
|
||||
# Extract features from exactly 300 frames
|
||||
# Extract features from actual frames
|
||||
for bar in ohlcv_frames:
|
||||
features.extend([bar.open, bar.high, bar.low, bar.close, bar.volume])
|
||||
|
||||
# Pad with zeros only if we have some data but less than 300 frames
|
||||
frames_needed = 300 - len(ohlcv_frames)
|
||||
if frames_needed > 0:
|
||||
features.extend([0.0] * (frames_needed * 5)) # 5 features per frame
|
||||
|
||||
# BTC OHLCV features (300 frames x 5 features = 1500 features)
|
||||
# BTC OHLCV features (up to 300 frames x 5 features = 1500 features)
|
||||
btc_frames = self.btc_ohlcv_1s[-300:] if len(self.btc_ohlcv_1s) >= 300 else self.btc_ohlcv_1s
|
||||
|
||||
# Pad BTC data if needed
|
||||
while len(btc_frames) < 300:
|
||||
dummy_bar = OHLCVBar(
|
||||
symbol="BTC/USDT",
|
||||
timestamp=datetime.now(),
|
||||
open=0.0, high=0.0, low=0.0, close=0.0, volume=0.0,
|
||||
timeframe="1s"
|
||||
)
|
||||
btc_frames.insert(0, dummy_bar)
|
||||
|
||||
# Extract features from actual BTC frames
|
||||
for bar in btc_frames:
|
||||
features.extend([bar.open, bar.high, bar.low, bar.close, bar.volume])
|
||||
|
||||
# Pad with zeros only if we have some data but less than 300 frames
|
||||
btc_frames_needed = 300 - len(btc_frames)
|
||||
if btc_frames_needed > 0:
|
||||
features.extend([0.0] * (btc_frames_needed * 5)) # 5 features per frame
|
||||
|
||||
# COB features (FIXED SIZE: 200 features)
|
||||
cob_features = []
|
||||
if self.cob_data:
|
||||
|
Reference in New Issue
Block a user