From c6912cfbf237cc2ee89d6749cebb929a946b66a3 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 26 Nov 2023 23:31:12 -0600 Subject: [PATCH] DOCN options Signed-off-by: Jeff Carr --- Makefile | 5 ++++- getOptionsDOCN.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100755 getOptionsDOCN.py 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)