menu
Data

Timeseries

GS Quant comes with a timeseries package which provides a number of functions for dealing with analytics of financial timeseries. This is based on the pandas series object to provide extensions which are specific to analyzing asset prices or other observable market data. These functions are used by our strategists to analyze and backtest trading strategies.

Timeseries Modules

Below is an overview of the various timeseries modules within GS Quant. Some are simple wrappers around the equivalent pandas or NumPy function to provide consistent interface and documentation. Many are Goldman Sachs' implementations of useful financial analysis functions which we use to quantify the performance of different strategies.

ModuleDescription
AlgebraBasic numerical and algebraic operations, including addition, division, multiplication and other functions on timeseries
AnalysisFunctions used to analyze properties of timeseries, including lagging, differencing, autocorrelation, co-integration and other related operations
DatetimeDate and time manipulation for timeseries, including date or time shifting, calendar operations, curve alignment and interpolation operations
EconometricsStandard economic and time series analytics operations, including returns, drawdowns, volatility and other numerical operations which are generally finance-oriented
StatisticsBasic statistical operations, including probability and distribution analysis (generally not finance-specific routines)
TechnicalsTechnical analysis functions including moving averages, volatility indicators, and and other numerical operations for analyzing statistical properties of trading activity

Usage

Import timeseries package or individual modules to access functionality:

import gs_quant.timeseries as ts

x = ts.generate_series(1000)           # Generate random timeseries with 1000 observations
vol = ts.volatility(x, 22)             # Compute realized volatility
vol.tail()                             # Show last few values

Output:

2021-12-20 12.898025
2021-12-21 12.927230
2021-12-22 12.929520
2021-12-23 13.987033
2021-12-24 14.048165
dtype: float64

Contributions

In addition to the standard contribution guidelines for GS Quant, we request that all timeseries function have 100% test coverage and full mathematical documentation using Latex. This helps ensure consumers of these functions can understand the exact mathematical definition and usage semantics.


Related Content