69

GitHub - google/tf-quant-finance: High-performance TensorFlow library for quanti...

 6 years ago
source link: https://github.com/google/tf-quant-finance
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

README.md

High-performance TensorFlow library for quantitative finance

Table of contents

  1. Introduction
  2. Installation
  3. Development roadmap
  4. Examples
  5. Contributing
  6. Development
  7. Community
  8. Discaimers
  9. License

Introduction

This library provides high-performance methods leveraging the hardware acceleration support and automatic differentation of TensorFlow. The initial library will provide TensorFlow support for foundational mathematical methods, mid-level methods, and specific pricing models. These will be significantly expanded over next months.

Our TensorFlow-based methods will be structured along three tiers:

  1. Foundational methods. Core mathematics methods - optimisation, root finders, linear algebra, random number generation, etc.

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

  3. Pricing methods. Specific Pricing models (e.g Local Vol (LV), Stochastic Vol (SV), Stochastic Local Vol (SLV), Hull-White (HW))

Installation

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

pip install --upgrade tf-quant-finance

If you use Python 3, you might need to use pip3 install. You'll maybe also have to use option --user.

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
    • Single factor Hull White model
    • Heston model
    • Local volatility model.
    • SABR model
  • ADI method for solving multi dimensional PDEs.
  • 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.
  • Optimization:
    • Conjugate gradient optimizer.

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 meant 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.

Dependencies

This library has the following dependencies:

  1. Bazel
  2. Python 3 (Bazel uses Python 3 by default)
  3. TensorFlow
  4. TensorFlow Probability
  5. Numpy

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:

pip3 install --upgrade tensorflow tensorflow-probability numpy

Commonly used commands

Clone the GitHub repository:

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

After you run

cd tf_quant_finance

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

bazel test tf_quant_finance/math/random/sobol:sobol_test

will run tests in sobol_test.py .

Tests will be run using the 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:

# 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 :build_pip_pkg
./bazel-bin/build_pip_pkg 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. [email protected]: Open mailing list for discussion and questions of this library.

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

Disclaimers

This is not an officially supported Google product. This library is under active development. 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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK