Python library for backtesting trading strategies & analyzing financial markets (formerly pythalesians)

Overview

finmarketpy (formerly pythalesians)

finmarketpy is a Python based library that enables you to analyze market data and also to backtest trading strategies using a simple to use API, which has prebuilt templates for you to define backtest. Included in the library

  • Prebuilt templates for backtesting trading strategies
  • Display historical returns for trading strategies
  • Investigate seasonality of trading strategies
  • Conduct market event studies around data events
  • In built calculator for risk weighting using volatility targeting
  • Written in object oriented way to make code more reusable

Contributors for the project are very much welcome, see below!

Merging with pythalesians

I had previously written the open source PyThalesians financial library (which has been merged with this - so can focus on maintaining one set of libraries). This new finmarketpy library has

  • Similar functionality to the trading part of pythalesians
  • Rewritten the API to make it much cleaner and easier to use, as well as having many new features.
  • finmarketpy requires the libraries, which I've written chartpy (for charts) and findatapy (for loading market data) to function
  • By splitting up into smaller more specialised libraries, it should make it easier for contributors
  • Using findatapy, you can download market data easily from Bloomberg, Quandl, Yahoo etc
  • Using chartpy, you can choose to have results displayed in matplotlib, plotly or bokeh by changing single keyword!

Points to note:

  • Please bear in mind at present finmarketpy is under continual development. The API is heavily documented, but we are looking to add more general documentation.
  • Uses Apache 2.0 licence

Gallery

Calculate the cumulative returns of a trading strategy historically (see finmarketpy_examples/tradingmodelfxtrend_example.py)

Plot the leverage of the strategy over time

Plot the individual trade returns

Calculate seasonality of any asset: here we show gold and FX volatility seasonality (see examples/seasonality_examples.py)

Calculate event study around events for asset (see examples/events_examples.py)

Requirements

Major requirements

Installation

For detailed installation instructions for finmarketpy and its associated Python libraries go to https://github.com/cuemacro/finmarketpy/blob/master/INSTALL.md (which includes details on how to setup your entire Python environment).

Also take a look at https://github.com/cuemacro/teaching/blob/master/pythoncourse/installation/installing_anaconda_and_pycharm.ipynb from my Python for finance workshop course, where I keep notes specifically about setting up your Anaconda environment for data science (including for findatapy/chartpy/finmarketpy), including YAML files etc.

You can install the library using the below (better to get the newest version from repo, as opposed to releases).

After installation:

  • Make sure you edit the marketconstants.py file (or you can create a marketcred.py file to overwrite the settings)
pip install git+https://github.com/cuemacro/finmarketpy.git

But beforehand please make sure you have already installed both chartpy, findatapy and any other dependencies. In chartpy you will need to change the chartconstants.py file (to add Plotly API key) and for findatapy, you will also need to change the dataconstants.py file to add the Quandl API (and possibly change other configuration settings there or add a datacred.py file in the util folder, alternatively you will be prompted on your first run to input the API key which will be installed). If you do pip with git you'll get the very latest commit.

pip install git+https://github.com/cuemacro/chartpy.git
pip install git+https://github.com/cuemacro/findatapy.git

However you can also pip install to get from PyPI (might be a slighter older verison from that on GitHub)

pip install chartpy
pip install findatapy

Note that if you use the option pricing/total returns you might need to get the latest FinancePy version from GitHub https://github.com/domokane/FinancePy/ as opposed to PyPI

pip install git+https://github.com/domokane/FinancePy/FinancePy.git

Binder and Jupyter - Run finmarketpy in your browser

You can run some of the Jupyter notebooks in Binder interactively in your browser to play around with finmarketpy. It might take a few minutes for the Binder instance to start. We are currently working on having more notebooks in Binder, so stay tuned!

Note that you will need to get a Quandl API key to download market data to use some of these, and you can sign up for a free account at https://www.quandl.com.

