intrinio-jcarr/AAPL.py

55 lines
1.9 KiB
Python
Executable File

#!/usr/bin/python3
from __future__ import print_function
import time
import intrinio_sdk as intrinio
from intrinio_sdk.rest import ApiException
intrinio.ApiClient().set_api_key('OjZjZGIzZmYyNDg4NDZjYjQ4NzAzMzAyZjg0OTU5MDcz')
intrinio.ApiClient().allow_retries(True)
identifier = 'AAPL'
start_date = '2022-11-01'
end_date = '2022-11-01'
frequency = 'daily'
page_size = 100
next_page = ''
response = intrinio.SecurityApi().get_security_stock_prices(identifier, start_date=start_date, end_date=end_date, frequency=frequency, page_size=page_size, next_page=next_page)
print(response)
# output from 2022-11-02:
# jcarr@hpdevone:~/tmp/intrinio/test$ ./AAPL.py
# {'next_page': None,
# 'security': {'code': 'EQS',
# 'company_id': 'com_NX6GzO',
# 'composite_figi': 'BBG000B9XRY4',
# 'composite_ticker': 'AAPL:US',
# 'currency': 'USD',
# 'figi': 'BBG000B9Y5X2',
# 'id': 'sec_agjrgj',
# 'name': 'Apple Inc',
# 'primary_listing': True,
# 'share_class_figi': 'BBG001S5N8V8',
# 'ticker': 'AAPL'},
# 'stock_prices': [{'adj_close': 150.65,
# 'adj_high': 155.45,
# 'adj_low': 149.13,
# 'adj_open': 155.08,
# 'adj_volume': 80379345.0,
# 'change': -2.69,
# 'close': 150.65,
# 'date': datetime.date(2022, 11, 1),
# 'dividend': 0.0,
# 'factor': 1.0,
# 'fifty_two_week_high': 182.19,
# 'fifty_two_week_low': 128.86,
# 'frequency': 'daily',
# 'high': 155.45,
# 'intraperiod': False,
# 'low': 149.13,
# 'open': 155.08,
# 'percent_change': -0.0175,
# 'split_ratio': 1.0,
# 'volume': 80379345.0}]}