Skip to main content

StockerMake: Modular Prototyping Tool for Stock Market Prediction Models

Installation

Install using pip installer.

pip install stockermake

Usage

The StockerMake Script

The StockerMake script combines the Stocker and helper modules into one to create an easy, convenient, and modular neural network prototyping tool designed for stock market prediction. The script will take the user's desired parameters and create, train, and evaluate a model fitting said parameters. This allows the user to quickly analyze model prototypes, make adjustments, and iterate on model designs.

Arguments:

Positional:
    key ---- User's Alpha_Vantage API key
    symbols ---- Ticker symbols to create models for

Optional:
    depth ---- number of layers to include in the neural network (def: 1)
    node_counts ---- list of node counts for layers (len(node_counts) must equal depth)
    batch ---- batch size of input data set (def: [100])
    test_size ---- proportion of dataset to use as validation (def: .2)
    loss ---- identifier string of keras-supported loss function to be used in training (def: mse)
    learning_rate ---- learning rate to be used by the Adam optimizer
    epochs ---- maximum number of epochs to train the model (def: 100)
    model_in ---- file path of pre-made model to load
    early_stop ---- flag deciding whether to apply early stopping (patience 5) to the training phase
    plots ---- flag deciding whether to save loss, input, and prediction graphs

Usage Example:

StockerMake APIKEY FORD MSFT --early_stop --plots

The above command will create, train, and evaluate a model for the FORD ticker. It saves a model FORD.h5 in directory ./models/ and input, loss, and prediction graphs in the directory ./plots/ for analysis.

The Stocker Module

If you would like to use your own data pipelines as inputs, the Stocker and data helper modules can be used separately from the main script.

from Stocker import *

""" Data operations (assign data, pred_data)
______________________________________________
"""

stkr = Stocker('FORD', data)
stkr.train(25, True, True))
stkr.evaluate()
stkr.save_model('./models/')
stkr.predict_data(pred_data)

The above code will take prepared data, create a stocker instance for the FORD ticker, train for 25 epochs, save the model to the models folder as FORD.h5 and predict a data point based on the user's prepared prediction data.

The Helpers module

This module includes the data operation helper functions used by Stocker.

daily_adjusted() returns a pandas dataframe of historical daily adjusted stock data.

single_step_data takes a full dataset and creates a single-step timeseries dataset from it for input into an LSTM model.

make_dir() is a filepath helper to assist with saving models.

Coming soon!

Stocker:

  • Support for more layer types
  • Multi-step future models
  • Optimizer customization
  • Customizable past-window (how far back to consider)

Helpers:

  • Data for multi-step prediction
  • Data normalization option
  • Compact (last 60) data

Contributions

Please send pull requests! I am a full-time student, so development and support for Stocker will likely be slow with me working alone. I welcome any and all efforts to contribute!

License

GNU LGPLv3

Release files for StockerMake 0.0.31

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for StockerMake 0.0.31
File Size Uploaded
StockerMake-0.0.31.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for StockerMake 0.0.31
File Interpreter ABI Platform
StockerMake-0.0.31-py3-none-any.whl Python 3 none any Details

Total release size: 18.2 kB

Release files / StockerMake-0.0.31.tar.gz

Download URL StockerMake-0.0.31.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
592816964e01823f3b47a07d5515da7e6bee8fd1536955e35bfa7dad4266d02d
BLAKE2b-256 checksum
How to use checksums
3fd8f97737bfb16a3f1fd04383404c16ea0ef6189af58a65a6e3aaf946e8ec69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9

Release files / StockerMake-0.0.31-py3-none-any.whl

Download URL StockerMake-0.0.31-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee8c06e355bbdb44a027a14193358733b75caee69ac5649ca0358ab2712dcc8e
BLAKE2b-256 checksum
How to use checksums
19e48bb18f4b38f86081630a68ca811253b0f61d879cb9501ea9de7db4caa742
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9

Release history Release notifications | RSS feed

This release

0.0.31 This release

2 release files

0.0.21

2 release files

0.0.20

2 release files

0.0.19

2 release files

0.0.18

2 release files

0.0.17

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page