Syncronizing your fork of finmarketpy with master

I found this article useful for explaining how to update your fork to match the master changes.

Contributors

Contributors are always welcome for finmarketpy, findatapy and chartpy. If you'd like to contribute, have a look at Planned Features for areas we're looking for help on. Or if you have any ideas for improvements to the libriares please let us know too!

Sponsorship, workshops and support for Cuemacro libraries

We have spent many years writing finmarketpy and other open source libraries at Cuemacro, and we are keen to do so for many years into the future.

If you using our libraries and are interested in sponsoring Cuemacro's open source libraries, you can do so through the GitHub sponsorship page at https://github.com/sponsors/cuemacro

We also offer commercial services for our Cuemacro libraries, which include:

  • a 2 day Python for finance workshop, which can be taught at your firm, to teach you how to use Cuemacro's libraries
  • extensive commercial technical support for our libraries

If you are interested in our commercial services please contact [email protected]

All these sources of funding, whether it is sponsorship or our commercial services, help us to maintain Cuemacro's libraries, so we can improve our open source libraries for the community.

finmarketpy examples

In finmarketpy/examples you will find several examples, including some simple trading models

Release Notes

  • 0.11.8 - finmarketpy (25 Jan 2021)
  • 0.11.7 - finmarketpy (20 Oct 2020)
  • 0.11.6 - finmarketpy (02 Oct 2020)
  • 0.11.5 - finmarketpy (24 Aug 2020)
  • 0.11.4 - finmarketpy (06 May 2020)
  • 0.11.3 - finmarketpy (04 Dec 2019)
  • 0.11.1 - finmarketpy (23 Oct 2019)
  • 0.11 - finmarketpy
  • First prerelease version

Coding log

