-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindicator_test.py
More file actions
36 lines (25 loc) · 894 Bytes
/
indicator_test.py
File metadata and controls
36 lines (25 loc) · 894 Bytes
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
import os
import polars as pl
from chart_engine.chart import Chart
def test_indicators():
print("Testing Indicators with Rust Backend using 1d.parquet...")
# 1. Load data
parquet_path = "data/1d.parquet"
if not os.path.exists(parquet_path):
print(f"Error: {parquet_path} not found.")
return
df = pl.read_parquet(parquet_path)
print(f"✅ Loaded {len(df)} rows.")
# Use first 500 rows for initial batch
data_df = df.head(500)
chart = Chart(title="Indicator Test - Real Data")
series = chart.create_candlestick_series("Main Series", "chart-0")
series.set_auto_volume(False)
print("Adding SMA(14)...")
series.add_sma(period=14)
series.add_sma(period=50)
print("Setting data...")
series.set_data(data_df)
chart.show()
if __name__ == "__main__":
test_indicators()