scrilla: A Financial Optimization Application

Overview

scrilla: A Financial Optimization Application

Table of Contents

This is a financial application that calculates asset correlations, statistics and optimal portfolio allocations using data it retrieves from external services (currently: AlphaVantage, IEX and Quandl). Statistics are calculated using Ito Calculus and should be consistent with the results demanded by Modern Portfolio Theory and Financial Engineering. The portfolios are optimized by minimizing the portfolio's variance/volatility, i.e. by finding the optimal spot on the portfolio's efficient frontier as defined by the CAPM model. Alternatively, portfolios can be optimized by maximizing the portfolio's Sharpe ratio or by minimizing the portfolio's Conditional Value at Risk.

The program's functions are wrapped in PyQt5 widgets which provide a user interface (this feature is still in development and may explode). In addition, visualizations are created by matplotlib for easier presentation.

The links below will take you to the registration pages for each API service Key,

AlphaVantage API Key Registration
Quandl API Key Registration
IEX API Key Registration

Note this application optimizes across asset classes, i.e. the theoretical portfolio being constructed can be composed of equities, cryptocurrencies or both. In a future release, I would like to include fixed income assets, volatility assets (VIX futures, options, etc.) and other derivatives, but for now, only those two asset types are supported. I am looking for a good API that provides historical data on the other types of financial instruments before I bring them into the optimization algorithm, so if you know of one, contact me.

Setup

Installation

Install the package with the Python package manager,

pip install scrilla

If you prefer, you can build from source. git clone the repository and then from the root directory build the library,

python3 -m build

cd into the generated /dist/ to manually install the packaged code,

pip install scrilla-..-py3-none-any.whl

Dependencies

You will need Python3.8 or greater. This application depends on the following Python libraries:

This libraries will be installed during the pip install command. If you wish to use the GUI, you will also need to ensure your operating system has a Qt5 library,

sudo apt-get install qt5-default

The GUI will not function without a Qt library.

Configuration

In order to use this application, you will need to register for API keys. The program will need to be made aware of these keys somehow. The best option is storing these credentials in environment variables. See Required Configuration for more information. You can also invoke the CLI function store to store the credentials in the local installation /data/common/ directory. To do so,

scrilla -store =

where key is one of the values: ALPHA_VANTAGE_KEY, QUANDL_KEY or IEX_KEY. value is the corresponding key itself given to you after registration. The key is case-sensitive and there should be no spaces in the expression key=value

Environment

A sample environment file is located here, along with comments describing the purpose of each variable. The application sets sensible defaults for most of the environment variable configurations, but there are several required environment variables you will need to set yourself.

Required Configuration

As mentioned, you will need to register for API keys at AlphaVantage, IEX and Quandl. One way of passing API keys to the program is by storing these in your session's environment. scrilla will search for environment variables named ALPHA_VANTAGE_KEY, QUANDL_KEY and IEX_KEY. You can add the following lines to your .bashrc profile or corresponding configuration file for whatever shell you are using,

export ALPHA_VANTAGE_KEY=
export QUANDL_KEY=
export IEX_KEY=

If no API keys are found in these variables, the application will not function properly; be sure to load these variables into your shell session before using scrilla.

Optional Configuration

scrilla can be configured with the following optional environment variables. Each variable in this list has a suitable default set and so does not need changed unless the user prefers a different setting.

  • RISK_FREE

Determines which annualized US-Treasury yield is used as stand-in for the risk free rate. This variable will default to a value of 10-Year, but can be modified to any of the following: 3-Month, 5-Year, 10-Year, or 30-Year.

  • MARKET_PROXY

Determines which ticker symbol is used as a proxy for the overall market return. This variable will default to a value of SPY, but can be set to any ticker on the stock market. Recommended values: SPY, QQQ, DJI or VTI.

  • FRONTIER_STEPS

Determines the number of data points in a portfolio's efficient frontier. This variable will default to a value of 5, but can be set equal to any integer.

  • MA_1, MA_2, MA_3

