Skip to main content

VaR-Rule for FX Interventions

Link to the Python notebook: https://github.com/romainlafarguette/VaR-FX-Interventions/blob/master/notebooks/VaR-FX%20Interventions.ipynb

The Python notebook replicates the tables and the charts of the IMF WP on "Foreign Exchange Interventions Rules for Central Banks: A Risk-Based Framework"

IMPORTANT: BECAUSE OF AN UPDATE OF THE ARCH PACKAGE AFTER 4.19, and in particular the random number generator, the way the random seed is managed has changed. Some results are therefore slightly different (e.g. the pdf plot) by a few pips as in the IMF WP, but are qualitatively similar. The journal version will reflect the new version

The paper uses a Python package that I have written, DistGARCH, also available in this Github folder, with the public FX intervention data from the Banco Mexico. DistGARCH is based on the ARCH package of Kevin Sheppard.

You can use the code for non-commercial applications, providing that you cite the IMF Working Paper Lafarguette, R. and Veyrune, R. (2020) "Foreign Exchange Interventions Rules for Central Banks: A Risk-Based Framework", IMF Working Paper

The folder is organized as follows:

  • mxn_estimation.py is the pure Python file with the core estimation and robustness analysis
  • VaR-FX Interventions.ipynb is a Jupyter notebook, which illustrates the approach
  • modules/ contains the modules for this project, in particular distGARCH which infers a conditional distribution from a GARCH model
  • data/ contains public data files, with FX rate and FX interventions from Banco Mexico website
  • img/ contains some images to illustrate the Jupyter Notebook

Reuse of this tool and IMF data does not imply any endorsement of the research and/or product. Any research presented should not be reported as representing the views of the IMF, its Executive Board, or member governments.

Note that the Github repo contains only publicly available data.

Author: Romain Lafarguette, August 2020

If you have any question, please contact me via Github or rlafarguette "at" imf "dot" org

Metadata

Release files for varfxi 0.0.4

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

Source distribution (sdist)

Source distribution for varfxi 0.0.4
File Size Uploaded Provenance Actions
varfxi-0.0.4.tar.gz 86.9 kB Without provenance Details for varfxi-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for varfxi 0.0.4
File Interpreter ABI Platform Actions
varfxi-0.0.4-py3-none-any.whl Python 3 none any Details for varfxi-0.0.4-py3-none-any.whl

Total release size: 176.3 kB

Release files / varfxi-0.0.4.tar.gz

Download URL varfxi-0.0.4.tar.gz
Size 86.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d2716b001ac3a341cf55add2115f78c7e1e332f416c5b17e8d1d961a7b261af2
BLAKE2b-256 checksum
How to use checksums
f98c2e09ddd064d11d646972c3b0fef3def78b24c50e14fcf587e290e757c1c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.7

Release files / varfxi-0.0.4-py3-none-any.whl

Download URL varfxi-0.0.4-py3-none-any.whl
Size 89.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7dc90efbf07a31032c180b613c572cf98386e6c6626df9df2f5108f982ada270
BLAKE2b-256 checksum
How to use checksums
6d5cdafc88cec28a4ca183ee5ac90f1fc11b5f97cd9062fa7ea705b6b7d3539c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.7

Security for varfxi 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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