Skip to content

ElementalPublishing/StockSim

Repository files navigation

StockSim

Monte Carlo Stock & Crypto Price Simulation Tool

StockSim is a Python command-line tool for estimating the probability of gain for stocks, cryptocurrencies, or indices using Monte Carlo simulation and real historical data.


Features

  • Simulate future price paths for stocks, crypto, or indices
  • Uses real historical data via yfinance
  • Multiprocessing for fast simulations
  • Command-line interface

Requirements

  • Python 3.7–3.12 (not compatible with Python 3.13)
  • See requirements.txt for required packages

Installation

From PyPI (recommended)

pip install stocksim

From source

git clone https://github.com/ElementalPublishing/StockSim.git
cd StockSim
pip install -e .

Usage

After installation, run from the command line:

stocksim

Or, if running from source:

python -m stocksim.main

Command-Line Options

You can run StockSim with the following options:

  • --symbol
    Ticker symbol (e.g., BTC-USD, ETH-USD, AAPL, SPX:IND, EURUSD:CUR)

  • --years
    Investment period in years (e.g., 1)

  • --simsize
    Simulation size: small, medium, or large

Examples:

stocksim --symbol BTC-USD --years 5 --simsize large
stocksim --symbol AAPL --years 3 --simsize medium

If you omit any option, the program will prompt you for input interactively.


Build Windows Executable (Optional)

To build a Windows executable with your custom icon:

pyinstaller --icon=shaggy.ico --name=StockSim stocksim/main.py
  • The EXE will be in the dist folder as StockSim.exe.

Notes

  • Compatible with Python 3.7–3.12, PyInstaller 5.13.2, and setuptools <80 (tested with 79.0.1).
  • Note: Logging to files has been removed due to compatibility issues. All output is now printed to the console.
  • For issues or feature requests, please use the GitHub Issue Tracker.

Note:
If you get a 'stocksim' is not recognized as an internal or external command error, you may need to add your Python Scripts directory to your system PATH.

For a typical Python installation on Windows, add:

C:\Users\<YourUser>\AppData\Local\Programs\Python\<Your Python Version>\Scripts

(Replace <YourUser> with your actual username and <Your Python Version> with your installed Python version, e.g., Python312.)

After updating your PATH, restart your terminal or Command Prompt and try running stocksim again.

Windows users: C++ Compiler Required

If you see an error like "Microsoft C++ 14.0 or greater is required," please install the Build Tools for Visual Studio.


Version Notes

  • v1.3.3 is the last stable pure Python build.
    This version does not require a C++ compiler and is easiest to install on any system with Python 3.7–3.12.
    However, it lacks some of the advanced functionality and speed improvements found in later versions.

  • v2.x and newer use Cython for much faster simulations and additional features, but require a C++ compiler (such as Microsoft Build Tools for Visual Studio on Windows) for installation from source.


License

This project is licensed under the MIT License. See LICENSE for details.

About

Monte Carlo Simulation (predicts whether a crypto/stock will raise in value based on historical data)

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages