import pandas as pd import numpy as np import sys import os # Add project root to path sys.path.append(os.getcwd()) from src.core.market_profile import MarketProfile def test_market_profile(): print("Testing MarketProfile...") mp = MarketProfile(multiplier=2.0) # Create dummy data # Price oscillates between 100 and 110 dates = pd.date_range(start='2024-01-01 10:00', periods=100, freq='1min') bids = np.linspace(100, 110, 50) bids = np.concatenate((bids, np.linspace(110, 100, 50))) df = pd.DataFrame({ 'datetime': dates, 'bid': bids, 'ask': bids + 0.1 }) # Update profile mp.update(df) # Check counts print(f"Total ticks: {mp.total_ticks}") print(f"Counts keys: {len(mp.counts)}") # Check Levels vah, val, poc = mp.get_vah_val_poc() print(f"VAH: {vah}, VAL: {val}, POC: {poc}") if vah is None or val is None or poc is None: print("FAIL: Levels are None") else: print("PASS: Levels calculated") if __name__ == "__main__": test_market_profile()