almgren-chriss


Namealmgren-chriss JSON
Version 1.1.0 PyPI version JSON
download
home_page
Summaryfunctions for implementing the Almgren-Chriss model for optimal execution of portfolio transactions.
upload_time2023-05-30 19:19:44
maintainer
docs_urlNone
authorBernardo Paulsen
requires_python>=3.10,<4.0
licenseGNU General Public License
keywords optimal exeuction quantitative finance almgren chriss
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            almgren-chriss
==============

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:

.. code-block:: python

   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])

.. image:: 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])

.. image:: 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


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "almgren-chriss",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "optimal exeuction,quantitative finance,Almgren Chriss",
    "author": "Bernardo Paulsen",
    "author_email": "paulsen.bernardo@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/26/2b/a71fbf44e845896fed56023b7f50a84eb2c575f3b621f6450422a416170e/almgren_chriss-1.1.0.tar.gz",
    "platform": null,
    "description": "almgren-chriss\n==============\n\nThis package provides functions for implementing the Almgren-Chriss model for optimal execution of portfolio transactions.\n\nWhat is the Almgren-Chriss Model?\n---------------------------------\n\nThe Almgren-Chriss model is a mathematical model used in financial markets to determine the optimal way to execute large\norders. The model takes into account various factors such as the risk tolerance of the trader, the volatility of the\nmarket, and the impact of the trade on the market price. The goal of the model is to minimize the expected cost of the\ntrade while taking into account the risk of price fluctuations.\n\nFunctions in the Package\n------------------------\n\nThe package provides the following functions:\n\n- `cost_expectation`: Calculate the expected cost of trading.\n- `cost_variance`: Calculate the variance of the cost of trading.\n- `decay_rate`: Calculate the trade decay rate.\n- `trade_trajectory`: Calculate the trading trajectory.\n- `trade_list`: Calculate the list of trades.\n\nEach function takes various parameters including risk tolerance, interval between trades, volatility, permanent impact\nslope, temporary impact slope, total number of shares, and trading duration.\n\nExample\n-------\n\nHere is an example of how to use the functions in the package:\n\n.. code-block:: python\n\n   from almgren_chriss import trade_trajectory, trade_list, cost_expectation, cost_variance\n\n\n   lambda_ = 2e-6\n   tau = 1\n   sigma = 0.95\n   gamma = 2.5e-7\n   eta = 2.5e-6\n   epsilon = 0.0625\n   X = 1e06\n   T = 5\n\n>>> trade_trajectory(lambda_, tau, sigma, gamma, eta, X, T)\narray([1000000.0, 428598.84574702, 182932.81426177, 76295.72161546, 27643.37739691, 0.0])\n\n.. image:: docs/assets/trade_trajectory.png\n\n>>> trade_list(lambda_, tau, sigma, gamma, eta, X, T)\narray([571401.15425298, 245666.03148525, 106637.09264631, 48652.34421856, 27643.37739691])\n\n.. image:: docs/assets/trade_list.png\n\n>>> cost_expectation(lambda_, tau, sigma, gamma, eta, epsilon, X, T)\n1140715.1670497851\n\n>>> import math\n>>> math.sqrt(cost_variance(lambda_, tau, sigma, gamma, eta, X, T))\n449367.65254135116\n\n",
    "bugtrack_url": null,
    "license": "GNU General Public License",
    "summary": "functions for implementing the Almgren-Chriss model for optimal execution of portfolio transactions.",
    "version": "1.1.0",
    "project_urls": {
        "Documentation": "https://bernardopaulsen.github.io/almgren-chriss/",
        "GitHub": "https://github.com/bernardopaulsen/almngren-chriss"
    },
    "split_keywords": [
        "optimal exeuction",
        "quantitative finance",
        "almgren chriss"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c14fcfc43e0f8bc20a086a4a2ebef86f6663bdaaa06216ff6bd043b94d577487",
                "md5": "00bce6754bfbbc26e813b3e081a59e6b",
                "sha256": "3812be0e604d18bdd9f2454e6ee0a9e7df360498899f9330d4b2e0b7cd273249"
            },
            "downloads": -1,
            "filename": "almgren_chriss-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "00bce6754bfbbc26e813b3e081a59e6b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 17464,
            "upload_time": "2023-05-30T19:19:43",
            "upload_time_iso_8601": "2023-05-30T19:19:43.315092Z",
            "url": "https://files.pythonhosted.org/packages/c1/4f/cfc43e0f8bc20a086a4a2ebef86f6663bdaaa06216ff6bd043b94d577487/almgren_chriss-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "262ba71fbf44e845896fed56023b7f50a84eb2c575f3b621f6450422a416170e",
                "md5": "4cd03de57cacfeeb8d2a256739445b0b",
                "sha256": "4f06cd002be6ba49e8a0e2b71b35333b0fb75356cd21338d7c25aed4fb41e898"
            },
            "downloads": -1,
            "filename": "almgren_chriss-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4cd03de57cacfeeb8d2a256739445b0b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 15677,
            "upload_time": "2023-05-30T19:19:44",
            "upload_time_iso_8601": "2023-05-30T19:19:44.986874Z",
            "url": "https://files.pythonhosted.org/packages/26/2b/a71fbf44e845896fed56023b7f50a84eb2c575f3b621f6450422a416170e/almgren_chriss-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-30 19:19:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bernardopaulsen",
    "github_project": "almngren-chriss",
    "github_not_found": true,
    "lcname": "almgren-chriss"
}
        
Elapsed time: 2.30788s