Determines the number of days used in the sample for moving average series and plots. These variables default to the values of 20, 60 and 100. In other words, by default, moving average plots will display the 20-day moving average, the 60-day moving average and the 100-day moving average. These variables can be set equal to any integer, as long as MA_1 < MA_2 < MA_3.

  • FILE_EXT

Determines the type of files that are output by scrilla. This variable is currently only defined for an argument of json. A future release will include csv.

  • LOG_LEVEL

Determines the amount of output. Defaults to info. Allowable values: none, info, debug or verbose. Be warned, verbose is extremely verbose.

Usage

Command Line

Most functions have been wired into command line arguments. For a full list of scrilla's functionality,

scrilla -help

The main usage of scrilla is detailed below.

Optimization

  1. Volatility Minimization & Sharpe-Ratio Maximization

A portfolio of consisting of the equities ALLY, BX and SONY can be optimized with the following command,

scrilla -opt ALLY BX SONY

By default, scrilla will optimize over the last 100 trading days. If you wish to optimize over a different time period, you may use the -start and -end argument flags to provide starting and ending dates in the YYYY-MM-DD format.

Also by default, the optimization function will minimize the portfolio variance. You can also specify the portfolio should be maximized with respect to the Sharpe ratio,

scrilla -opt -sh ALLY BX SONY

There are several other arguments you may use to configure your optimization program. The full list of arguments is shown below,

scrilla -opt -sh -start -end -save -target -invest [TICKERS]

-target will optimize the portfolio with the additional constraint that its rate of return must equal target. Note the target return must be between the minimum rate of return and maximum rate of return in a basket of equities. For example, if ALLY had a rate of return of 10%, BX 15%, SONY 20%, the frontier of possible rates of returns resides in the range [10%, 20%]. It is impossible to combine the equities in such a way to get a rate of return less than 10% or one greater than 20%. Note, this assumes shorting is not possible. A future release will relax this assumption and allow portfolio weights to be negative.

-invest represents the total amount of money invested in a portfolio.

For example, the following command,

scrilla -opt -sh -save -target 0.25 -invest 10000 -start 2020-01-03 -end 2021-05-15 ALLY BX SONY

Will optimize a portfolio consisting of ALLY, BX and SONY using historical data between the dates of January 1st, 2020 and May 15th, 2021. The portfolio will be constrained to return a rate of 25%. A total $10,000 will be invested into this portfolio (to the nearest whole share). The output of this command will look like this,

---------------------------------------------- Results ----------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------- Optimal Percentage Allocation -----------------------------------
ALLY = 22.83 %
BX = 19.26 %
SONY = 57.91 %
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-------------------------------------- Optimal Share Allocation --------------------------------------
ALLY = 42
BX = 15
SONY = 56
-------------------------------------- Optimal Portfolio Value --------------------------------------
>> Total = $ 9893.98
---------------------------------------- Risk-Return Profile ----------------------------------------
>> Return = 0.25
>> Volatility = 0.201
----------------------------------------------------------------------------------------------------

Note the optimal share allocation does not allow fractional shares. scrilla will attempt to get as close to the total investment inputted without going over using only whole shares. Also note the return of this portfolio is 25%, as this was inputted into the target return constraint.

  1. Conditional Value at Risk Minimization

The portfolio optimization can also be done by minimizing its conditional value at risk. Because the underlying calculations are a bit different, this function is accessed through a different command and requires different arguments.

The two new arguments are prob and expiry. prob, in essence, represents the percentile of the portfolio's distribution on which the value at risk will be conditioned. In other words, if the portfolio value is represented by a random variable P, for a given value of P=p, the prob is the probability such that,

