Skip to main content

Python and Cython scripts of machine learning, econometrics and statistical features for financial analysis

Project description

PyPI - Python Version pypi status licence

CI Documentation Status Test Coverage Docstring Coverage downloads

Fynance is a Python (and Cython) package providing machine learning, econometric and statistical tools designed for financial analysis and backtesting of trading strategies. The documentation is available with descriptions and examples for all public APIs.

The fynance.features and fynance.algorithms.allocation subpackages are stable. Other subpackages (fynance.models, fynance.backtest) are actively developed and may evolve.

Presentation

The fynance package contains five subpackages:

  • Algorithms (fynance.algorithms) contains:
    • Portfolio allocations (e.g. ERC, HRP, IVP, MDP, MVP, etc.).

    • Rolling objects for algorithms (e.g. rolling_allocation, etc.).

  • Backtesting objects (fynance.backtest) contains:
    • Module to plot profit and loss, and measure of performance.

  • Feature tools (fynance.features) contains:
    • Financial indicators (e.g. bollinger_band, cci, hma, macd_hist, macd_line, rsi, etc.).

    • Statistical momentums (e.g. sma, ema, wma, smstd, emstd, wmstd, etc.).

    • Metrics (e.g. annual_return, annual_volatility, calmar, diversified_ratio, mdd, sharpe, z_score, etc.).

    • Scale (e.g. Scale object, normalize, standardize, roll_normalize, roll_standardize, etc.).

    • Rolling functions (e.g. roll_min, roll_max).

    • Filters (e.g. Kalman filter with RTS smoother and MLE parameter estimation).

  • Time-series models (fynance.models) contains:
    • Econometric models (e.g. MA, ARMA, ARMA_GARCH, ARMAX_GARCH, etc.).

    • Neural network models with PyTorch (e.g. MultiLayerPerceptron, LSTM, MultiHeadAttention, etc.).

    • Rolling walk-forward evaluation for models (e.g. RollMultiLayerPerceptron, etc.).

Please refer to the documentation for more details on the tools available in the fynance package.

Installation

From PyPI

$ pip install fynance

From source (GitHub)

$ git clone https://github.com/ArthurBernard/Fynance.git
$ cd Fynance
$ pip install -e ".[dev]"
$ python setup.py build_ext --inplace

Demo

  • Backtest (performance, drawdown and rolling sharpe ratio) of a trading strategy did with a rolling neural network (see Notebooks/Exemple_Rolling_NeuralNetwork.ipynb for more details):

https://github.com/ArthurBernard/Fynance/blob/master/pictures/backtest_RollNeuralNet.png
  • Loss functions and performances (trading strategy) of five rolling neural networks on the training and testing period (see Notebooks/Exemple_Rolling_NeuralNetwork.ipynb for more details):

https://github.com/ArthurBernard/Fynance/blob/master/pictures/loss_RollNeuralNet.png

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

fynance-1.3.2.tar.gz (1.0 MB view details)

Uploaded Source

Built Distributions

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

fynance-1.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

fynance-1.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

fynance-1.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

File details

Details for the file fynance-1.3.2.tar.gz.

File metadata

  • Download URL: fynance-1.3.2.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fynance-1.3.2.tar.gz
Algorithm Hash digest
SHA256 4b01c8f62753e20efead3ecb43f0c2debd751c9cc74f4f4cbdcb6b29819b8ea4
MD5 8ca751907b23986bafea54a619b7b2c7
BLAKE2b-256 34eff1888342f9136ab823401d317105da3bc34ac0e7355ff5aaedb4217261c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for fynance-1.3.2.tar.gz:

Publisher: release.yml on ArthurBernard/Fynance

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fynance-1.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fynance-1.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 50638aaabe9cad7a80c9381c395646bb7c035fd0e4d64e6d026c4b045e826768
MD5 8364d6b867f45c1cc2c31e7b67435193
BLAKE2b-256 68886f13e35aee5e73c89c3a31335fa89d5af9b4145e27514cb0a52782cbfd5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for fynance-1.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on ArthurBernard/Fynance

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fynance-1.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fynance-1.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f860e9041de635f8cedd2a98a6c60cb91def342ca229851f845266565e0eb30c
MD5 d97bd82239ee7759c382f2d6d7b6f3e8
BLAKE2b-256 cfebec67413f15872ce45bd177a7a932361ef93541c14c153280170eaaf00af7

See more details on using hashes here.

Provenance

The following attestation bundles were made for fynance-1.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on ArthurBernard/Fynance

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fynance-1.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fynance-1.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 08de4a46129b0b630bc91dbfdcb3b4fda358ec2b81f171530f355ebbbc3c37b6
MD5 b6282a65c54a38a80c8142ba1da2e179
BLAKE2b-256 74ebe1a44877ceaae463b1b3fecbf72161d048b7813b8c6ceb7c309cdb63df97

See more details on using hashes here.

Provenance

The following attestation bundles were made for fynance-1.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on ArthurBernard/Fynance

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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