intrinio-jcarr/test-appl.py

25 lines
1.0 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
from pprint import pprint
intrinio.ApiClient().configuration.api_key['api_key'] = 'OjZjZGIzZmYyNDg4NDZjYjQ4NzAzMzAyZjg0OTU5MDcz'
intrinio.ApiClient().allow_retries(True)
security_api = intrinio.SecurityApi()
identifier = 'AAPL' # str | A Security identifier (Ticker, FIGI, ISIN, CUSIP, Intrinio ID)
start_date = '2022-11-01' # date | Return intraday prices starting at the specified date (optional)
end_date = '2022-11-02' # date | Return intraday prices stopping at the specified date (optional)
try:
api_response = security_api.get_security_intraday_prices(identifier, start_date=start_date, end_date=end_date)
pprint(api_response.intraday_prices)
except ApiException as e:
print("Exception when calling SecurityApi->get_security_intraday_prices: %s\n" % e)
# Note: For a Pandas DataFrame, import Pandas and use pd.DataFrame(api_response.intraday_prices_dict)