Probability(P

expiry represents the time horizon over which the value at risk will be calculated, i.e. the point in time in which the hypothetical loss occurs.

With these two new arguments, a portfolio's conditional value at risk can be optimized using the following,

scrilla -opt-cvar -prob 0.05 -expiry 0.5 ALLY BX SONY

The command given above will optimize the portfolio consisting of ALLY, BX and SONY over the next half year (expiry = 0.5) subject to the value at risk in the 5th percentile.

Other Notable Features

  1. Discount Dividend Model

scrilla will pull an equity's dividend payment history, regress the payment amount against its date and infer a linear regression from this time series. It will use this model to project future dividend payments and then calculate the current cost of equity and use that to discount the sum of dividend payments back to the present,

scrilla -ddm ALLY

Alternatively, you can visualize the dividend payments against the regression model,

scrilla -plot-div ALLY

  1. Financial Statistics

    • Beta: scrilla -capm-beta [TICKERS]
    • Correlation Matrix: scrilla -cor [TICKERS]
    • Cost Of Equity: scrilla -capm-equity [TICKERS]
    • Risk-Return Profile: scrilla -rr [TICKERS]
    • Sharpe Ratio: scrilla -sharpe [TICKERS]
  2. Stock Watchlist and Screening

Stocks can be added to your watchlist with,

scrilla -watch [TICKERS]

You can then screen stocks according to some criteria. For example, the following command will search your watchlist for stock prices that are less than their Discount Dividend Model (very rare this happens...),

scrilla -screen -model DDM

  1. Visualizations
    • Discount Dividend Model: scrilla -plot-div [TICKER]
      • NOTE: THIS FUNCTION ONLY ACCEPTS ONE TICKER AT A TIME.
    • Efficient Fronter: scrilla -plot-ef [TICKERS]
    • Moving Averages: scrilla -plot-mov [TICKERS]
    • Risk Return Profile: scrilla -plot-rr [TICKERS]
    • Yield Curve: scrilla -plot-yield (not implemented yet)

Programmatic

This package is made up of several top-level modules and various submodules, grouped according to the following name space:

  • scrilla
    • main
    • files
    • services
    • settings
    • analysis
      • calculator
      • markets
      • optimizer
      • statistics
    • objects
      • cashflow
      • portfolio
    • util
      • formatter
      • helper
      • outputter
      • plotter

In general, you should not need to interact with any of the top level modules. main is the entrypoint for the CLI application, files is used to format and parse files and manage the local cache, settings parses environment variables to configure the application; these modules function entirely under the hood. On occasion, however, you may need to access services, as this is where raw data from the external services is requested and parsed.

scrilla.services

The four functions of interest in this module are:

  1. scrilla.services.get_daily_price_history(ticker, start_date=None, end_date=None)
    Description:
    This function will retrieve the price history for the equity specified by the ticker argument. ticker must be the symbol associated with the equity on the stock exchange, e.g. MSFT = Microsft, TSLA = Tesla, etc. If no start_date or end_date are provided, the function returns the last 100 trading days worth of information.

    Arguments:

    • ticker : str : Required. Ticker symbol of the equity.
    • start_date: datetime.date : Optional. Start date of analysis range. Defaults to None
    • end_date: datetime.date : Optional. End date of analysis range. Defaults to None

    Returns:
    a dictionary of prices with the YYYY-MM-DD formatted date as key. The dictionary is sorted latest price to earliest price.

  2. scrilla.services.get_daily_stat_history(statistic, start_date=None, end_date=None)
    Description:
    This function will retrieve the price history for the financial statistic specifed by the statistic argument.

    Arguments:

    • statistic : str: Required. Statistic symbol for quantity of interest. A list of allowable values can be found here
    • start_date: datetime.date : Optional. Start date of analysis range. Defaults to None
    • end_date: datetime.date : Optional. End date of analysis range. Defaults to None
  3. scrilla.services.get_dividend_history(ticker)
    Description:
    This function will retrieve the dividend payment history (i.e. the date on which the payment was made, not the date the payment was declared) for the equity specified by the ticker arugment. ticker must be the symobl assoccaited with the equity on the stock exchange.

    Arguments:

    • ticker : str : Required. Ticker symbol of the equity.
  4. scrilla.services.get_risk_free_rate()
    Description:
    This function will retrieve the current value of the risk free rate (annualized yield on a US Treasury). The risk free rate can be configured through the RISK_FREE environment variable. See optional configuration for more details.

scrilla.analysis.markets

  1. scrilla.analysis.markets.sharpe_ratio

  2. scrilla.analysis.markets.market_premium

  3. scrilla.analysis.markets.market_beta

  4. scrilla.analysis.markets.cost_of_equity

scrilla.analysis.optimizer

  1. scrilla.analysis.optimizer.optimize_portfolio_variance

  2. scrilla.analysis.optimizer.maximize_sharpe_ratio

  3. scrilla.analysis.optimizer.maximize_portfolio_return
    Description:
    description goes here

    Note:
    The rate of return of a portfolio of assets is a linear function with respect to the asset weights. IAs a result, this function should always allocate 100% of any given portfolio to the asset with the highest expected rate of return, i.e. if you have two assets where one asset has a 10% rate of return and a second asset has a 20% rate of return, the maximum rate of return for a portfolio composed of both assets is produced when 100% of the portfolio is invested in the asset with a 20% rate of return.

scrilla.analysis.statistics

  1. scrilla.analysis.statistics.sample_correlation

  2. scrilla.analysis.statistics.recursive_rolling_correlation

  3. scrilla.analysis.statistics.sample_mean

  4. scrilla.anaylsis.statistics.recursive_rolling_mean

  5. scrilla.anaylsis.statistics.sample_variance

  6. scrilla.analysis.statistics.recursive_rolling_variance

  7. scrilla.anaylsis.statistics.sample_covariance

  8. scrilla.anaylsis.statistics.recursive_rolling_covariance

  9. scrilla.analysis.statistics.regression_beta

  10. scrilla.analysis.statistics.regression_alpha

  11. scrilla.analysis.statistics.calculate_moving_averages

  12. scrilla.analysis.statistics.calculate_risk_return

  13. scrilla.analysis.statistics.calculate_return_covariance

  14. scrilla.analysis.statistics.calculate_ito_correlation

  15. scrilla.anaylsis.statistics.ito_correlation_matrix

scrilla.objects.cashflow.Cashflow

scrilla.objects.portfolio.Portfolio

You might also like...
Ikaros is a free financial library built in pure python that can be used to get information for single stocks, generate signals and build prortfolios

Ikaros is a free financial library built in pure python that can be used to get information for single stocks, generate signals and build prortfolios

A python wrapper for Alpha Vantage API for financial data.
A python wrapper for Alpha Vantage API for financial data.

alpha_vantage Python module to get stock data/cryptocurrencies from the Alpha Vantage API Alpha Vantage delivers a free API for real time financial da

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

ffn - a financial function library for Python

ffn - Financial Functions for Python Alpha release - please let me know if you find any bugs! If you are looking for a full backtesting framework, ple

Python library for backtesting trading strategies & analyzing financial markets (formerly pythalesians)
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

Common financial technical indicators implemented in Pandas.
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

Experimental solutions to selected exercises from the book [Advances in Financial Machine Learning by Marcos Lopez De Prado]

Advances in Financial Machine Learning Exercises Experimental solutions to selected exercises from the book Advances in Financial Machine Learning by

A resource for learning about deep learning techniques from regression to LSTM and Reinforcement Learning using financial data and the fitness functions of algorithmic trading

A tour through tensorflow with financial data I present several models ranging in complexity from simple regression to LSTM and policy networks. The s

PGPortfolio: Policy Gradient Portfolio, the source code of "A Deep Reinforcement Learning Framework for the Financial Portfolio Management Problem"(https://arxiv.org/pdf/1706.10059.pdf).

This is the original implementation of our paper, A Deep Reinforcement Learning Framework for the Financial Portfolio Management Problem (arXiv:1706.1

This project is a loose implementation of paper "Algorithmic Financial Trading with Deep Convolutional Neural Networks: Time Series to Image Conversion Approach"

Stock Market Buy/Sell/Hold prediction Using convolutional Neural Network This repo is an attempt to implement the research paper titled "Algorithmic F

🔬 A curated list of awesome machine learning strategies & tools in financial market.

🔬 A curated list of awesome machine learning strategies & tools in financial market.

A standalone package to scrape financial data from listed Vietnamese companies via Vietstock

Scrape Financial Data of Vietnamese Listed Companies - Version 2 A standalone package to scrape financial data from listed Vietnamese companies via Vi

FinGAT: A Financial Graph Attention Networkto Recommend Top-K Profitable Stocks
FinGAT: A Financial Graph Attention Networkto Recommend Top-K Profitable Stocks

FinGAT: A Financial Graph Attention Networkto Recommend Top-K Profitable Stocks This is our implementation for the paper: FinGAT: A Financial Graph At

Nasdaq Cloud Data Service (NCDS) provides a modern and efficient method of delivery for realtime exchange data and other financial information. This repository provides an SDK for developing applications to access the NCDS.

Nasdaq Cloud Data Service (NCDS) Nasdaq Cloud Data Service (NCDS) provides a modern and efficient method of delivery for realtime exchange data and ot

The FinQA dataset from paper: FinQA: A Dataset of Numerical Reasoning over Financial Data

Data and code for EMNLP 2021 paper "FinQA: A Dataset of Numerical Reasoning over Financial Data"

Technical Indicators implemented in Python only using Numpy-Pandas as Magic  - Very Very Fast! Very tiny!  Stock Market Financial Technical Analysis Python library .  Quant Trading automation or cryptocoin exchange
Technical Indicators implemented in Python only using Numpy-Pandas as Magic - Very Very Fast! Very tiny! Stock Market Financial Technical Analysis Python library . Quant Trading automation or cryptocoin exchange

MyTT Technical Indicators implemented in Python only using Numpy-Pandas as Magic - Very Very Fast! to Stock Market Financial Technical Analysis Python

Robotic hamster to give you financial advice
Robotic hamster to give you financial advice

hampp Robotic hamster to give you financial advice. I am not liable for any advice that the hamster gives. Follow at your own peril. Description Hampp

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 helping with investments.

Empyrial is a Python-based open-source quantitative investment library dedicated to financial institutions and retail investors
Empyrial is a Python-based open-source quantitative investment library dedicated to financial institutions and retail investors

By Investors, For Investors. Want to read this in Chinese? Click here Empyrial is a Python-based open-source quantitative investment library dedicated

Comments
  • Quandl USTREASURY/YIELD feed no longer exists

    Quandl USTREASURY/YIELD feed no longer exists

    Quandl was acquired by Nasdaq and their APIs were incorporated into the existing data.nasdaq APIs. The support for some of the feeds was dropped in the reshuffling. In particular, the free feed for the yield curve (USTREASURY/YIELD) is no longer refreshed daily and, in fact, hasn't been refreshed since February of this year. This was the feed this application used to determine the latest interest rate. As a result, any calculations involving interest rate since approximately 02-01-2022 (which is virtually every calculation in this application...) will fail, since there is no interest rate to retrieve.

    Currently working on directly parsing the treasury.gov's XML feed for the yield curve instead of Nasdaq/Quandl's Rest API in feature/treasury-data branch.

    opened by chinchalinchin 1
Releases(v1.5.0)
  • v1.5.0(Jun 18, 2022)

    On February 4th, the US Treasury implemented changes to their Yield Curve RSS feed: https://home.treasury.gov/developer-notice-xml-changes

    In addition, Nasdaq's acquisition of Quandl (https://www.nasdaq.com/about/press-center/nasdaq-acquires-quandl-advance-use-alternative-data) recently completed.

    Quandl's RESTful endpoints for the Treasury Yield Curve fell out of support. Whether it was due to the acquisition or the internal changes to the data is unknown. Regardless, the USTREASURY/YIELD endpoint is no longer refreshed. This was the main source of interest rate data for the application.

    This new update hydrates the interest rate data directly from the US Treasury XML RSS feed. The format of the data is not ideal and requires some logical gymnastics to parse. I will keep searching for ways to optimize the parsing algorithm; as it stands the previous functionality has been restored.

    A new service manager named 'treasury' was added to the interest parsing algorithm and configuration was added to the static.py module. Besides this API switch, nothing else in the application has been touched.

    In addition, the US Treasury RSS feed does not require an API key. Also, there does not appear to be any API throttling (?). Anyway, the point is, the application no longer requires a Quandl API key to function. In fact, the application will not function for dates after 2022-02-04 if Quandl is used as the interest rate manager. In a future release, it will be deprecated entirely. As such, the default interest service manager is now set to 'treasury' (it can be switched back to 'quandl' by setting the STAT_MANAGER environment variable accordingly, but this is not recommended for the aforementioned reasons).

    Source code(tar.gz)
    Source code(zip)
    scrilla-1.5.0-py3-none-any.whl(146.87 KB)
    scrilla-1.5.0.tar.gz(123.67 KB)
  • v1.4.0(Nov 29, 2021)

    Massively improved GUI

    GUI actually works now. Argument validation; responsive design; graphs can be exported as PNGs onto local filesystem; tables can be exported as JSON onto local filesystem.

    Configuration abstraction

    GUI widgets are abstracted into a configuration file that gets fed into factory methods to populate the GUI. Similarly, CLI commands have been abstracted into a configuration file; new commands just need to be declared in the definitions.

    Unit tests, documentation generation, pipeline

    A pipeline has been setup to perform unit tests against every push to the main branch and then regenerate documentation. A static web site has been set up on the gh-pages branch to host the documentation.

    General refactoring

    The estimation methods have been improved. Estimating correlation through percentiles is now done through Gaussian copulas and results in a massively decrease execution time. The moving average algorithms have been condensed and optimized.

    Various statistical functions

    Functions have been added to calculate sample percentiles, empirical copulas, multivariate likelihoods, and much more.

    Source code(tar.gz)
    Source code(zip)
    scrilla-1.4.0-py3-none-any.whl(144.71 KB)
    scrilla-1.4.0.tar.gz(121.03 KB)
  • v1.3.0(Sep 26, 2021)

    Minor Update: Version 1.3.0

    Features

    1. QQ plot for sample returns to graphically assess normality. To view, scrilla -plot-rets DIS

    2. Sample statistical and point estimation can now be configured, either through an environment variable DEFAULT_ESTIMATION_METHOD or by passing in a flag to statistical estimator function. The available estimation techniques are current ly moment-matching (moments), percentile-match (percents) and maximum likelihood estimation ('likely'). For example, scrilla -cor -likely BX ALLY will estimate the correlation between BX and ALLY using maximum likelihood estimation, whereas scrilla -cor -moments BX ALLY will estimate the correlation using the method of moment matching. If no flag is passed in, the method will default to whatever value is set in DEFAULT_ESTIMATION_METHOD.

    Source code(tar.gz)
    Source code(zip)
    scrilla-1.3.0-py3-none-any.whl(113.24 KB)
    scrilla-1.3.0.tar.gz(106.02 KB)
  • v1.2.0(Sep 13, 2021)

    Minor Update: Version 1.2.0

    Features

    • SQLite for faster caching. All IO now goes through a local SQLite database for faster reading and writing.
    • Storage of API credentials through CLI instead of environment variables, i.e. in addition

    scrilla -store ALPHA_VANTAGE_KEY=mykeygoeshere

    Keys are stored unencrypted in the installation directory/data/common directory. Environment_ variables are still recommended for storage of API credentials for this reason.

    • Conditional value at risk portfolio optimization function now available. The function currently assumes a Black Scholes model (i.e., the stock return is lognormally distributed) for calculating the percentiles. For example,

    scrilla -opt-cvar -prob 0.05 -expiry 0.5 ALLY BX SONY ACI

    will minimize the value at risk for outcomes at the end of a half year (-expiry=0.5) occurring in the 5th percentile (-prob=0.05 ) of the distribution created through a portfolio of ALLY, BX, SONY, and ACI.

    • Improved error handling and general performance upgrades. Use of global variables in files module to prevent excessive IO, new exception classes in errors module now thrown through the program, etc.
    Source code(tar.gz)
    Source code(zip)
    scrilla-1.2.0-py3-none-any.whl(88.94 KB)
    scrilla-1.2.0.tar.gz(88.55 KB)
  • v1.0.0(Aug 29, 2021)

Owner
Grant Moore
chinchalinchin is written and produced by a team of twenty award-winning film makers and artists.
Grant Moore
Supply a wrapper ``StockDataFrame`` based on the ``pandas.DataFrame`` with inline stock statistics/indicators support.

Stock Statistics/Indicators Calculation Helper VERSION: 0.3.2 Introduction Supply a wrapper StockDataFrame based on the pandas.DataFrame with inline s

Cedric Zhuang 1.1k Dec 28, 2022
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
Github.com/CryptoSignal - #1 Quant Trading & Technical Analysis Bot - 2,100 + stars, 580 + forks

CryptoSignal - #1 Quant Trading & Technical Analysis Bot - 2,100 + stars, 580 + forks https://github.com/CryptoSignal/Crypto-Signal Development state:

Github.com/Signal - 2,100 + stars, 580 + forks 4.2k Jan 01, 2023
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
personal finance tracker, written in python 3 and using the wxPython GUI toolkit.

personal finance tracker, written in python 3 and using the wxPython GUI toolkit.

wenbin wu 23 Oct 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
ffn - a financial function library for Python

ffn - Financial Functions for Python Alpha release - please let me know if you find any bugs! If you are looking for a full backtesting framework, ple

Philippe Morissette 1.4k Jan 01, 2023
A python wrapper for Alpha Vantage API for financial data.

alpha_vantage Python module to get stock data/cryptocurrencies from the Alpha Vantage API Alpha Vantage delivers a free API for real time financial da

Romel Torres 3.8k Jan 07, 2023
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
An open source reinforcement learning framework for training, evaluating, and deploying robust trading agents.

TensorTrade: Trade Efficiently with Reinforcement Learning TensorTrade is still in Beta, meaning it should be used very cautiously if used in producti

4k Dec 30, 2022
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
Find big moving stocks before they move using machine learning and anomaly detection

Surpriver - Find High Moving Stocks before they Move Find high moving stocks before they move using anomaly detection and machine learning. Surpriver

Tradytics 1.5k Dec 31, 2022
:mag_right: :chart_with_upwards_trend: :snake: :moneybag: Backtest trading strategies in Python.

Backtesting.py Backtest trading strategies with Python. Project website Documentation the project if you use it. Installation $ pip install backtestin

3.1k Dec 31, 2022
Portfolio and risk analytics in Python

pyfolio pyfolio is a Python library for performance and risk analysis of financial portfolios developed by Quantopian Inc. It works well with the Zipl

Quantopian, Inc. 4.8k Jan 08, 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
Python Algorithmic Trading Library

PyAlgoTrade PyAlgoTrade is an event driven algorithmic trading Python library. Although the initial focus was on backtesting, paper trading is now pos

Gabriel Becedillas 3.9k Jan 01, 2023
stock data on eink with raspberry

small python skript to display tradegate data on a waveshare e-ink important you need locale "de_AT.UTF-8 UTF-8" installed. do so in raspi-config's Lo

Simon Oberhammer 24 Feb 22, 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
Software for quick purchase of mystery boxes on Binance.

english | русский язык Software for quick purchase of mystery boxes on Binance. Purpose Installation & setup Motivation Specification Disclaimer Purpo

Ellis 5 Mar 08, 2022