finmarketpy log

  • 21 Mar 2021
    • Fixed issue with EventStudy
    • Refactored TradingModel when constructing weights
  • 22 Feb 2021
    • Fix bug when plotting IR of strategies
  • 16 Feb 2021
    • Added total returns in example for options indices construction
  • 11 Feb 2021
    • Refactored to use join from Calculations instead of pandas_outer_join
    • Allowed backtesting by fields other than close
    • Customize strike range for extracting FX vol surface
  • 22 Jan 2021
    • FX spot total returns now supports intraday data and added example
    • Fixed problem with Numba implementation of FX spot total returns
  • 17 Jan 2021
    • Fix vol surface examples to work with new FXVolSurface
  • 16 Jan 2021
    • Additional work on FXOptionPricer and total returns (FXOptionCurve)
      • Speed up and deal with non-convergence of solver
      • Allow options entry on user specified dates
    • Added more option examples
  • 11 Jan 2021
    • Fixed issue with OTM strikes in FXOptionPricer
  • 10 Jan 2021
    • Fixed incorrect pushing of 10d quotes on FX vol surface
    • Added extra parameters for FXOptionsCurve, freezing FX implied, calendar etc.
  • 09 Jan 2021
    • Fixed dom/for rate in FX vol surface
    • Fixed additive index
    • Still sorting issues with total return indices for FX options
  • 08 Jan 2021
    • Added total returns for straddle (with example)
    • Fixed positioning flip and expiring on day without market data on FXOptionsCurve
  • 08 Jan 2021
    • Changed FXVolSurface to fit better with newest FinancePy
    • Added missing FXOptionsCurve class
  • 07 Jan 2021
    • Added FX vanilla option pricing (via FinancePy)
    • Calculate total return indices for FX vanilla options
  • 26 Dec 2020
    • Refactored classes to take into account new Calendar object from findatapy
  • 24 Dec 2020
    • Added FX forwards pricer with examples
      • Interpolation of odd dates
      • Implied depo calculations
    • Added FX forwards total return calculator with examples
    • Rewrote FX spot indices construction to use Numba
  • 20 Dec 2020
    • Changed typo in licence at top of scripts
  • 19 Dec 2020
    • Added VolStats and examples to calculate realized vol, vol risk premium and implied vol addons
    • Added FX total return calculations for FX spot positions
    • Begun to add FX total return calculations for FX forwards (incomplete)
    • Adapted FX vol code to latest version of FinancePy (note, may need to download via GitHub instead of PyPI)
    • Also calculated implied PDF for FX vol surface using FinancePy underneath
  • 04 Dec 2020
    • Fix imports in FX vol interpolation
  • 02 Dec 2020
    • Added FX vol surface interpolation (using FinancePy library underneath) + animated example
  • 12 Nov 2020
    • Added Binder, so can run notebooks interactively
    • Edited backtest_example Jupyter notebook with more description
  • 11 Nov 2020
    • Added cumulative additive index flag for backtests
  • 20 Oct 2020
    • Fixed missing GBP depo tickers
    • Fixed startup on newer MacOS
  • 02 Oct 2020
    • Fixed vol surface calculation
  • 24 Aug 2020
    • Replaced .ix to work with later versions of pandas
  • 07 May 2020
    • Improved QuickChart, adding additional labels, fixing example
  • 06 May 2020
    • Added QuickChart for one line download of market data and plotting
    • Added feature to resample returns
    • Allow more custom parameters in backtest
  • 17 Dec 2019
    • Added link for Python for finance workshop installation notes for Anaconda
  • 04 Dec 2019
    • Making blosc optional in BacktestEngine
  • 14 Nov 2019
    • Added network plot
  • 02 Nov 2019
    • Fixed bug running on Mac
    • Updated installation instructions
    • Added tests for technical indicators
    • Added backtestcomparison.py
  • 29 Mar 2019 - Added variable transaction costs
  • 14 Nov 2018 - Fixed contract bug in backtest_example
  • 18 Sep 2018 - Fixed bug on writing PnL CSV
  • 17 Sep 2018 - Added rounding for trade size display (otherwise trades can be ungrounded because of rounding errors)
  • 11 Jun 2018 - Fixed bug with single threaded TradeAnalysis
  • 29 May 2018 - Added port
  • 25 Apr 2018
    • Added (some) parallel features for backtesting and sensitivity analysis (works better in Linux)
    • Added different transaction costs by assets
    • Fixed backtesting examples so work with "run_in_parallel" keyword and can customise BacktestRequest more
  • 18 Apr 2018 - Fix bug with trade notional sizes
  • 06 Apr 2018 - Added function to measure freq of trade notional sizes
  • 29 Mar 2018 - Fix bug when dumping CSV of P&L
  • 15 Mar 2018 - Added caching for event data
  • 26 Feb 2018 - Added solution for replacing parameters under tech_params (in tradeanalysis.py).
  • 30 Jan 2018 - Fix bug on backtest.example.py
  • 25 Jan 2018 - Fix bug on class
  • 04 Jan 2018 - Bug fix for Cred override of constants
  • 16 Sep 2017 - Adding to planned features list
  • 10 Jul 2017 - Added install instructions for conda
  • 03 Jul 2017 - Fixed dependency on seasonal library
  • 26 Jun 2017 - BacktestEngine can now handle weighted sum style portfolios
  • 23 Jun 2017 - Downloads observation date for economic data (EventStudy)
  • 21 Jun 2017 - Added trend following example using Bloomberg total return data
  • 07 Jun 2017 - Added output of IR/Rets in sensitivity analysis (TradeAnalysis)
  • 22 May 2017 - Output returns of strategy (to CSV file)
  • 03 May 2017 - Added more planned features
  • 13 Apr 2017 - Changed finish date on FX trend following model
  • 12 Mar 2017 - Added FX vol surface animation example
  • 25 Feb 2017 - Added signal delay parameter
  • 24 Feb 2017 - Refactored backtesting classes so have consistent naming
  • 21 Feb 2017 - Refactored BacktestEngine to use SwimPool
  • 20 Feb 2017 - Extra install instructions
  • 14 Feb 2017 - Added Planned Features page
  • 08 Feb 2017 - Added SHOW_CHARTS parameter for TradingModel and made SMA work with old pandas
  • 05 Feb 2017 - Added more installation notes and fixed Excel output in TradeAnalysis if notional not specified
  • 02 Feb 2017 - Further changes to constraints on max long/shorts (with refactoring)
  • 01 Feb 2017 - Added constraints for max longs/shorts and plots in BacktestEngine
  • 25 Jan 2017 - Additional work on stops/take profit with multiple assets & plotting bug fixes for TradeAnalysis
  • 24 Jan 2017 - Fixing issues around stops/take profits and adding fields in TechParams
  • 19 Jan 2017 - Change location of examples in project
  • 16 Jan 2017 - Added method in BacktestEngine for debugging of P&L (dumps table with signals/assets/returns)
  • 12 Jan 2017 - Added detailed installation notes
  • 11 Jan 2017 - Rewrote large number of comments, added ATR calculation and basic stop loss/take profit functionality
  • 07 Jan 2017 - Now outputs position sizes scaled by notional & by user defined contract sizes
  • 06 Jan 2017 - Added user defined weightings for strategies & general bug fixes
  • 04 Jan 2017 - Added a period shift parameter for calculating leverage (in RiskEngine)
  • 30 Nov 2016 - Added seasonality example for NFP
  • 24 Nov 2016 - Added seasonality example for gasoline
  • 17 Nov 2016 - Changed source to ChartConstants default for TradingModel
  • 14 Oct 2016 - Fixed arctic references in MarketConstants
  • 13 Oct 2016 - Fixed IR plotting for BacktestEngine, added YoY metric plots
  • 11 Oct 2016 - Added to TradeAnalysis another way to plot return statistics for a portfolio
  • 10 Oct 2016 - Added returns_example to show how to use PyFolio via finmarketpy, added dataframe input for TradeAnalysis, fixed typo in readme
  • 07 Oct 2016 - Add .idea to .gitignore
  • 06 Oct 2016 - Split out plotting of no of trades and position proportion
  • 22 Sep 2016 - Fixed sorting of columns when signal plotting
  • 21 Sep 2016 - Allow plotting of multiple signal days
  • 15 Sep 2016 - Merged finmarketpy and pythalesians fully, released version 0.11
  • 12 Sep 2016 - Fixed issue with TradeAnalysis (method names)
  • 02 Sep 2016 - Fixed issue with external dataframe eco events, added event study example
  • 01 Sep 2016 - Added seasonality example for FX vol
  • 22 Aug 2016 - Fixed boot issue and added credentials
  • 17 Aug 2016 - Uploaded first code

