Backtest a foreign exchange trend-following strategy on historical price data and measure cumulative returns and max drawdown.
Run a seasonality analysis on an asset to see whether it tends to outperform at specific times of year.
Download market data from Bloomberg or Yahoo Finance using findatapy and feed it into a finmarketpy backtest template.
Generate an interactive Plotly chart of a strategy's leverage and returns over time by switching a single config setting from matplotlib.
Requires installing three separate libraries (finmarketpy, findatapy, chartpy) and configuring API keys for each data provider such as Bloomberg or Quandl.
finmarketpy is a Python library for analyzing financial market data and testing trading strategies. It provides templates that let you define a backtest (a simulation of how a trading strategy would have performed on historical data) and then run calculations to measure things like cumulative returns, leverage over time, and individual trade outcomes. It also supports seasonality analysis, which looks at whether an asset tends to perform differently at certain times of year, and event studies, which measure how prices move around specific announcements like US employment reports. The library is built around two companion packages by the same author: findatapy for downloading market data from sources such as Bloomberg, Quandl, and Yahoo Finance, and chartpy for generating interactive charts. By swapping a single setting you can switch the chart output between matplotlib, Plotly, or Bokeh. An optional third package, financepy, adds support for options pricing. Installing finmarketpy requires Python 3.10 and involves installing all three libraries separately via pip. Each library has its own configuration file where you add API keys for data providers and chart tools. The README links to a detailed installation guide and a course notebook covering how to set up an Anaconda environment for this stack. For people who want to try the library without a local setup, some Jupyter notebooks are available to run directly in the browser via Binder. Examples include backtesting a foreign exchange trend-following strategy and downloading market data. The project is released under the Apache 2.0 license and was previously named pythalesians before being rewritten with a cleaner API. The author's company, Cuemacro, offers paid workshops and commercial support for the library. Contributions are also welcomed, a planned features document in the repository lists areas where help is sought.
← cuemacro on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.