https://github.com/google/tf-quant-finance

High-performance TensorFlow library for quantitative finance.

https://github.com/google/tf-quant-finance

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.1%) to scientific vocabulary

Keywords

finance gpu gpu-computing high-performance high-performance-computing numerical-integration numerical-methods numerical-optimization python quantitative-finance quantlib tensorflow

Keywords from Contributors

distributed deep-neural-networks jax transformer cryptocurrencies reinforcement-learning research calculator physics data-integration
Last synced: 5 months ago · JSON representation

Repository

High-performance TensorFlow library for quantitative finance.

Basic Info
  • Host: GitHub
  • Owner: google
  • License: apache-2.0
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 16.9 MB
Statistics
  • Stars: 4,971
  • Watchers: 174
  • Forks: 635
  • Open Issues: 37
  • Releases: 4
Topics
finance gpu gpu-computing high-performance high-performance-computing numerical-integration numerical-methods numerical-optimization python quantitative-finance quantlib tensorflow
Created over 6 years ago · Last pushed 11 months ago
Metadata Files
Readme Contributing License

README.md

TF Quant Finance: TensorFlow based Quant Finance Library (ARCHIVED)

[!IMPORTANT] This library is no longer maintained and has been archived. If you depend on the functionality provided by this library, we suggest to fork it and continue development elsewhere.

Build Status

Table of contents

  1. Introduction
  2. Installation
  3. TensorFlow training
  4. Development roadmap
  5. Examples
  6. Contributing
  7. Development
  8. Community
  9. Disclaimers
  10. License

Introduction

This library provides high-performance components leveraging the hardware acceleration support and automatic differentiation of TensorFlow. The library will provide TensorFlow support for foundational mathematical methods, mid-level methods, and specific pricing models. The coverage is being expanded over the next few months.

The library is structured along three tiers:

  1. Foundational methods. Core mathematical methods - optimisation, interpolation, root finders, linear algebra, random and quasi-random number generation, etc.

  2. Mid-level methods. ODE & PDE solvers, Ito process framework, Diffusion Path Generators, Copula samplers etc.

  3. Pricing methods and other quant finance specific utilities. Specific Pricing models (e.g., Local Vol (LV), Stochastic Vol (SV), Stochastic Local Vol (SLV), Hull-White (HW)) and their calibration. Rate curve building, payoff descriptions, and schedule generation.

We 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 higher-level components.

Installation

The easiest way to get started with the library is via the pip package.

Note that the library requires Python 3.7 and Tensorflow >= 2.7.

First, please install the most recent version of TensorFlow by following the TensorFlow installation instructions. For example, you could install TensorFlow

sh pip3 install --upgrade tensorflow

Then run

sh pip3 install --upgrade tf-quant-finance

You maybe also have to use the option --user.

TensorFlow training

If you are not familiar with TensorFlow, an excellent place to get started is with the following self-study introduction to TensorFlow notebooks:

Development roadmap

We are working on expanding the coverage of the library. Areas under active development are:

  • Ito Processes: Framework for defining Ito processes. Includes methods for sampling paths from a process and for solving the associated backward Kolmogorov equation.
  • Implementation of the following specific processes/models:
    • Brownian Motion
    • Geometric Brownian Motion
    • Ornstein-Uhlenbeck
    • One-Factor Hull-White model
    • Heston model
    • Local volatility model.
    • Quadratic Local Vol model.
    • SABR model
  • Copulas: Support for defining and sampling from copulas.
  • Model Calibration:
    • Dupire local vol calibration.
    • SABR model calibration.
  • Rate curve fitting: Hagan-West algorithm for yield curve bootstrapping and the Monotone Convex interpolation scheme.
  • Support for dates, day-count conventions, holidays, etc.

Examples

See tf_quant_finance/examples/ for end-to-end examples. It includes tutorial notebooks such as:

The above links will open Jupyter Notebooks in Colab.

Contributing

We're eager to collaborate with you! See 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.

Development

This section is for developers who want to contribute code to the library. If you are only interested in using the library, please follow the instructions in the Installation section.

Development dependencies