pythalesians log

  • 03 Aug 2016 - Fixed missing conf files
  • 02 Aug 2016 - Changed default Plotly background color and fixed constants issue with AdapterTemplate
  • 01 Aug 2016 - Renamed pythalesians_graphics as chartesians (preparing eventual spinout)
  • 29 Jul 2016 - Created Jupyter notebook plot_market_data for plotting with multiple libraries, also fixed Bokeh sizing issue, refactored library, spinning out chart functionality into pythalesians_graphics
  • 28 Jul 2016 - Fixed issue with multiple fields returned by Quandl, added Quandl downloading example
  • 26 Jul 2016 - Added more support for Plotly charts, added surface vol Plotly example
  • 21 Jul 2016 - Refactor StrategyTemplate graph plotting functions
  • 20 Jul 2016 - Return of figure handle for AdapterPyThalesians
  • 08 Jun 2016 - Fix kurtosis issue, refactored vol scaling in CashBasktest, added resample wrapper in TimeSeriesFilter
  • 03 Jun 2016 - Speed up CashBacktest (construct_strategy method)
  • 02 Jun 2016 - Fixed missing StrategyTemplate file in installation, added auto-detection of path to simplify installation and added methods for converting between pandas and bcolz
  • 31 May 2016 - Got rid of deprecated Pandas methods in TechIndicator
  • 27 May 2016 - Added ability to plot strategy signal at point in time
  • 19 May 2016 - Updated Quandl wrapper to use new Quandl API
  • 02 May 2016 - Tidied up BacktestRequest, added SPX seasonality example
  • 28 Apr 2016 - Updated cashbacktest (for Pandas 0.18)
  • 21 Apr 2016 - Got rid of deprecated Pandas methods in EventStudy
  • 18 Apr 2016 - Fixed some incompatibility issues with Pandas 0.18
  • 06 Apr 2016 - Added more trade statistics output
  • 01 Apr 2016 - Speeded up joining operations, noticeable when fetching high freq time series
  • 21 Mar 2016 - Added IPython notebook to demonstrate how to backtest simple FX trend following trading strategy
  • 19 Mar 2016 - Tested with Python 3.5 64 bit (Anaconda 2.5 on Windows 10)
  • 17 Mar 2016 - Refactored some of graph/time series functions and StrategyTemplate
  • 11 Mar 2016 - Fixed warnings in matplotlib 1.5
  • 09 Mar 2016 - Added more TradeAnalysis features (for sensitivity analysis of trading strategies)
  • 01 Mar 2016 - Added IPython notebook to demonstrate how to download market data and plot
  • 27 Feb 2016 - Fixed total returns FX example
  • 20 Feb 2016 - Added more parameters for StrategyTemplate
  • 13 Feb 2016 - Edited time series filter methods
  • 11 Feb 2016 - Added example to plot BoJ interventions against USDJPY spot
  • 10 Feb 2016 - Updated project description
  • 01 Feb 2016 - Added LightEventsFactory to make it easier to deal with econ data events (stored as HDF5 files)
  • 20 Jan 2016 - Added kurtosis measure for trading strategy results, fixed Quandl issue
  • 19 Jan 2016 - Changed examples folder name
  • 15 Jan 2016 - Added risk on/off FX correlation example
  • 05 Jan 2016 - Added total return (spot) indices construction for FX and example
  • 26 Dec 2015 - Fixed problem with econ data downloaders
  • 24 Dec 2015 - Added datafactory templates for creating custom indicators
  • 19 Dec 2015 - Refactored Dukascopy downloader
  • 10 Dec 2015 - Various bug fixes
  • 22 Nov 2015 - Increased vol targeting features for doing backtesting
  • 07 Nov 2015 - Added feature to download tick data from Bloomberg (with example)
  • 05 Nov 2015 - Added intraday event study class (and example)
  • 02 Nov 2015 - Added easy wrapper for doing rolling correlations (and example)
  • 28 Oct 2015 - Added more sensitivity analysis for trading strategies
  • 26 Oct 2015 - Various bug fixes for Bloomberg Open API downloader
  • 14 Oct 2015 - Added capability to do parallel downloading of market data (thread/multiprocessing library), with an example for benchmarking and bug fixes for Bloomberg downloader
  • 25 Sep 2015 - Refactored examples into different folders / more seasonality examples
  • 19 Sep 2015 - Added support for Plotly choropleth map plots & easy downloading of economic data via FRED/Bloomberg/Quandl
  • 12 Sep 2015 - Added basic support for PyFolio for statistical analysis of strategies
  • 04 Sep 2015 - Added StrategyTemplate for backtesting (with example) & bug fixes
  • 21 Aug 2015 - Added stacked charts (with matplotlib & bokeh) & several bug fixes
  • 15 Aug 2015 - Added bar charts (with matplotlib & bokeh) & added more time series filter functions
  • 09 Aug 2015 - Improved Bokeh support
  • 07 Aug 2015 - Added Plotly support (via Jorge Santos Cufflinks wrapper)
  • 04 Aug 2015 - Added ability to download from FRED and example for downloading from FRED.
  • 29 Jul 2015 - Added backtesting functions (including simple FX trend following strategy) and various bug fixes/comments.
  • 24 Jul 2015 - Added functions for doing simple seasonality studies and added examples.
  • 17 Jul 2015 - Created example to show how to use technical indicators.
  • 13 Jul 2015 - Changed location of conf, renamed examples folder to pythalesians_examples. Can now be installed using setup.py.
  • 10 Jul 2015 - Added ability to download Dukascopy FX tick data (data is free for personal use - check Dukascopy terms & conditions). Note that past month of data is generally not made available by Dukascopy

