Data Collection

The VMOT trend strategy hedges market risk by shorting the US market under certain conditions. We'll use SPY for this purpose, from the Sharadar ETF dataset.

Collect Sharadar ETF prices

First, create a database for Sharadar ETF prices:

In [1]:
from quantrocket.history import create_sharadar_db
create_sharadar_db("sharadar-us-etf-1d", sec_type="ETF", country="US")
Out[1]:
{'status': 'successfully created quantrocket.v2.history.sharadar-us-etf-1d.sqlite'}

Then collect the data:

In [2]:
from quantrocket.history import collect_history
collect_history("sharadar-us-etf-1d")
Out[2]:
{'status': 'the historical data will be collected asynchronously'}

This runs in the background, monitor flightlog for a completion message:

quantrocket.history: INFO [sharadar-us-etf-1d] Collecting Sharadar US ETF prices
quantrocket.history: INFO [sharadar-us-etf-1d] Collecting updated Sharadar US securities listings
quantrocket.history: INFO [sharadar-us-etf-1d] Finished collecting Sharadar US ETF prices

Lookup SPY Sid

Next, look up the sid for SPY. This will be used in the trend strategy. Looking up the sid requires a bit less typing with the CLI:

In [3]:
!quantrocket master get -s SPY -t ETF --fields Sid Symbol Exchange | csvlook 
| Sid            | Symbol | Exchange |
| -------------- | ------ | -------- |
| FIBBG000BDTBL9 | SPY    | ARCX     |

Next Up

Part 2: Trend Strategy