diff --git a/Makefile b/Makefile index a74ce5e..0de23ad 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,16 @@ # check out this: https://github.com/intrinio/python-sdk.git # then run: python setup.py install --user -docn-stock-price: +docn-stock-price-history: ./stock_prices-DOCN.py # ./stock_prices-DOCN.py > DOCN-last-90DAYS.txt docn-insiders: ./DOCN-institutional-trans.py +docn-options: + ./getOptionsDOCN.py + install: python setup.py install --user # pip install intrinio-sdk diff --git a/getOptionsDOCN.py b/getOptionsDOCN.py new file mode 100755 index 0000000..ddc1070 --- /dev/null +++ b/getOptionsDOCN.py @@ -0,0 +1,31 @@ +#!/usr/bin/python3 + +from __future__ import print_function +import time +import intrinio_sdk +from intrinio_sdk.rest import ApiException +from pprint import pprint + +intrinio_sdk.ApiClient().configuration.api_key['api_key'] = 'OjZjZGIzZmYyNDg4NDZjYjQ4NzAzMzAyZjg0OTU5MDcz' + +options_api = intrinio_sdk.OptionsApi() + +symbol = 'DOCN' # str | The option symbol, corresponding to the underlying security. +type = 'put' # str | The option contract type. (optional) + +try: + api_response = options_api.get_options(symbol, type=type) + options = api_response.options + + print("%s options found for %s!" % (len(options), symbol)) + + for option in options: + print("") + print("ID: %s" % (option.id)) + print("Code: %s" % (option.code)) + print("Ticker: %s" % (option.ticker)) + print("Expiration: %s" % (option.expiration)) + print("Strike: %s" % (option.strike)) + print("Type: %s" % (option.type)) +except ApiException as e: + print("Exception when calling OptionsApi->get_options: %s\n" % e)