question

an0o0nyme avatar image
0 Likes"
an0o0nyme asked ·

Error calling security_intraday_prices

I am using intrinio-sdk for Python. I tried to follow this example code:

https://docs.intrinio.com/documentation/python/get_security_intraday_prices_v2


However I am getting an error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "...../example.py", line 36, in main
    "MSFT", start_date="2020-06-12",
  File "...../lib/python3.7/site-packages/intrinio_sdk/api/security_api.py", line 657, in get_security_intraday_prices
    (data) = self.get_security_intraday_prices_with_http_info(identifier, **kwargs)  # noqa: E501
  File "...../lib/python3.7/site-packages/intrinio_sdk/api/security_api.py", line 754, in get_security_intraday_prices_with_http_info
    collection_formats=collection_formats)
  File "...../lib/python3.7/site-packages/intrinio_sdk/api_client.py", line 322, in call_api
    _preload_content, _request_timeout)
  File "...../lib/python3.7/site-packages/intrinio_sdk/api_client.py", line 161, in __call_api
    return_data = self.deserialize(response_data, response_type)
  File "...../lib/python3.7/site-packages/intrinio_sdk/api_client.py", line 233, in deserialize
    return self.__deserialize(data, response_type)
  File "...../lib/python3.7/site-packages/intrinio_sdk/api_client.py", line 272, in __deserialize
    return self.__deserialize_model(data, klass)
  File "...../lib/python3.7/site-packages/intrinio_sdk/api_client.py", line 615, in __deserialize_model
    instance = klass(**kwargs)
  File "...../lib/python3.7/site-packages/intrinio_sdk/models/api_response_security_intraday_prices.py", line 64, in __init__
    self.source = source
  File "...../lib/python3.7/site-packages/intrinio_sdk/models/api_response_security_intraday_prices.py", line 237, in source
    .format(source, allowed_values)
ValueError: Invalid value for `source` (iex), must be one of ['$$v2_stock_price_intraday_sources_enum$$']


My code:

import time
import intrinio_sdk
from intrinio_sdk.rest import ApiException
from pprint import pprint


intrinio_sdk.ApiClient().configuration.api_key["api_key"] = "xxxxxxxxxxxxxxxx"
security_api = intrinio_sdk.SecurityApi()


def main():
    try:
        api_response = security_api.get_security_intraday_prices(
            "MSFT", start_date="2020-06-12",
        )
        pprint(api_response)
    except ApiException as e:
        print(
            "Exception when calling SecurityApi->get_security_historical_data: %s\r\n"
            % e
        )


if __name__ == "__main__":
    main()


The value of $$v2_stock_price_intraday_sources_enum$$ is undocumented. Can you please provide me with the link or definition of $$v2_stock_price_intraday_sources_enum$$?


Also is there any easy solution to the problem that I am having?


EDIT:
When I add source="$v2_stock_price_intraday_sources_enum$$" parameter to method call I get following error:

>>> main()
Exception when calling SecurityApi->get_security_historical_data: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({'Date': 'Sun, 14 Jun 2020 23:18:19 GMT', 'Content-Type': 'application/json', 'Content-Length': '150', 'Connection': 'keep-alive', 'Vary': 'Origin,Accept-Encoding'})
HTTP response body: {"error":"source is not a valid option. Must be one of iex, bats","message":"An error occured. Please contact success@intrinio.com with the details."}


Looks like vicious circle.

pythonsdkintrinio-sdkpython-sdk
· 1
10 |600 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

The issue was in hard-coded value in a python-sdk code.

"$v2_stock_price_intraday_sources_enum$$" was being checked against source argument that was passed to the method call and thus it was always failing validation checks.


It was resolved by Intrinio team straight in Github which is very positive. However no update on PyPi so far. Also its a bit a shame that anybody added an update to this post whenever the issue was fixed. This would save me some precious time.

0 Likes 0 · ·

1 Answer

· Write an Answer
mkelly avatar image
0 Likes"
mkelly answered ·

We apologize for the long delay in the response. This issue should be resolved when you update the python SDK.

· Share
10 |600 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.