oceanprotocol / pdr-backend

Instructions & code to run predictoors, traders, more.
Apache License 2.0
26 stars 21 forks source link

ARIMA-style feed analysis: for {BoxCox=T/F, diff=0,1,2}, plot the seasonality and ACF/PACF #1009

Closed trentmc closed 2 months ago

trentmc commented 3 months ago

Background / motivation

Parent epic: #1006 "Explore SARIMAX modeling"

Top-level goal: Help user answer which of which transform to use {0, B0, B1, B2}, to (a) achieve stationarity; and (b) see how well the signal can decompose into trend / seasonal / residual.

Specific transforms:

Sub-goals: We want it easy to see these:

Best ref: jahnvisikligar Master's thesis https://github.com/jahnvisikligar/Masters-Thesis/blob/main/Final_Thesis_code.ipynb

TODOs / DoD

Main prototype: with everything

For a given choice of differencing {0,B0,B1,B2}, show

Scan 11  May 2024, 10 55 page 2

Other Prototypes & Examples

Prototype: decomposition into trend / seasonality / residual

329284278-d9bbecce-9f5f-415f-be6e-c8da6d5d04b5

Prototype: For differencing=0,B0,B1,B2, show 5 decomposition plots

Scan 11  May 2024, 10 55 page 1

Prototype: For differencing=0,B0,B1,B2, show ACF & PACF

1011

Example 0: neptune.ai "select model"

Ref: neptune.ai select-model post

from statsmodels.tsa.seasonal import seasonal_decompose
result = seasonal_decompose(co2_data)
result.plot()

example0

Example 1a: Sikligar thesis, Differencing=0

Ref: Sikligar thesis & code

example1a-differencing0

Example 1b: Sikligar thesis, Differencing=1

Ref: Sikligar thesis & code

example1b-differencing1

Example 2: neptune.ai catfish sales

result = seasonal_decompose(lim_catfish_sales,model='additive')
fig = result.plot()

Ref: neptune.ai catfish, in this neptune.ai post/py code.

example2

trentmc commented 3 months ago

Seasonal decomposition of Binance BTC/USDT close price Feb 1, 2024 - Mar 8, 2024

Screenshot 2024-05-10 at 11 22 22

trentmc commented 3 months ago

Part 1 done here: https://github.com/oceanprotocol/pdr-backend/pull/1016

trentmc commented 3 months ago

Results for data: merged_ohlcv_df_BTC-ETH_2024-02-01_to_2024-03-08.csv, using BTC/USDT c 5m.

BoxCox=F, diff=0

Screenshot 2024-05-13 at 09 11 52

BoxCox=T, diff=0

Screenshot 2024-05-11 at 21 31 33

BoxCox=T, diff=1

Screenshot 2024-05-13 at 09 12 09