-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
21 lines (18 loc) · 1.1 KB
/
main.py
File metadata and controls
21 lines (18 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import functions
# INPUT PARAMETERS
TICKER_SYMBOL = "AAPL" # Ticker symbol of selected stock
START_DATE = "2020-01-01" # Start date of historical data in 'YYYY-MM-DD' format
END_DATE = "2023-12-31" # End date of historical data in 'YYYY-MM-DD' format
CUTOFF_FREQ = 0.01 # Cutoff frequency for the low-pass filter
SAMPLE_RATE = 1 # Sampling rate of the input data
ORDER = 4 # Order of the Butterworth filter
TIME_DELAY_PARAMETER = 25 # Time delay parameter of phase space embedding
if __name__ == '__main__':
data = functions.get_yahoo_finance_data(TICKER_SYMBOL, START_DATE, END_DATE)
close_prices = data['Close']
filtered_close_prices = functions.low_pass_filter(close_prices, CUTOFF_FREQ, SAMPLE_RATE, ORDER)
print(data.head())
functions.plot_timeseries(data, TICKER_SYMBOL)
functions.plot_filtered_timeseries(data, filtered_close_prices, TICKER_SYMBOL)
functions.plot_3d_phase_space(close_prices, TIME_DELAY_PARAMETER, TICKER_SYMBOL)
functions.plot_3d_phase_space_of_filtered_data(filtered_close_prices, TIME_DELAY_PARAMETER, TICKER_SYMBOL)