<jupyter_start><jupyter_text>Disclaimer  SPY Data CollectionWe will backtest the trading strategy using the SPY ETF. The data collection process consists of collecting US Stocks listings, then collecting 1 minute bars for SPY.  Collect SPY listingFirst, collect US Stock listings:<jupyter_code>from quantrocket.master import collect_usstock_listings
collect_usstock_listings()<jupyter_output><empty_output><jupyter_text>Lookup SPYNext, we look up the Sid (security ID) for SPY. We use the command line interface because less typing is required.> Prefixing a line with ! allows running terminal commands from inside a notebook.<jupyter_code>!quantrocket master get --symbols 'SPY' --sec-types 'ETF' --fields 'Sid' 'Symbol' 'Exchange' --json | json2yaml<jupyter_output>---
  - 
    Sid: "FIBBG000BDTBL9"
    Symbol: "SPY"
    Exchange: "ARCX"<jupyter_text>Collect historical dataNext, we create a Zipline bundle for collecting 1-min bars for SPY:<jupyter_code>from quantrocket.zipline import create_usstock_bundle
create_usstock_bundle("usstock-1min")<jupyter_output><empty_output><jupyter_text>Then collect the data for SPY:<jupyter_code>from quantrocket.zipline import ingest_bundle
ingest_bundle("usstock-1min", sids="FIBBG000BDTBL9")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08063241106719368, 'fraction_numerical': 0.010276679841897233, 'mean_word_length': 6.766871165644171, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '85886', 'license': 'Apache-2.0', 'n_tokens_mistral': 418, 'n_tokens_neox': 402, 'n_words': 119, 'path': 'first_last/Part1-SPY-Data-Collection.ipynb', 'repo_name': 'quantrocket-codeload/first-last', 'size': '1265'}