End of note

Comments
  • backtest-example(second version) fails

    backtest-example(second version) fails

    I've taken out a second example into separate file from finmarketpy_examples/backtest_example.py

    Created a clean env and still getting the error. I guess it's something to do with changes in finmarketpy/backtest/backtestengine.py 2 weeks ago.

    signals = backtest.get_porfolio_signal() # get final signals for each series AttributeError: 'Backtest' object has no attribute 'get_porfolio_signal'

    image

    opened by kalaytan 2
  • docs: fix simple typo, configuation -> configuration

    docs: fix simple typo, configuation -> configuration

    There is a small typo in INSTALL.md.

    Should read configuration rather than configuation.

    Semi-automated pull request generated by https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md

    opened by timgates42 1
  • fixed typo in Readme

    fixed typo in Readme

    Hi Saeed,

    first of all let me mention that I am a great fan of your library (met you once at a meetup and used pythalesians at multiple occasions since then) - many thanks. I found a small typo and fixed it (faster for you than if I would write an issue for this) - I am pretty sure you mean "formerly", right? This could also be fixed in the Repo-description at GitHub.

    Another suggestion would be to add a link to this repository from the "old" pythalesians repo - I first thought you pulled the library when following my old bookmark.

    Are there any areas of the library for which you are currently looking for contributions (especially with regards to stock market backtesting)?

    Many thanks again, Jan

    opened by jpdus 1
  • platform.platform() doesn't just yield 'mac' [AttributeError: 'MarketConstants' object has no attribute 'generic_plat']

    platform.platform() doesn't just yield 'mac' [AttributeError: 'MarketConstants' object has no attribute 'generic_plat']

    We get more detailed platform information now

    >>> import platform
    >>> platform.platform()
    'macOS-10.15.7-x86_64-i386-64bit'
    

    This causes the backtesting engine to fail on modern macbooks

    AttributeError                            Traceback (most recent call last)
    <ipython-input-12-80a29ff8827d> in <module>
    ----> 1 model.construct_strategy()
    
    /usr/local/anaconda3/envs/qtrade/lib/python3.8/site-packages/finmarketpy/backtest/backtestengine.py in construct_strategy(self, br, run_in_parallel)
       1074 
       1075         # each portfolio key calculate returns - can put parts of the portfolio in the key
    -> 1076         if market_constants.backtest_thread_no[market_constants.generic_plat] > 1 and run_in_parallel:
       1077             swim_pool = SwimPool(multiprocessing_library=market_constants.multiprocessing_library)
       1078 
    
    AttributeError: 'MarketConstants' object has no attribute 'generic_plat'
    
    opened by flipdazed 0
  • Added method to plot correlation network

    Added method to plot correlation network

    The setup.py file needs to be updated to include matplotlib.pyplot and matplotlib.collections in teh project requirements. Method based on the example reported in this page.

    opened by OdysseusH4K 0
  • Added backtest comparisons and Quandl example notebook

    Added backtest comparisons and Quandl example notebook

    Backtestcomparison allows comparison of two models by pnl, sharpe and trade (notional). A notebooks folder has also been made explaining the steps taken in quandl_examples.py.

    opened by krishanj20 0
  • TypeError: generate_canvas() got an unexpected keyword argument...

    TypeError: generate_canvas() got an unexpected keyword argument...

    TypeError: generate_canvas() got an unexpected keyword argument 'page_title' & 'render_pdf' are missing in \chartpy\canvas.py: Canvas.generate_canvas()

    I'll push request a fix in a second; just removing arguments from the call.

    opened by kalaytan 0
  • Update README URLs based on HTTP redirects

    Update README URLs based on HTTP redirects

    Created with https://github.com/dkhamsing/frankenstein

    GitHub Corrected URLs

    | Was | Now | | --- | --- | | https://github.com/plotly/python-api | https://github.com/plotly/plotly.py |

    opened by ReadmeCritic 0
  • Any helper function for visualizing limit order data?

    Any helper function for visualizing limit order data?

    First of all, thanks for open-sourcing such an amazing lib! I am trying to find out a chance to apply this lib (or other libs that you created) on a recent Kaggle competition (Volatility prediction). Wondering if this lib offers any helper functions specifically for visualizing limit order data? Many thanks!

    opened by riven314 0
  • AttributeError: 'DataConstants' object has no attribute 'base_depos_tenor'

    AttributeError: 'DataConstants' object has no attribute 'base_depos_tenor'

    Hi Saeed,

    Cuemacro is a brilliant suite of libraries. Thanks for your efforts.

    I was trying out an example in (finmarketpy_examples) where I received this error:

    base_depos_tenor=data_constants.base_depos_tenor, AttributeError: 'DataConstants' object has no attribute 'base_depos_tenor'

    Any idea why I am receiving this error?

    Thanks again, Abhi

    opened by abhijitng 4
  • only available returns are cumprod

    only available returns are cumprod

    Currently the only returns available are cumulative products. I couldn't find any alternative to Calculations().create_mult_index() for cumulative sums

    Suggest cumulative sum flag when calculating backtest cumulative PnL

    opened by flipdazed 2
  • Pipelining / stacking strategies

    Pipelining / stacking strategies

    Hey Saeed - been looking your finmarketpy library - looks nice!

    What wasn't clear to me from looking at it was if you can stack strategies upon each other?

    For example:

    • I have 4 building-block strats which solely roll commodity futures contracts.
    • I have 2 strategies, say Seasonality and Momentum taking roll strats as an underlying "asset".
    • Combine as a portfolio with some smart switching taking all 8 as inputs

    Is that achievable ?

    I couldn't see how it would be set up and return risk metrics at each constituent level.

    opened by flipdazed 2
  • .ix is deprecated since pandas-0.20 and removed in pandas-1.0.0

    .ix is deprecated since pandas-0.20 and removed in pandas-1.0.0

    Hello Saeed,

    pandas selector .ix is no longer available and thus will trigger an error in newer pandas.

    In master it is still present in eventstudy and backtestengine: https://github.com/cuemacro/finmarketpy/search?q=.ix&unscoped_q=.ix But also in findatapy (timeseries/{dataquality|calculations|filter}), which is a dependency: https://github.com/cuemacro/findatapy/search?q=.ix&unscoped_q=.ix

    Best Vladimir

    opened by vfilimonov 2
