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.3.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.3-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.3-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.3-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.3.tar.gz.

File metadata

  • Download URL: fynance-1.3.3.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.3.tar.gz
Algorithm Hash digest
SHA256 8d797932ead1eb8e7225f83fe2c8d7e5e2d0947479fdec519b562ad8e51dd69e
MD5 d00cc45b595fdd02341352e39fd4775a
BLAKE2b-256 78653ec57e3fd812f69002d5aea9e6396b71e590ba16697bd37ecd4c665249bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for fynance-1.3.3.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.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fynance-1.3.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3201788c0a216309f4d1255feacef5617e25957f6fc1076b6c571d11e4d60ed6
MD5 c481440e8374ddb23eb6554977a19b21
BLAKE2b-256 869a3dfe8f20b955d329f2654d6366711508c4040a6f6048523dfe282f45ea5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for fynance-1.3.3-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.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fynance-1.3.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7583111907e3ffa46d212cb46bbc9b3708642d04ec4e7f4a8f19c95f0778f552
MD5 c110a5440a3e5710cb2008e68a7d8fce
BLAKE2b-256 cfc528fbbbba5991b43b63aeb4100a292ea387ab0159f25adbe22fbc2aef4486

See more details on using hashes here.

Provenance

The following attestation bundles were made for fynance-1.3.3-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.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fynance-1.3.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 79664d63ec685f9a509ec11e2ce7f10c0a972f32d8fc54d04c050c408003f467
MD5 427d4df3a15d04fd3a756fdd089029bb
BLAKE2b-256 26b3d435494c1f50d3df2efec79cb7249f64a4ab0b6e395dba0eb23789e619b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for fynance-1.3.3-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