The data collection process consists of collecting US stock listings, creating a universe of leveraged ETFs, then collecting 1 minute bars for the leveraged ETFs.
First collect US Stock listings:
from quantrocket.master import collect_usstock_listings
collect_usstock_listings()
Next we download a CSV of several leveraged ETFs:
from quantrocket.master import download_master_file
download_master_file(
"leveraged_etfs.csv",
exchanges="ARCX",
sec_types="ETF",
symbols=[
"SPXL", # DIREXION DLY S&P 500 BULL 3X
"TNA", # DIREXION DLY SM CAP BULL 3X
"ERX", # DIREXION DLY ENERGY BULL 3X
"TMF", # DRX DLY 20+ YR TREAS BULL 3X
"UPRO", # PROSHARES ULTRAPRO S&P 500
"DRN", # DRX DLY REAL ESTATE BULL 3X
"YINN", # DRX DLY FTSE CHINA BULL 3X
"UDOW", # PROSHARES ULTRAPRO DOW30
"URTY", # PROSHARES ULTRAPRO RUSS2000
"FAS", # DIREXION DAILY FIN BULL 3X
"EDC", # DIREXION DLY EMG MKT BULL 3X
"RUSL", # DIREXION DLY RUSSIA BULL 3X
"JNUG", # DIREXION DLY JR GOLD BULL 3X
"NUGT", # DRX DLY GOLD MINERS BULL 3X
])
Then upload the CSV to create the "leveraged-etf" universe:
from quantrocket.master import create_universe
create_universe("leveraged-etf", infilepath_or_buffer="leveraged_etfs.csv")
Next, we create a Zipline bundle for collecting 1-min bars.
from quantrocket.zipline import create_usstock_bundle
create_usstock_bundle("usstock-1min")
Then collect the data for the leveraged ETFs:
from quantrocket.zipline import ingest_bundle
ingest_bundle("usstock-1min", universes="leveraged-etf")
Monitor flightlog for completion:
quantrocket.zipline: INFO [usstock-1min] Collecting minute bars for 14 securities in usstock-1min bundle
quantrocket.zipline: INFO [usstock-1min] Collecting daily bars for usstock-1min bundle
quantrocket.zipline: INFO [usstock-1min] Collecting adjustments for usstock-1min bundle
quantrocket.zipline: INFO [usstock-1min] Collecting assets for usstock-1min bundle
quantrocket.zipline: INFO [usstock-1min] Completed collecting data for 14 securities in usstock-1min bundle