Files
StockBackTester/smoke_test.py

14 lines
511 B
Python

import pandas as pd
import numpy as np
from strategy import compute_last_peak_series
# 간단한 High 시퀀스에서 피크가 있는 위치를 만들고 함수 동작 확인
dates = pd.date_range('2023-01-01', periods=20)
highs = np.array([10,11,12,11,13,12,14,13,12,15,14,13,16,15,14,17,16,15,18,17], dtype=float)
df = pd.DataFrame({'High': highs}, index=dates)
last_peaks = compute_last_peak_series(df, period=5)
print('High:\n', df['High'].to_list())
print('\nLAST_PEAK series:\n', last_peaks.tolist())