ScottfreeLLC / AlphaPy

Python AutoML for Trading Systems and Sports Betting
Apache License 2.0
1.11k stars 201 forks source link

KeyError: 'fb_stock_prices_1d' #8

Closed volkan closed 7 years ago

volkan commented 7 years ago

I am working on "Trading System" with this as an example https://www.linkedin.com/pulse/developing-trading-system-alphapy-mark-conway but I am getting this error;

short;

[06/25/17 03:21:33] INFO    Getting fb data for last 1000 days
[06/25/17 03:21:33] INFO    Could not retrieve data for: fb
[06/25/17 03:21:33] INFO    No DataFrame for fb
[06/25/17 03:21:33] INFO    Getting nflx data for last 1000 days
[06/25/17 03:21:33] INFO    Could not retrieve data for: nflx
[06/25/17 03:21:33] INFO    No DataFrame for nflx
[06/25/17 03:21:33] INFO    Getting aapl data for last 1000 days
[06/25/17 03:21:33] INFO    Could not retrieve data for: aapl
[06/25/17 03:21:33] INFO    No DataFrame for aapl
[06/25/17 03:21:33] INFO    Getting amzn data for last 1000 days
[06/25/17 03:21:33] INFO    Could not retrieve data for: amzn
[06/25/17 03:21:33] INFO    No DataFrame for amzn
[06/25/17 03:21:33] INFO    Getting googl data for last 1000 days
[06/25/17 03:21:33] INFO    Could not retrieve data for: googl
[06/25/17 03:21:33] INFO    No DataFrame for googl

Long;

--> mflow --pdate 2017-01-01
None
/Users/user/.virtualenvs/ml/lib/python2.7/site-packages/IPython/html.py:14: ShimWarning: The `IPython.html` package has been deprecated since IPython 4.0. You should import from `notebook` instead. `IPython.html.widgets` has moved to `ipywidgets`.
  "`IPython.html.widgets` has moved to `ipywidgets`.", ShimWarning)
/Users/user/.virtualenvs/ml/lib/python2.7/site-packages/sklearn/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
  "This module will be removed in 0.20.", DeprecationWarning)
/Users/user/.virtualenvs/ml/lib/python2.7/site-packages/sklearn/learning_curve.py:23: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the functions are moved. This module will be removed in 0.20
  DeprecationWarning)
