Skip to content

💰 ingest, model, forecast, 💰! ...but also I'm just learning Luigi

Notifications You must be signed in to change notification settings

7yl4r/crypto-forcast

Repository files navigation

The idea here is pretty simple:

  1. ingest time-series data
  2. create forecast classifier(s)
  3. predict on current data
  4. profit!

Usage:

catalyst install reqs:

sudo apt-get install libatlas-base-dev python-dev gfortran pkg-config libfreetype6-dev
python3 -m venv ./venv
source venv/bin/activate
pip install -r requirements.txt
luigid  # to start the scheduler
python CryptoForecast/run_luigi.py MyTaskName

Sample config:

"""
Configuration options
"""

# Common
data_dir = "data-dir"
plot_dir = "plot-dir"
fig_size = (12, 8)

tradeAmount = 1
fidelity = 86400 # in seconds

# Backtesting
assets = {'usd': 0, 'btc': 10, 'eth': 0}

# Bollinger strategy
ewmInterval = 86400 * 20 # in seconds
stdK = 1.2

Implementation plan:

  1. pick a primary model
  2. reproduce model results on test set
  3. attempt to model on (manually curated) new data
  4. implement ingestion script once model fits reasonably well

Points of Organization:

Task Classes

  1. Subdirs of CryptoForecast each represent different data sources.
  2. Each subdir contains a hierarchy organized by pipeline stage. The stages are:
    1. ingest : incoming data downloads
    2. preprocess : steps taken to massage data into proper format
    3. analyze : standard data summary methods to inform model selection
    4. model : creation & testing of various models
    5. forecast : use of models to predict future values ()
    6. action-plan : use of forecasts to plan actions (buy/sell)
  3. Common task base/abstract classes are in ./common/
  4. Tasks which extend common tasks should be named {DATA_SOURCE}{PARENT_TASK}; example: BTC + Seasonal = BTCSeasonal.

Data

  1. LocalTarget outputs should have file names similar to their task classes.
  2. all LocalTargets shall be placed under ./data
  3. Time-series shall be sampled or interpolated to daily frequency.

Ideas

legend

  • ⌛ in-progress
  • ✅ done
  • 🚫 fail

ingest

Hmm... what data to ingest... How about:

  1. ⌛ historical self-values (eg autoregression)
    1. http://api.bitcoincharts.com/v1/csv/
    2. more suggestions on this SO answer
  2. ⌛ historical values of other crypto-currencies (CCF might be useful here if one lags the other)
  3. google trends data using
    1. pytrends
    2. unofficial trends api
    3. trends csv downloader
  4. sentiment analysis
    1. twitter ingest (NLP sold separately)
  5. stack overflow activity ( ethereum / monero communities or question volumes on s.o. itself )
  6. crypto-mining hardware release schedules
  7. crypto-mining profitablity recomendation calculators
    1. like coinwarz profit ratio charts
  8. mean/median transaction fees like bitinfocharts
  9. Hash rates & difficulties like this from bitcoinwisdom
  10. of pending transactions

    1. etherscan.io

Exogenous Evaluation Methods

  1. granger causality test (and similar)
    1. statsmodels grangercausalitytests
    2. pretty causality matrix from nitime
    3. granger causality on non-stationary data
    4. other causality predictor(s) from kaggle cause-effect-pairs
    5. MVGC method)
  2. ⌛ cross-correlation function

pre-processing

  1. USD values could be adjusted using CPI values from bls.gov data
  2. generate stationary series for modeling
    1. ⌛ differencing

Analysis

  1. ✅ frequency analysis
    1. ✅ FFT
    2. ✅ seasonal decomposition
    3. ⌛ ACF & PACF

Modeling

Time series models... For these I like:

  1. Long short-term memory NN (LSTM NN) built on
    1. keras:
      1. jaungier's
      2. + recurrent
      3. another w/ recurrent
      4. + sequential model
    2. theano:
      1. jgpavez
    3. custom:
      1. CasiaFan
  2. Fuzzy Time Series Predictions
    1. asiviero
  3. ⌛ good ol' fashioned autoregressors
    1. ✅ my old behavAR project
      1. also see this script
    2. ⌛ ARIMA / ARIMAX
      1. ⌛ statsmodels ARIMAX (SARIMAX?)
      2. fb prophet ARIMA / exp smoothing

Action-plan

  1. backtesting
    1. pyAlgoTrade
  2. exchange api
    1. ccxt

About

💰 ingest, model, forecast, 💰! ...but also I'm just learning Luigi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published