This library has the following dependencies:

  1. Bazel
  2. Python 3 (Bazel uses Python 3 by default)
  3. TensorFlow version >= 2.7
  4. TensorFlow Probability version between v0.11.0 and v0.12.1
  5. Numpy version 1.21 or higher
  6. Attrs
  7. Dataclasses (not needed if your Python version >= 3.7)

This library requires the Bazel build system. Please follow the Bazel installation instructions for your platform.

You can install TensorFlow and related dependencies using the pip3 install command:

sh pip3 install --upgrade tf-nightly tensorflow-probability==0.12.1 numpy==1.21 attrs dataclasses

Commonly used commands

Clone the GitHub repository:

sh git clone https://github.com/google/tf-quant-finance.git

After you run

sh cd tf_quant_finance

you can execute tests using the bazel test command. For example,

sh bazel test tf_quant_finance/math/random_ops/sobol:sobol_test

will run tests in sobol_test.py .

Tests run using Python version 3. Please make sure that you can run import tensorflow in the Python 3 shell. Otherwise, tests might fail.

Building a custom pip package

The following commands will build custom pip package from source and install it:

```sh

sudo apt-get install bazel git python python-pip rsync # For Ubuntu.

git clone https://github.com/google/tf-quant-finance.git cd tf-quant-finance bazel build :buildpippkg ./bazel-bin/buildpippkg artifacts pip install --user --upgrade artifacts/*.whl ```

Community

  1. GitHub repository: Report bugs or make feature requests.

  2. TensorFlow Blog: Stay up to date on content from the TensorFlow team and best articles from the community.

  3. tf-quant-finance@googlegroups.com: Open mailing list for discussion and questions of this library.

  4. TensorFlow Probability: This library will leverage methods from TensorFlow Probability (TFP).

Disclaimers

Google does not officially support this product. This library is under active development, and interfaces may change at any time.

License

This library is licensed under the Apache 2 license (see LICENSE). This library uses Sobol primitive polynomials and initial direction numbers which are licensed under the BSD license.

Owner

  • Name: Google
  • Login: google
  • Kind: organization
  • Email: opensource@google.com
  • Location: United States of America

Google ❤️ Open Source

GitHub Events

Total
  • Issues event: 2
  • Watch event: 434
  • Issue comment event: 1
  • Push event: 4
  • Pull request event: 2
  • Fork event: 62
Last Year
  • Issues event: 2
  • Watch event: 434
  • Issue comment event: 1
  • Push event: 4
  • Pull request event: 2
  • Fork event: 62

Committers

Last synced: 6 months ago

All Time
  • Total Commits: 930
  • Total Committers: 50
  • Avg Commits per committer: 18.6
  • Development Distribution Score (DDS): 0.657
Past Year
  • Commits: 4
  • Committers: 3
  • Avg Commits per committer: 1.333
  • Development Distribution Score (DDS): 0.5
Top Committers
Name Email Commits
Cyril Chimisov c****v@g****m 319
Matej Rizman m****r@g****m 126
Ashish Saxena s****s@g****m 81
Amit Varshney a****y@g****m 61
Pavel Shmakov p****v@g****m 55
Nomisma Team t****t@g****m 45
Juan A. Navarro Pérez p****u@g****m 32
devarakondav d****5@g****m 28
Matthew Pearce m****e@g****m 21
Yilei Yang y****g@g****m 19
Chris Lee c****e@g****m 14
Yun Liu y****l@g****m 13
rajflume 6****e@u****m 13
Viktoria Csizmadia v****c@g****m 10
Mark Bean m****n@g****m 9
Alex Lembcke a****e@g****m 7
Yves Gaeremynck y****k@g****m 7
Andrey Shulyatyev a****h@g****m 6
Claire Charron c****n@g****m 6
Mark Charsley m****y@g****m 6
Dmytro Fedoriaka f****r@g****m 4
Gavin Chan g****i@g****m 4
Nitish Kumar Jaipuria n****a@g****m 4
David Leong t****g@g****m 3
Konstantin Styrkas s****s@g****m 3
Fabrice DESCHATRES 2****s@u****m 2
Kyle Kosic k****c@g****m 2
Oleh Prypin o****n@g****m 2
Peter Hawkins p****s@g****m 2
Rebeka Marton r****n@g****m 2
and 20 more...
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 56
  • Total pull requests: 49
  • Average time to close issues: 2 months
  • Average time to close pull requests: about 2 months
  • Total issue authors: 39
  • Total pull request authors: 28
  • Average comments per issue: 4.75
  • Average comments per pull request: 2.14
  • Merged pull requests: 28
  • Bot issues: 0
  • Bot pull requests: 8