[06/25/17 03:21:33] INFO    ********************************************************************************
[06/25/17 03:21:33] INFO    MarketFlow Start
[06/25/17 03:21:33] INFO    ********************************************************************************
[06/25/17 03:21:33] INFO    Training Date: 1900-01-01
[06/25/17 03:21:33] INFO    Prediction Date: 2017-01-01
[06/25/17 03:21:33] INFO    MarketFlow Configuration
[06/25/17 03:21:33] INFO    Getting Features
[06/25/17 03:21:33] INFO    Defining Groups
[06/25/17 03:21:33] INFO    Added: set(['fb', 'nflx', 'aapl', 'amzn', 'googl'])
[06/25/17 03:21:33] INFO    Defining Aliases
[06/25/17 03:21:33] INFO    Getting System Parameters
[06/25/17 03:21:33] INFO    Defining Variables
[06/25/17 03:21:33] INFO    No Variables Found
[06/25/17 03:21:33] INFO    Getting Variable Functions
[06/25/17 03:21:33] INFO    No Variable Functions Found
[06/25/17 03:21:33] INFO    MARKET PARAMETERS:
[06/25/17 03:21:33] INFO    features        = ['hc', 'lc']
[06/25/17 03:21:33] INFO    forecast_period = 1
[06/25/17 03:21:33] INFO    fractal         = 1d
[06/25/17 03:21:33] INFO    leaders         = []
[06/25/17 03:21:33] INFO    data_history    = 1000
[06/25/17 03:21:33] INFO    predict_history = 50
[06/25/17 03:21:33] INFO    schema          = prices
[06/25/17 03:21:33] INFO    system          = {'scale': False, 'shortentry': 'lc', 'name': 'closer', 'shortexit': None, 'longexit': None, 'longentry': 'hc', 'holdperiod': 0}
[06/25/17 03:21:33] INFO    target_group    = faang
[06/25/17 03:21:33] INFO    Model Configuration
[06/25/17 03:21:33] INFO    No Treatments Found
[06/25/17 03:21:33] INFO    MODEL PARAMETERS:
[06/25/17 03:21:33] INFO    algorithms        = ['XGB']
[06/25/17 03:21:33] INFO    balance_classes   = True
[06/25/17 03:21:33] INFO    calibration       = False
[06/25/17 03:21:33] INFO    cal_type          = sigmoid
[06/25/17 03:21:33] INFO    calibration_plot  = False
[06/25/17 03:21:33] INFO    clustering        = False
[06/25/17 03:21:33] INFO    cluster_inc       = 3
[06/25/17 03:21:33] INFO    cluster_max       = 30
[06/25/17 03:21:33] INFO    cluster_min       = 3
[06/25/17 03:21:33] INFO    confusion_matrix  = True
[06/25/17 03:21:33] INFO    counts            = False
[06/25/17 03:21:33] INFO    cv_folds          = 3
[06/25/17 03:21:33] INFO    directory         = .
[06/25/17 03:21:33] INFO    extension         = csv
[06/25/17 03:21:33] INFO    drop              = ['date', 'tag', 'open', 'high', 'low', 'close', 'adjclose']
[06/25/17 03:21:33] INFO    encoder           = <Encoders.factorize: 3>
[06/25/17 03:21:33] INFO    esr               = 30
[06/25/17 03:21:33] INFO    factors           = []
[06/25/17 03:21:33] INFO    features [X]      = *
[06/25/17 03:21:33] INFO    feature_selection = False
[06/25/17 03:21:33] INFO    fs_percentage     = 10
[06/25/17 03:21:33] INFO    fs_score_func     = <function f_classif at 0x10e1861b8>
[06/25/17 03:21:33] INFO    fs_uni_grid       = [5, 10, 15, 20, 25]
[06/25/17 03:21:33] INFO    grid_search       = False
[06/25/17 03:21:33] INFO    gs_iters          = 100
[06/25/17 03:21:33] INFO    gs_random         = True
[06/25/17 03:21:33] INFO    gs_sample         = True
[06/25/17 03:21:33] INFO    gs_sample_pct     = 0.250000
[06/25/17 03:21:33] INFO    importances       = True
[06/25/17 03:21:33] INFO    interactions      = True
[06/25/17 03:21:33] INFO    isomap            = False
[06/25/17 03:21:33] INFO    iso_components    = 2
[06/25/17 03:21:33] INFO    iso_neighbors     = 5
[06/25/17 03:21:33] INFO    isample_pct       = 5
[06/25/17 03:21:33] INFO    learning_curve    = True
[06/25/17 03:21:33] INFO    logtransform      = False
[06/25/17 03:21:33] INFO    lv_remove         = True
[06/25/17 03:21:33] INFO    lv_threshold      = 0.100000
[06/25/17 03:21:33] INFO    model_type        = <ModelType.classification: 1>
[06/25/17 03:21:33] INFO    n_estimators      = 501
[06/25/17 03:21:33] INFO    n_jobs            = -1
[06/25/17 03:21:33] INFO    ngrams_max        = 1
[06/25/17 03:21:33] INFO    numpy             = False
[06/25/17 03:21:33] INFO    pca               = False
[06/25/17 03:21:33] INFO    pca_inc           = 3
[06/25/17 03:21:33] INFO    pca_max           = 15
[06/25/17 03:21:33] INFO    pca_min           = 3
[06/25/17 03:21:33] INFO    pca_whiten        = False
[06/25/17 03:21:33] INFO    poly_degree       = 2
[06/25/17 03:21:33] INFO    pvalue_level      = 0.010000
[06/25/17 03:21:33] INFO    rfe               = False
[06/25/17 03:21:33] INFO    rfe_step          = 10
[06/25/17 03:21:33] INFO    roc_curve         = True
[06/25/17 03:21:33] INFO    rounding          = 3
[06/25/17 03:21:33] INFO    sampling          = True
[06/25/17 03:21:33] INFO    sampling_method   = <SamplingMethod.under_random: 12>
[06/25/17 03:21:33] INFO    sampling_ratio    = 0.500000
[06/25/17 03:21:33] INFO    scaler_option     = True
[06/25/17 03:21:33] INFO    scaler_type       = <Scalers.standard: 2>
[06/25/17 03:21:33] INFO    scipy             = False
[06/25/17 03:21:33] INFO    scorer            = roc_auc
[06/25/17 03:21:33] INFO    seed              = 10231
[06/25/17 03:21:33] INFO    sentinel          = -1
[06/25/17 03:21:33] INFO    separator         = ,
[06/25/17 03:21:33] INFO    shuffle           = True
[06/25/17 03:21:33] INFO    split             = 0.400000
[06/25/17 03:21:33] INFO    submission_file   = None
[06/25/17 03:21:33] INFO    submit_probas     = False
[06/25/17 03:21:33] INFO    target [y]        = wr
[06/25/17 03:21:33] INFO    target_value      = 1
[06/25/17 03:21:33] INFO    treatments        = None
[06/25/17 03:21:33] INFO    tsne              = False
[06/25/17 03:21:33] INFO    tsne_components   = 2
[06/25/17 03:21:33] INFO    tsne_learn_rate   = 1000.000000
[06/25/17 03:21:33] INFO    tsne_perplexity   = 30.000000
[06/25/17 03:21:33] INFO    vectorize         = False
[06/25/17 03:21:33] INFO    verbosity         = 1
[06/25/17 03:21:33] INFO    Creating directory ./data
[06/25/17 03:21:33] INFO    Creating directory ./input
[06/25/17 03:21:33] INFO    Creating directory ./model
[06/25/17 03:21:33] INFO    Creating directory ./output
[06/25/17 03:21:33] INFO    Creating directory ./plots
[06/25/17 03:21:33] INFO    Creating directory ./systems
[06/25/17 03:21:33] INFO    Creating Model
[06/25/17 03:21:33] INFO    Running MarketFlow Pipeline
[06/25/17 03:21:33] INFO    Running Long/Short System closer
[06/25/17 03:21:33] INFO    All Members: set(['fb', 'nflx', 'aapl', 'amzn', 'googl'])
[06/25/17 03:21:33] INFO    Getting Daily Data
[06/25/17 03:21:33] INFO    Getting fb data for last 1000 days
[06/25/17 03:21:33] INFO    Could not retrieve data for: fb
[06/25/17 03:21:33] INFO    No DataFrame for fb
[06/25/17 03:21:33] INFO    Getting nflx data for last 1000 days
[06/25/17 03:21:33] INFO    Could not retrieve data for: nflx
[06/25/17 03:21:33] INFO    No DataFrame for nflx
[06/25/17 03:21:33] INFO    Getting aapl data for last 1000 days
[06/25/17 03:21:33] INFO    Could not retrieve data for: aapl
[06/25/17 03:21:33] INFO    No DataFrame for aapl
[06/25/17 03:21:33] INFO    Getting amzn data for last 1000 days
[06/25/17 03:21:33] INFO    Could not retrieve data for: amzn
[06/25/17 03:21:33] INFO    No DataFrame for amzn
[06/25/17 03:21:33] INFO    Getting googl data for last 1000 days
[06/25/17 03:21:33] INFO    Could not retrieve data for: googl
[06/25/17 03:21:33] INFO    No DataFrame for googl
[06/25/17 03:21:33] INFO    Applying variable: hc
[06/25/17 03:21:33] INFO    Applying variable: lc
[06/25/17 03:21:33] INFO    Applying variable: wr
[06/25/17 03:21:33] INFO    Generating Trades for System closer
Traceback (most recent call last):
  File "/Users/user/.virtualenvs/ml/bin/mflow", line 11, in <module>
    load_entry_point('alphapy==2.0.1', 'console_scripts', 'mflow')()
  File "build/bdist.macosx-10.11-x86_64/egg/alphapy/market_flow.py", line 379, in main
  File "build/bdist.macosx-10.11-x86_64/egg/alphapy/market_flow.py", line 264, in market_pipeline
  File "build/bdist.macosx-10.11-x86_64/egg/alphapy/system.py", line 418, in run_system
  File "build/bdist.macosx-10.11-x86_64/egg/alphapy/system.py", line 174, in long_short
KeyError: 'fb_stock_prices_1d'

I think Daily Data doesn't exist. Could you please give me example data list.

Thanks,

mrconway commented 7 years ago

Hi @volkan, I just updated the example market.yml files to use google as the default schema for getting daily stock prices (see below):

market:
    data_history    : 1000
    forecast_period : 1
    fractal         : 1d
    leaders         : []
    predict_history : 50
    schema          : google
    target_group    : faang
volkan commented 7 years ago

Hi @mrconway, thanks, it is working.