{"id":13449702,"url":"https://github.com/google/tf-quant-finance","last_synced_at":"2025-05-14T22:04:10.656Z","repository":{"id":37285979,"uuid":"198669252","full_name":"google/tf-quant-finance","owner":"google","description":"High-performance TensorFlow library for quantitative finance.","archived":false,"fork":false,"pushed_at":"2025-03-21T14:29:57.000Z","size":17746,"stargazers_count":4857,"open_issues_count":38,"forks_count":619,"subscribers_count":172,"default_branch":"master","last_synced_at":"2025-05-14T22:02:36.541Z","etag":null,"topics":["finance","gpu","gpu-computing","high-performance","high-performance-computing","numerical-integration","numerical-methods","numerical-optimization","python","quantitative-finance","quantlib","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-24T16:09:50.000Z","updated_at":"2025-05-13T19:46:42.000Z","dependencies_parsed_at":"2024-06-18T21:21:22.083Z","dependency_job_id":"959a73eb-2cb3-4843-8110-1b0c71bffae8","html_url":"https://github.com/google/tf-quant-finance","commit_stats":{"total_commits":922,"total_committers":47,"mean_commits":"19.617021276595743","dds":0.6540130151843817,"last_synced_commit":"d5607b05b942645a6c5aa9a5c1b0f97480ab1105"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Ftf-quant-finance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Ftf-quant-finance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Ftf-quant-finance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Ftf-quant-finance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google","download_url":"https://codeload.github.com/google/tf-quant-finance/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254235686,"owners_count":22036962,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["finance","gpu","gpu-computing","high-performance","high-performance-computing","numerical-integration","numerical-methods","numerical-optimization","python","quantitative-finance","quantlib","tensorflow"],"created_at":"2024-07-31T06:00:51.790Z","updated_at":"2025-05-14T22:04:10.615Z","avatar_url":"https://github.com/google.png","language":"Python","readme":"# TF Quant Finance: TensorFlow based Quant Finance Library (ARCHIVED)\n\n\u003e [!IMPORTANT]\n\u003e This library is no longer maintained and has been archived. If you depend on\n\u003e the functionality provided by this library, we suggest to fork it and continue\n\u003e development elsewhere.\n\n[![Build Status](https://storage.googleapis.com/tf-quant-finance-build-result/status.svg?)](https://storage.googleapis.com/tf-quant-finance-build-result/logs.txt)\n\n## Table of contents\n1. [Introduction](#introduction)\n2. [Installation](#installation)\n3. [TensorFlow training](#tensorflow-training)\n4. [Development roadmap](#development-roadmap)\n5. [Examples](#examples)\n6. [Contributing](#contributing)\n7. [Development](#development)\n8. [Community](#community)\n9. [Disclaimers](#disclaimers)\n10. [License](#license)\n\n## Introduction\n\nThis library provides high-performance components leveraging the hardware\nacceleration support and automatic differentiation of TensorFlow. The\nlibrary will provide TensorFlow support for foundational mathematical methods,\nmid-level methods, and specific pricing models. The coverage is being\nexpanded over the next few months.\n\nThe library is structured along three tiers:\n\n1. **Foundational methods**.\nCore mathematical methods - optimisation, interpolation, root finders,\nlinear algebra, random and quasi-random number generation, etc.\n\n2. **Mid-level methods**.\nODE \u0026 PDE solvers, Ito process framework, Diffusion Path Generators,\nCopula samplers etc.\n\n3. **Pricing methods and other quant finance specific utilities**.\nSpecific Pricing models (e.g., Local Vol (LV), Stochastic Vol (SV),\nStochastic Local Vol (SLV), Hull-White (HW)) and their calibration.\nRate curve building, payoff descriptions, and schedule generation.\n\nWe aim for the library components to be easily accessible at each level. Each layer will be accompanied by many examples that can run independently of\nhigher-level components.\n\n## Installation\n\nThe easiest way to get started with the library is via the pip package.\n\nNote that the library requires Python 3.7 and Tensorflow \u003e= 2.7.\n\nFirst, please install the most recent version of TensorFlow by following\nthe [TensorFlow installation instructions](https://tensorflow.org/install).\nFor example, you could install TensorFlow\n\n```sh\npip3 install --upgrade tensorflow\n```\n\nThen run\n\n```sh\npip3 install --upgrade tf-quant-finance\n```\n\nYou maybe also have to use the option ```--user```.\n\n## TensorFlow training\n\nIf you are not familiar with TensorFlow, an excellent place to get started is with the\nfollowing self-study introduction to TensorFlow notebooks:\n\n   * [Introduction to TensorFlow Part 1 - Basics](https://colab.research.google.com/github/google/tf-quant-finance/blob/master/tf_quant_finance/examples/jupyter_notebooks/Introduction_to_TensorFlow_Part_1_-_Basics.ipynb).\n   * [Introduction to TensorFlow Part 2 - Debugging and Control Flow](https://colab.research.google.com/github/google/tf-quant-finance/blob/master/tf_quant_finance/examples/jupyter_notebooks/Introduction_to_TensorFlow_Part_2_-_Debugging_and_Control_Flow.ipynb).\n   * [Introduction to TensorFlow Part 3 - Advanced Tensor Manipulation](https://colab.research.google.com/github/google/tf-quant-finance/blob/master/tf_quant_finance/examples/jupyter_notebooks/Introduction_to_TensorFlow_Part_3_-_Advanced_Tensor_Manipulation.ipynb).\n\n## Development roadmap\n\nWe are working on expanding the coverage of the library. Areas under active development are:\n\n  * Ito Processes: Framework for defining [Ito processes](https://en.wikipedia.org/wiki/It%C3%B4_calculus#It%C3%B4_processes).\n  Includes methods for sampling paths from a process and for solving the\n  associated backward Kolmogorov equation.\n  * Implementation of the following specific processes/models:\n      * Brownian Motion\n      * Geometric Brownian Motion\n      * Ornstein-Uhlenbeck\n      * One-Factor Hull-White model\n      * Heston model\n      * Local volatility model.\n      * Quadratic Local Vol model.\n      * SABR model\n  * Copulas: Support for defining and sampling from copulas.\n  * Model Calibration:\n      * Dupire local vol calibration.\n      * SABR model calibration.\n  * Rate curve fitting: Hagan-West algorithm for yield curve bootstrapping and the Monotone Convex interpolation scheme.\n  * Support for dates, day-count conventions, holidays, etc.\n\n\n## Examples\n\nSee [`tf_quant_finance/examples/`](https://github.com/google/tf-quant-finance/tree/master/tf_quant_finance/examples)\nfor end-to-end examples. It includes tutorial notebooks such as:\n\n  *   [American Option pricing under the Black-Scholes model](https://colab.research.google.com/github/google/tf-quant-finance/blob/master/tf_quant_finance/examples/jupyter_notebooks/American_Option_Black_Scholes.ipynb)\n  *   [Monte Carlo via Euler Scheme](https://colab.research.google.com/github/google/tf-quant-finance/blob/master/tf_quant_finance/examples/jupyter_notebooks/Monte_Carlo_Euler_Scheme.ipynb)\n  *   [Black Scholes: Price and Implied Vol](https://colab.research.google.com/github/google/tf-quant-finance/blob/master/tf_quant_finance/examples/jupyter_notebooks/Black_Scholes_Price_and_Implied_Vol.ipynb)\n  *   [Forward and Backward mode gradients in TFF](https://colab.research.google.com/github/google/tf-quant-finance/blob/master/tf_quant_finance/examples/jupyter_notebooks/Forward_Backward_Diff.ipynb)\n  *   [Root search using Brent's method](https://colab.research.google.com/github/google/tf-quant-finance/blob/master/tf_quant_finance/examples/jupyter_notebooks/Root_Search.ipynb)\n  *   [Optimization](https://colab.research.google.com/github/google/tf-quant-finance/blob/master/tf_quant_finance/examples/jupyter_notebooks/Optimization.ipynb)\n  *   [Swap Curve Fitting](https://colab.research.google.com/github/google/tf-quant-finance/blob/master/tf_quant_finance/examples/jupyter_notebooks/Swap_Curve_Fitting.ipynb)\n  *   [Vectorization and XLA compilation](https://colab.research.google.com/github/google/tf-quant-finance/blob/master/tf_quant_finance/examples/jupyter_notebooks/Vectorization_and_XLA_compilation.ipynb)\n\nThe above links will open Jupyter Notebooks in Colab.\n\n## Contributing\n\nWe're eager to collaborate with you! See [CONTRIBUTING.md](CONTRIBUTING.md) for a guide on how to contribute. This project adheres to TensorFlow's code of conduct. By participating, you are expected to uphold this code.\n\n## Development\n\nThis section is for developers who want to contribute code to the\nlibrary. If you are only interested in using the library, please follow the\ninstructions in the [Installation](#installation) section.\n\n### Development dependencies\n\nThis library has the following dependencies:\n\n1.  Bazel\n2.  Python 3 (Bazel uses Python 3 by default)\n3.  TensorFlow version \u003e= 2.7\n4.  TensorFlow Probability version between v0.11.0 and v0.12.1\n5.  Numpy version 1.21 or higher\n6.  Attrs\n7.  Dataclasses (not needed if your Python version \u003e= 3.7)\n\nThis library requires the\n[Bazel](https://bazel.build/) build system. Please follow the\n[Bazel installation instructions](https://docs.bazel.build/versions/master/install.html)\nfor your platform.\n\n\nYou can install TensorFlow and related dependencies using the ```pip3 install```\ncommand:\n\n```sh\npip3 install --upgrade tf-nightly tensorflow-probability==0.12.1 numpy==1.21 attrs dataclasses\n```\n\n### Commonly used commands\n\nClone the GitHub repository:\n\n```sh\ngit clone https://github.com/google/tf-quant-finance.git\n```\n\nAfter you run\n\n```sh\ncd tf_quant_finance\n```\n\nyou can execute tests using the ```bazel test``` command. For example,\n\n```sh\nbazel test tf_quant_finance/math/random_ops/sobol:sobol_test\n```\n\nwill run tests in\n[sobol_test.py](https://github.com/google/tf-quant-finance/blob/master/tf_quant_finance/math/random_ops/sobol/sobol_test.py)\n.\n\nTests run using Python version 3. Please make sure that you can\nrun ```import tensorflow``` in the Python 3 shell. Otherwise, tests might fail.\n\n### Building a custom pip package\n\nThe following commands will build custom pip package from source and install it:\n\n```sh\n# sudo apt-get install bazel git python python-pip rsync # For Ubuntu.\ngit clone https://github.com/google/tf-quant-finance.git\ncd tf-quant-finance\nbazel build :build_pip_pkg\n./bazel-bin/build_pip_pkg artifacts\npip install --user --upgrade artifacts/*.whl\n```\n\n## Community\n\n1. [GitHub repository](https://github.com/google/tf-quant-finance): Report bugs or make feature requests.\n\n2. [TensorFlow Blog](https://blog.tensorflow.org/): Stay up to date on content from the TensorFlow team and best articles from the community.\n\n3. tf-quant-finance@googlegroups.com: Open mailing list for discussion and questions of this library.\n\n4. TensorFlow Probability: This library will leverage methods from [TensorFlow Probability](https://www.tensorflow.org/probability) (TFP).\n\n## Disclaimers\n\nGoogle does not officially support this product. This library is under active development, and interfaces may change at any time.\n\n## License\n\nThis library is licensed under the Apache 2 license (see [LICENSE](LICENSE)). This library uses Sobol primitive polynomials and initial direction numbers\nwhich are licensed under the BSD license.\n","funding_links":[],"categories":["Analytics","Exchange API","Python","Analytic tools","金融数据处理","By Industry","Artificial Intelligence","Time-Series \u0026 Financial","tensorflow","Applications"],"sub_categories":["Pricing","Framework","Finance","Machine Learning","Others","Financial Instruments and Pricing","金融工具与定价"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Ftf-quant-finance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle%2Ftf-quant-finance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Ftf-quant-finance/lists"}