Past Year
  • Issues: 2
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: 3 months
  • Issue authors: 2
  • Pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • cyrilchim (5)
  • arthurpham (4)
  • alembcke (4)
  • jonas-eschle (3)
  • feribg (3)
  • luweizheng (2)
  • Macfly (2)
  • saxena-ashish-g (2)
  • omdv (1)
  • brilhana (1)
  • blais (1)
  • rajflume (1)
  • ay1011 (1)
  • AlexandreMoulti (1)
  • PBRAOS (1)
Pull Request Authors
  • dependabot[bot] (11)
  • gavincyi (5)
  • alembcke (4)
  • esztermarton (3)
  • DevarakondaV (2)
  • jackgillett101 (2)
  • sleptonium (2)
  • kykosic (2)
  • fabrice-deschatres (2)
  • JasonnnW3000 (1)
  • ZhiqingXiao (1)
  • alv128 (1)
  • tirkarthi (1)
  • vladdoster (1)
  • johannlilly (1)
Top Labels
Issue Labels
good first issue (6)
Pull Request Labels
cla: yes (26) dependencies (11) cla: no (3)

Packages

  • Total packages: 3
  • Total downloads:
    • pypi 2,243 last-month
  • Total dependent packages: 2
    (may contain duplicates)
  • Total dependent repositories: 7
    (may contain duplicates)
  • Total versions: 1,382
  • Total maintainers: 1
pypi.org: tf-quant-finance

High-performance TensorFlow library for quantitative finance.

  • Versions: 30
  • Dependent Packages: 2
  • Dependent Repositories: 3
  • Downloads: 366 Last month
Rankings
Stargazers count: 1.1%
Dependent packages count: 2.2%
Forks count: 2.3%
Average: 5.3%
Dependent repos count: 9.2%
Downloads: 11.5%
Maintainers (1)
Last synced: 6 months ago
pypi.org: tff-nightly

High-performance TensorFlow library for quantitative finance.

  • Versions: 1,348
  • Dependent Packages: 0
  • Dependent Repositories: 4
  • Downloads: 1,877 Last month
Rankings
Stargazers count: 1.1%
Forks count: 2.3%
Average: 5.4%
Downloads: 5.9%
Dependent repos count: 7.5%
Dependent packages count: 10.1%
Maintainers (1)
Last synced: 6 months ago
proxy.golang.org: github.com/google/tf-quant-finance
  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 7.0%
Average: 8.2%
Dependent repos count: 9.3%
Last synced: 6 months ago

Dependencies

ci_build/Dockerfile docker
  • ubuntu focal build
tf_quant_finance/examples/demos/option_pricing_basic/data_generator/Dockerfile docker
  • python 3 build
tf_quant_finance/examples/demos/option_pricing_basic/downloader/Dockerfile docker
  • python 3 build
tf_quant_finance/examples/demos/option_pricing_basic/pricer/Dockerfile docker
  • python 3 build
setup.py pypi
tf_quant_finance/examples/demos/option_pricing_basic/data_generator/requirements.txt pypi
  • attrs >=18.2.0
  • google-cloud-storage ==1.28.0
  • tf-nightly *
  • tfp-nightly *
tf_quant_finance/examples/demos/option_pricing_basic/data_generator/requirements_nodeps.txt pypi
  • tff-nightly *
tf_quant_finance/examples/demos/option_pricing_basic/downloader/requirements.txt pypi
  • Flask ==1.1.2
  • absl-py ==0.9.0
  • google-cloud-storage ==1.28.0
  • numpy ==1.21
  • pyzmq ==19.0.0
  • requests ==2.23.0
tf_quant_finance/examples/demos/option_pricing_basic/pricer/requirements.txt pypi
  • absl-py ==0.9.0
  • numpy ==1.22.0
  • pyzmq ==19.0.0
  • tf-nightly *
  • tff-nightly *
  • tfp-nightly *