Skip to main content

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

Project description

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])
assets/trade_trajectory.png
>>> trade_list(lambda_, tau, sigma, gamma, eta, X, T)
array([571401.15425298, 245666.03148525, 106637.09264631, 48652.34421856, 27643.37739691])
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

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

almgren_chriss-1.0.1.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

almgren_chriss-1.0.1-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file almgren_chriss-1.0.1.tar.gz.

File metadata

  • Download URL: almgren_chriss-1.0.1.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for almgren_chriss-1.0.1.tar.gz
Algorithm Hash digest
SHA256 7b09014d7c59f1da44de7d2c036d8f67bd6b456c9d47fbf26d32c775431e2872
MD5 543ce2dadb99691985c14cd39f3f6f65
BLAKE2b-256 4d56cea0850886372babeb266e6b7305cdccffc5aafd7bfbf6d898e4d61ea1c8

See more details on using hashes here.

File details

Details for the file almgren_chriss-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for almgren_chriss-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c18810ab474f1a768071e3c125fe733ab2ad5cc33ea657f0b47bd615bfe2c9b0
MD5 b05172f66c5ae68bf1fa26773aeecd43
BLAKE2b-256 06e75f3b94cdea1031e9255d3310ab2be3d69538ac775ee3eb79e75f319dd3d8

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