Skip to main content

Python and Cython scripts of machine learning, econometrics and statistical features for financial analysis [In progress]

Project description

PyPI - Python Version https://img.shields.io/pypi/v/fynance.svg https://img.shields.io/pypi/status/fynance.svg?colorB=blue https://travis-ci.org/ArthurBernard/Fynance.svg?branch=master https://img.shields.io/github/license/ArthurBernard/fynance.svg https://pepy.tech/badge/fynance Documentation Status Language grade: Python

Fynance is Python (and Cython) package, it provides machine learning, econometric and statistical tools designed for financial analysis and backtest of trading strategy. The documentation is available with some examples of the use of functions and objects.

Currently the project is always at a beta level. But some parts of the project can be considered as stable, such as fynance.features (this subpackage is already coded in Cython to be time-efficient), fynance.algorithms.allocation (this subpackage seems stable but have to be cleaned and write in Cython), and the other subpackages are always in progress (subject to deep modification).

Presentation

The fynance package contains currently 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).

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

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

    • Rolling objects for models, currently work only with neural network models (e.g. _RollingBasis, RollMultiLayerPerceptron, etc.).

  • Neural networks (fynance.neural_networks) with Keras (backend Tensorflow or Theano) contains:
    • Rolling neural network models.

Please refer you to the documentation to see more details on different tools available in fynance package. Documentation contains some descriptions and examples for functions, classes and methods.

Installation

From PyPI

$ pip install fynance

From source (GitHub)

If you want to compile fynance package from cython files you must set USE_CYTHON=True in setup.py file. Otherwise set it to USE_CYTHON=False. By default USE_CYTHON='auto'.

$ git clone https://github.com/ArthurBernard/Fynance.git
$ cd Fynance
$ python setup.py build_ext --inplace
$ python setup.py install --user

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.1.0.tar.gz (9.3 MB view details)

Uploaded Source

Built Distribution

fynance-1.1.0-py3.7-linux-x86_64.egg (2.6 MB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: fynance-1.1.0.tar.gz
  • Upload date:
  • Size: 9.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.59.0 CPython/3.7.0

File hashes

Hashes for fynance-1.1.0.tar.gz
Algorithm Hash digest
SHA256 bbf070aa1ebb9f4c1803625d2697bcaab787952e0a19a4396eddd6206a28ac80
MD5 c68fd08f6674b134cd9f345d32e76c8b
BLAKE2b-256 e5962be5cea6299779cd925ed1bbe87ce1511a196d31ed761a62fd56560f51a4

See more details on using hashes here.

File details

Details for the file fynance-1.1.0-py3.7-linux-x86_64.egg.

File metadata

  • Download URL: fynance-1.1.0-py3.7-linux-x86_64.egg
  • Upload date:
  • Size: 2.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.59.0 CPython/3.7.0

File hashes

Hashes for fynance-1.1.0-py3.7-linux-x86_64.egg
Algorithm Hash digest
SHA256 5564b711b6fa8b7603df79eeecb0c48c1a9c7bef5e652fdc1f6cfa36d1eb6222
MD5 7b85544ab7e430cb43560aa2b80f02b4
BLAKE2b-256 c8585bcf931552de9fb8bf997afb4904308816c1c3cee5d6e950ae1aeae94c64

See more details on using hashes here.

Supported by

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