Skip to main content

This package provides functions for implementing the Almgren-Chriss model for optimal execution of portfolio transactions.

What is the Almgren-Chriss Model?

The Almgren-Chriss model is a mathematical model used in financial markets to determine the optimal way to execute large orders. The model takes into account various factors such as the risk tolerance of the trader, the volatility of the market, and the impact of the trade on the market price. The goal of the model is to minimize the expected cost of the trade while taking into account the risk of price fluctuations.

Functions in the Package

The package provides the following functions:

  • cost_expectation: Calculate the expected cost of trading.

  • cost_variance: Calculate the variance of the cost of trading.

  • decay_rate: Calculate the trade decay rate.

  • trade_trajectory: Calculate the trading trajectory.

  • trade_list: Calculate the list of trades.

Each function takes various parameters including risk tolerance, interval between trades, volatility, permanent impact slope, temporary impact slope, total number of shares, and trading duration.

Example

Here is an example of how to use the functions in the package:

from almgren_chriss import trade_trajectory, trade_list, cost_expectation, cost_variance


lambda_ = 2e-6
tau = 1
sigma = 0.95
gamma = 2.5e-7
eta = 2.5e-6
epsilon = 0.0625
X = 1e06
T = 5
>>> trade_trajectory(lambda_, tau, sigma, gamma, eta, X, T)
array([1000000.0, 428598.84574702, 182932.81426177, 76295.72161546, 27643.37739691, 0.0])
docs/assets/trade_trajectory.png
>>> trade_list(lambda_, tau, sigma, gamma, eta, X, T)
array([571401.15425298, 245666.03148525, 106637.09264631, 48652.34421856, 27643.37739691])
docs/assets/trade_list.png
>>> cost_expectation(lambda_, tau, sigma, gamma, eta, epsilon, X, T)
1140715.1670497851
>>> import math
>>> math.sqrt(cost_variance(lambda_, tau, sigma, gamma, eta, X, T))
449367.65254135116

Release files for almgren-chriss 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for almgren-chriss 1.1.0
File Size Uploaded
almgren_chriss-1.1.0.tar.gz 15.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for almgren-chriss 1.1.0
File Interpreter ABI Platform
almgren_chriss-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.1 kB

Release files / almgren_chriss-1.1.0.tar.gz

Download URL almgren_chriss-1.1.0.tar.gz
Size 15.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4f06cd002be6ba49e8a0e2b71b35333b0fb75356cd21338d7c25aed4fb41e898
BLAKE2b-256 checksum
How to use checksums
262ba71fbf44e845896fed56023b7f50a84eb2c575f3b621f6450422a416170e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.3

Release files / almgren_chriss-1.1.0-py3-none-any.whl

Download URL almgren_chriss-1.1.0-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3812be0e604d18bdd9f2454e6ee0a9e7df360498899f9330d4b2e0b7cd273249
BLAKE2b-256 checksum
How to use checksums
c14fcfc43e0f8bc20a086a4a2ebef86f6663bdaaa06216ff6bd043b94d577487
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.3

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page