Skip to main content

A backtesting package for options

Project description

pybacktestchain_options

A backtesting package for equity and commodity.

On the equity side you can test all the strategies defined in pybacktestchain

On the commo side you can try the mean reversion play of the long term price on different commodities (OIL, GAS, WHEAT, CORN).

Installation

$ pip install pybacktestchain_options

Usage

You can either use the following code :

from datetime import datetime
import pandas as pd
from pybacktestchain.data_module import get_stocks_data 
from universal_backtest import UniversalBackTest

if __name__ == "__main__":
    # Parameters
    commo_equity = "COMMO"
    backtest = UniversalBackTest(initial_date=datetime(2023, 4, 1),
                                  final_date=datetime(2023, 12, 5),
                                    commo_equity=commo_equity)

    backtest.run_backtest()

Or you can replace commo_equity with "EQUITY" and adjist the parameters as it is done in pybacktestchain.

The other way to use it is through an API call :

  • run the file api.py
  • open a new terminal and copy the following command lines :
curl -X POST http://127.0.0.1:5000/run_backtest \
-H "Content-Type: application/json" \
-d '{"commo_equity": "COMMO", "initial_date": "2023-01-01", "final_date": "2023-12-31", "cash": 1000000, "verbose": true}'

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

pybacktestchain_options was created by Guillaume Touly. It is licensed under the terms of the MIT license.

Credits

pybacktestchain_options was created with cookiecutter and the py-pkgs-cookiecutter template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pybacktestchain_options-0.1.1.tar.gz (268.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybacktestchain_options-0.1.1-py3-none-any.whl (275.5 kB view details)

Uploaded Python 3

File details

Details for the file pybacktestchain_options-0.1.1.tar.gz.

File metadata

  • Download URL: pybacktestchain_options-0.1.1.tar.gz
  • Upload date:
  • Size: 268.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.5

File hashes

Hashes for pybacktestchain_options-0.1.1.tar.gz
Algorithm Hash digest
SHA256 29e1f0c9aaf330babf2768a4670a0419e0241d226dc452fdbc7494fa1c628277
MD5 0e95332bbf875223590efa9ef75d9c7b
BLAKE2b-256 4c250e5118fd9e54aaa3a5baa97528ff21f351cefe7c3acc5ba67699f44f89d5

See more details on using hashes here.

File details

Details for the file pybacktestchain_options-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pybacktestchain_options-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 832860ced5897835c958c7028f4fa51e794fd3b51d02ceeccd13d2767b2df4c4
MD5 b6b36a85cf1c7ed76b849766bc102e67
BLAKE2b-256 ce6d585013e5212873ccc10173a06ee7dd065da6ab4cefd0353b474f0129c53b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page