Releases(v0.11.11)
Owner
Cuemacro
Cuemacro is a company focused on understanding macro markets from a quantitative perspective, in particular currency markets.
Cuemacro
Zipline, a Pythonic Algorithmic Trading Library

Zipline is a Pythonic algorithmic trading library. It is an event-driven system for backtesting. Zipline is currently used in production as the backte

Quantopian, Inc. 15.7k Jan 02, 2023
Common financial technical indicators implemented in Pandas.

FinTA (Financial Technical Analysis) Common financial technical indicators implemented in Pandas. This is work in progress, bugs are expected and resu

1.8k Dec 31, 2022
Common financial risk and performance metrics. Used by zipline and pyfolio.

empyrical Common financial risk metrics. Table of Contents Installation Usage Support Contributing Testing Installation pip install empyrical Usage S

Quantopian, Inc. 1k Dec 26, 2022
Technical Analysis Library using Pandas and Numpy

Technical Analysis Library in Python It is a Technical Analysis library useful to do feature engineering from financial time series datasets (Open, Cl

Darío López Padial 3.4k Jan 02, 2023
A proper portfolio tracker. Featuring historical allocation, cash flows and real returns.

Python Portfolio Analytics A portfolio tracker featuring account transactions, historical allocation, dividends and splits management and endless perf

Simone Precicchiani 13 Aug 13, 2022
This repository contains a set of plugins for Volatility 3

volatility_plugins This repository contains a set of plugins for Volatility 3 These plugins are not compatible with Volatility 2 To use these plugins

Immersive-Labs-Sec 10 Nov 30, 2022
scrilla: A Financial Optimization Application

A python application that wraps around AlphaVantage, Quandl and IEX APIs, calculates financial statistics and optimizes portfolio allocations.

Grant Moore 6 Dec 17, 2022
Performance analysis of predictive (alpha) stock factors

Alphalens Alphalens is a Python Library for performance analysis of predictive (alpha) stock factors. Alphalens works great with the Zipline open sour

Quantopian, Inc. 2.5k Dec 28, 2022
A banking system is a group or network of institutions that provide financial services for us

A banking system is a group or network of institutions that provide financial services for us. These institutions are responsible for operating a payment system, providing loans, taking deposits, and

UTTKARSH PARMAR 1 Oct 24, 2021
Python sync/async framework for Interactive Brokers API

Introduction The goal of the IB-insync library is to make working with the Trader Workstation API from Interactive Brokers as easy as possible. The ma

Ewald de Wit 2k Dec 30, 2022
This repository provides all Python codes and Jupyter Notebooks of the book Python for Finance

Python for Finance (O'Reilly) This repository provides all Python codes and Jupyter Notebooks of the book Python for Finance -- Analyze Big Financial

Yves Hilpisch 1.6k Jan 03, 2023
Python Backtesting library for trading strategies

backtrader Yahoo API Note: [2018-11-16] After some testing it would seem that data downloads can be again relied upon over the web interface (or API v

DRo 9.8k Dec 30, 2022
Q-Fin: A Python library for mathematical finance.

Q-Fin A Python library for mathematical finance. Installation https://pypi.org/project/QFin/ pip install qfin Bond Pricing Option Pricing Black-Schol

Roman Paolucci 247 Jan 01, 2023
crypto utilities as a way of learning

cryptos Just me developing a pure Python from-scratch zero-dependency implementation of Bitcoin for educational purposes. This includes a lot of the c

Andrej 958 Jan 02, 2023
ARCH models in Python

arch Autoregressive Conditional Heteroskedasticity (ARCH) and other tools for financial econometrics, written in Python (with Cython and/or Numba used

Kevin Sheppard 1k Jan 04, 2023
Indicator divergence library for python

Indicator divergence library This module aims to help to find bullish/bearish divergences (regular or hidden) between two indicators using argrelextre

8 Dec 13, 2022
An Algorithmic Trading Library for Crypto-Assets in Python

Service Master Develop CI Badge Catalyst is an algorithmic trading library for crypto-assets written in Python. It allows trading strategies to be eas

Enigma 2.4k Jan 05, 2023
High-performance TensorFlow library for quantitative finance.

TF Quant Finance: TensorFlow based Quant Finance Library Table of contents Introduction Installation TensorFlow training Development roadmap Examples

Google 3.5k Jan 01, 2023
Python library for backtesting trading strategies & analyzing financial markets (formerly pythalesians)

finmarketpy (formerly pythalesians) finmarketpy is a Python based library that enables you to analyze market data and also to backtest trading strateg

Cuemacro 3k Dec 30, 2022