menu
Data

Financial Series

This tutorial provides an overview of how to interact with financial data series. We'll walk through some examples of how to retrieve and visualize market data in order to analyze the performance of different assets. In this tutorial we will examine the prices of equity baskets, which provide investors with exposure to different market themes through custom baskets of stocks.

Retrieving Prices

First, let's get the prices of the Goldman Sachs Hedge Fund VIP Basket (Ticker: GSTHHVIP). This is a custom basket created by the Goldman Sachs Investment Research (GIR) group to track stocks which are widely held by the hedge fund community in the US, based on 13-F filings.

info

Note

Examples require an initialized GsSession and data subscription. Please refer to Sessions for details

We'll use the GS Custom Basket Prices dataset, which contains prices for a selection of GS thematic equity baskets. This dataset contains the closePrice field, which tracks the official closing price for each asset on a daily basis, and is exposed in GS Quant as Fields.CLOSE_PRICE:

from gs_quant.data import Dataset, Fields
from datetime import date

basket_ds = Dataset('GSCB_FLAGSHIP')
start_date = date(2007,1,1)

vip_px = basket_ds.get_data_series(Fields.CLOSE_PRICE, start=start_date, ticker='GSTHHVIP')
vip_px.tail()

Output:

Out[1]:
2019-06-14    269.314751
2019-06-17    271.106028
2019-06-18    274.046304
2019-06-19    276.174911
2019-06-20    279.399869
dtype: float64

The first observation in the series is on 28th November 2007, and prices are available up to the most recent US market close. Let's plot the series to see how the basket has performed over the last 10+ years:

vip_px.plot()

Output:

Comparing Performance

In addition to the Hedge Fund VIP Basket, the Portfolio Strategies Group within Goldman Sachs Investment Research also computes a basket of stocks which are most widely shorted across the hedge fund community. This basket is called the HF Important Shorts Basket (ticker: GSTHVISP). We'll retrieve the price history for this basket:

visp_px = basket_ds.get_data_series(Fields.CLOSE_PRICE, start=start_date, ticker='GSTHVISP')
visp_px.tail()

Output:

Out[3]:
2019-06-14    231.022088
2019-06-17    230.661374
2019-06-18    232.949564
2019-06-19    233.424179
2019-06-20    235.450614
dtype: float64

Now let's compare the prices of the two assets. First, we'll align the two series so that they cover the same date range, then index both series to 100 on the initial date and plot:

import gs_quant.timeseries as ts
import pandas as pd

[vip, visp] = ts.align(vip_px, visp_px, ts.Interpolate.INTERSECT)
vip = ts.index( vip, 100 )
visp = ts.index( visp, 100 )
compare = pd.DataFrame({'vip': vip, 'visp': visp})
compare.plot()

Output:

Looks like the VIP basket has outperformed, the VISP basket over the last 5 or so years. Next we'll analyze performance over a few key statistical dimensions.

Analyzing Series

There are a few basic properties of a financial series we would look at in order to evaluate how it would fit into a portfolio. We'll run a quick analysis of our two series to evaluate them against these dimensions. Here's a quick summary of what we are going to compute:

MeasureDescription
Annual VolatilityHistorical annualized realized volatility
Max DrawdownMaximum peak-to-trough percentage drawdown over a given period
CorrelationDegree of linear relationship between the two assets

Use the GS Quant timeseries functions to calculate, and then plot results:

import gs_quant.timeseries as ts
import matplotlib.pyplot as plt

window = 22     # 1 month (22 business day) lookback

vols = pd.DataFrame({'vip': ts.volatility(vip, window), 'visp': ts.volatility(visp, window)})
draws = pd.DataFrame({'vip': ts.max_drawdown(vip, window), 'visp': ts.max_drawdown(visp, window)})
corr = ts.correlation(vip, visp, window )

plot, axs = plt.subplots(3, sharex=True)
plot.suptitle('Hedge Fund VIP vs Hedge Fund VIP Short')

axs[0].title.set_text('Volaility')
axs[1].title.set_text('Max Drawdown')
axs[2].title.set_text('Correlation')

axs[0].plot(vols)
axs[1].plot(draws)
axs[2].plot(corr)

Output:

A few quick takeaways, which were probably intuitive from the original price curves:

  • The hedge fund short basket generally has lower volatility than the long basket
  • The long basket has larger maximum drawdown than the short basket
  • The correlation between the products is generally close to 1

Related Content


Certain solutions and Institutional Services described herein are provided via our Marquee platform. The Marquee platform is for institutional and professional clients only. This site is for informational purposes only and does not constitute an offer to provide the Marquee platform services described, nor an offer to sell, or the solicitation of an offer to buy, any security. Some of the services and products described herein may not be available in certain jurisdictions or to certain types of clients. Please contact your Goldman Sachs sales representative with any questions. Any data or market information presented on the site is solely for illustrative purposes. There is no representation that any transaction can or could have been effected on such terms or at such prices. Please see https://www.goldmansachs.com/disclaimer/sec-div-disclaimers-for-electronic-comms.html for additional information.
Transaction Banking services are offered by Goldman Sachs Bank USA (“GS Bank”). GS Bank is a New York State chartered bank, a member of the Federal Reserve System and a Member FDIC.
GS DAP™ is owned and operated by Goldman Sachs. This site is for informational purposes only and does not constitute an offer to provide, or the solicitation of an offer to provide access to or use of GS DAP™. Any subsequent commitment by Goldman Sachs to provide access to and / or use of GS DAP™ would be subject to various conditions, including, amongst others, (i) satisfactory determination and legal review of the structure of any potential product or activity, (ii) receipt of all internal and external approvals (including potentially regulatory approvals); (iii) execution of any relevant documentation in a form satisfactory to Goldman Sachs; and (iv) completion of any relevant system / technology / platform build or adaptation required or desired to support the structure of any potential product or activity.
Mosaic is a service mark of Goldman Sachs & Co. LLC. This service is made available in the United States by Goldman Sachs & Co. LLC and outside of the United States by Goldman Sachs International, or its local affiliates in accordance with applicable law and regulations. Goldman Sachs International and Goldman Sachs & Co. LLC are the distributors of the Goldman Sachs Funds. Depending upon the jurisdiction in which you are located, transactions in non-Goldman Sachs money market funds are affected by either Goldman Sachs & Co. LLC, a member of FINRA, SIPC and NYSE, or Goldman Sachs International. For additional information contact your Goldman Sachs representative. Goldman Sachs & Co. LLC, Goldman Sachs International, Goldman Sachs Liquidity Solutions, Goldman Sachs Asset Management, L.P., and the Goldman Sachs funds available through Goldman Sachs Liquidity Solutions and other affiliated entities, are under the common control of the Goldman Sachs Group, Inc.
© 2024 Goldman Sachs. All rights reserved.