Skip to content

Python script that visualizes the results of stock day trading in a spreadsheet using mplfinance based on historical data from Yahoo Finance

License

Notifications You must be signed in to change notification settings

eduardocrespo/trading-grapher

 
 

Repository files navigation

trading-grapher

The trading_grapher.py Python script visualizes the results of stock day trading in a spreadsheet, as well as the MACD and the stochastics, using the mplfinance package based on historical data from Yahoo Finance.

Prerequisites

trading_grapher.py has been tested on Debian Testing on WSL 2 and requires the following packages:

  • mplfinance to plot trade data and the indicators based on historical data
  • odfpy to read the trading journal recorded in an OpenDocument Spreadsheet file
  • prompt_toolkit to complete possible values or a previous value in configuring
  • yfinance to retrieve historical data from Yahoo Finance

Install each package as needed. For example:

python -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements.txt -U

Usage

First, configure the path to your trading journal spreadsheet, the sheet name, and the directory path for storing historical data and charts:

./trading_grapher.py -G

Next, configure the columns of the trading journal:

./trading_grapher.py -J

The ~/.config/trading-grapher/trading_grapher.ini configuration file stores the configurations above. Then, execute:

./trading_grapher.py [%Y-%m-%d ...]

Options

  • -f FILE: specify the file path to the trading journal spreadsheet
  • -d DIRECTORY: specify the directory path for storing historical data and charts
  • -BS: generate a Bash script to launch this script and exit
  • -G: configure general options and exit
  • -J: configure the columns of the trading journal and exit
  • -S: configure the styles based on the trade context and exit
  • -C: check configuration changes and exit

Styles

trading_grapher.py provides the following style modules, which you can specify using the -S option.

amber

A “amber” style chart showing the result of a specific stock day trade

ametrine

A “ametrine” style chart showing the result of a specific stock day trade

fluorite (Default)

A “fluorite” style chart showing the result of a specific stock day trade

opal

A “opal” style chart showing the result of a specific stock day trade

License

MIT

About

Python script that visualizes the results of stock day trading in a spreadsheet using mplfinance based on historical data from Yahoo Finance

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%