Skip to main content

NASDAQ Options chain scraper for https://old.nasdaq.com

Project description

NASDAQ Options chain Scraper

Python Options Chain scraper for the old NASDAQ website : https://old.nasdaq.com

Install

pip install options-scraper

API

Use the API if you want to access the scraped data records ( as python objects ) directly.

Usage

from options_scraper.scraper import NASDAQOptionsScraper
from options_scraper.utils import batched

scraper = NASDAQOptionsScraper()
ticker_symbol = 'XOM'
kwargs = { "money": 'all',
           "expir": 'week',
           "excode": None,
           "callput": None
         }

records_generator = scraper(ticker_symbol, **kwargs)

# Either access each record individually as shown below
for item in records_generator:
    print(item)

# Or use the batched util to get a list of items
for items in batched(records_generator, batch_size=100):
    print(items)

Output

Each scraped record will have the following structure

{'Ask': '23.20',
 'Bid': '18.50',
 'Calls': 'Apr 24, 2020',
 'Chg': '',
 'Last': '19.40',
 'Open Int': '15',
 'Puts': 'Apr 24, 2020',
 'Root': 'XOM',
 'Strike': '60',
 'Vol': '0'}

{'Ask': '28.20',
 'Bid': '23.50',
 'Calls': 'Apr 24, 2020',
 'Chg': '',
 'Last': '29.67',
 'Open Int': '3',
 'Puts': 'Apr 24, 2020',
 'Root': 'XOM',
 'Strike': '65',
 'Vol': '0'}

Console Script

Use this script to scrape records and save them either in CSV or JSON format.

options-scraper --help
usage: options-scraper [-h]
                       [-l {CRITICAL,FATAL,ERROR,WARN,WARNING,INFO,DEBUG,NOTSET}]
                       [-t TICKER] 
                       [-o ODIR] 
                       [-b BATCH_SIZE] 
                       [-c {call,put}]
                       [-m {all,in,out,near}] 
                       [-e EXCODE]
                       [-x {week,stan,quart,cebo}] 
                       [-s {json,csv}]

optional arguments:
  -h, --help            show this help message and exit
  -l {CRITICAL,FATAL,ERROR,WARN,WARNING,INFO,DEBUG,NOTSET}, --log-level {CRITICAL,FATAL,ERROR,WARN,WARNING,INFO,DEBUG,NOTSET}
  -t TICKER, --ticker TICKER Ticker Symbol
  -o ODIR, --odir ODIR  Output directory
  -b BATCH_SIZE, --batch_size BATCH_SIZE Batch Size
  -c {call,put}, --callput {call,put}
  -m {all,in,out,near}, --money {all,in,out,near}
  -e EXCODE, --excode EXCODE excode
  -x {week,stan,quart,cebo}, --expir {week,stan,quart,cebo}
  -s {json,csv}, --serialize {json,csv} Serialization format

Serialization format (-s)

You have an option to output the data either in a CSV file or a JSON file. Default format is CSV.

Batch Size (-b)

Define how many records each csv or json file should have.

Examples

  1. To get all the option chain for XOM in a batch_size of 1000 and csv file format. This will make sure that each CSV file has 1000 records in it. The last file will have the remaining records
options-scraper -t XOM -o /Users/abhishek/options_data -b 1000 -s csv
  1. To get all option chain data for MSFT in a batch_size of 10 and json file format.
options-scraper -t MSFT -o /Users/abhishek/options_data -b 10 -s json
  1. To get all put options with weekly expiry.
options-scraper -t XOM -e cbo -c put -x week -o /Users/abhishek/options_data
  1. To get all call options with cebo expiry.
options-scraper -t XOM -c call -x cebo -o /Users/abhishek/options_data

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

options_scraper-0.9.91.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

options_scraper-0.9.91-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file options_scraper-0.9.91.tar.gz.

File metadata

  • Download URL: options_scraper-0.9.91.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for options_scraper-0.9.91.tar.gz
Algorithm Hash digest
SHA256 cf9d0a787d4f512c423408c47ec05b5c7bbab30ec3c7f4b67ce04f5899805f50
MD5 51d1defc803586f4b830d0ae59439a3b
BLAKE2b-256 3f21d375dff3217fc5d0c2c7eb6d31cb6bd462132325af5b2cdb9dd28edd5319

See more details on using hashes here.

File details

Details for the file options_scraper-0.9.91-py3-none-any.whl.

File metadata

  • Download URL: options_scraper-0.9.91-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for options_scraper-0.9.91-py3-none-any.whl
Algorithm Hash digest
SHA256 549fd132e30488537410fed069eb9fe2ffd66fd87a029bda3de71193fecdb329
MD5 b25d5816543f59f57b0c8d2ec1efc45e
BLAKE2b-256 84c1c8f027655c418193759043d33346872f9a11a84be971f96d81579764cfff

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page