Table of Contents
Making your first data request is easy, let’s dive into what you need.
Installation #
First, install our Python package from the official index: https://pypi.org/project/quantglobal/
Once installed, open your preferred IDE (we recommend Spyder) and import the package.
Note: When importing the package, the name ‘QuantGlobal’ is case-sensitive.
Pulling Data #
For this example, we’ll make a query for the Google Dual Class Arbitrage Index values on November 30th, 2022.
Valid parameters #
- key
- the email address associated with your account (e.g., ‘your_address@ email.com’)
- strategy
- ‘dca’ (Dual Class Arbitrage)
- ‘pt’ (Pairs Trading)
- ‘pt_extended’ (Pairs Trading w/ Extended Data)
- underlying
- For Dual Class Arbitrage (‘dca’), the valid underlying parameters are:
- ‘google’, ‘zillow’, ‘fox’, ‘news’
- For Pairs Trading (both ‘pt’ and ‘pt_extended’), the valid underlying parameters are:
- ‘communications’, ‘consumer_discretionary’, ‘consumer_staples’, ‘energy’, ‘financials’, ‘healthcare’, ‘industrials’, ‘basic_materials’, ‘technology’, ‘utilities’
- For Dual Class Arbitrage (‘dca’), the valid underlying parameters are:
- from_date / end_date (optional)
- date in YYYY-mm-dd format
import QuantGlobal as qg
data = qg.download(key = 'authenticated_user@email.com', strategy = 'dca', underlying = 'google', from_date = '2022-11-30', end_date = '2022-12-01')
After the line is executed, the API returns a pandas dataframe object structured as follows:
datetime | Cumulative Returns | GOOGL Cumulative Returns | Spread | GOOG Intraday Performance | GOOGL Intraday Performance | Underperformer | Overperformer |
---|---|---|---|---|---|---|---|
2022-11-30 09:30:00 | 100.0 | 100.0 | 0.0 | 0.0% | 0.0% | GOOG | GOOG |
2022-11-30 09:31:00 | 99.7896508204 | 99.7575374236 | 0.0321133968 | -0.21% | -0.24% | GOOGL | GOOG |
2022-11-30 09:32:00 | 99.7376373296 | 99.7053638537 | 0.0165521329 | -0.26% | -0.29% | GOOGL | GOOG |
2022-11-30 09:33:00 | 100.2119105053 | 100.212537395 | 0.01312691 | 0.21% | 0.21% | GOOG | GOOGL |
2022-11-30 09:34:00 | 100.2750596769 | 100.3074710871 | 0.0252199177 | 0.28% | 0.31% | GOOG | GOOGL |
Congratulations, you have completed your first data request!