-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathverify_task1.py
More file actions
53 lines (42 loc) · 1.68 KB
/
Copy pathverify_task1.py
File metadata and controls
53 lines (42 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python
"""
Verification script for Task 1: Price Structure Features
"""
import sys
import os
# Add project root to path
project_root = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, project_root)
def main():
try:
from src.features.regime_features import PriceStructureFeatures
print("✓ Successfully imported PriceStructureFeatures")
pf = PriceStructureFeatures()
print("✓ Successfully created PriceStructureFeatures instance")
# Test with SPY
features = pf.calculate('SPY')
print(f"✓ Features calculated for SPY: shape {features.shape}")
print(f"✓ Columns: {list(features.columns)}")
# Verify shape
assert features.shape[1] == 6, f"Expected 6 features, got {features.shape[1]}"
print("✓ Correct number of features (6)")
# Verify column names
expected_columns = [
'price_vs_sma20', 'price_vs_sma50', 'price_vs_sma200',
'distance_from_52w_high', 'distance_from_52w_low', 'gap_percentage'
]
assert list(features.columns) == expected_columns, "Column names mismatch"
print("✓ Correct column names")
# Check for NaNs
assert not features.isnull().any().any(), "Features contain NaN values"
print("✓ No NaN values")
print("\n🎉 Task 1 verification PASSED!")
print(f"Price structure features successfully return {features.shape[1]} normalized dimensions for SPY")
except Exception as e:
print(f"❌ Task 1 verification FAILED: {e}")
import traceback
traceback.print_exc()
return False
return True
if __name__ == "__main__":
main()