an0o0nyme avatar image
an0o0nyme asked ·

Error calling security_intraday_prices

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

However I am getting an error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "...../", line 36, in main
    "MSFT", start_date="2020-06-12",
  File "...../lib/python3.7/site-packages/intrinio_sdk/api/", 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/", line 754, in get_security_intraday_prices_with_http_info
  File "...../lib/python3.7/site-packages/intrinio_sdk/", line 322, in call_api
    _preload_content, _request_timeout)
  File "...../lib/python3.7/site-packages/intrinio_sdk/", line 161, in __call_api
    return_data = self.deserialize(response_data, response_type)
  File "...../lib/python3.7/site-packages/intrinio_sdk/", line 233, in deserialize
    return self.__deserialize(data, response_type)
  File "...../lib/python3.7/site-packages/intrinio_sdk/", line 272, in __deserialize
    return self.__deserialize_model(data, klass)
  File "...../lib/python3.7/site-packages/intrinio_sdk/", line 615, in __deserialize_model
    instance = klass(**kwargs)
  File "...../lib/python3.7/site-packages/intrinio_sdk/models/", line 64, in __init__
    self.source = source
  File "...../lib/python3.7/site-packages/intrinio_sdk/models/", 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 import ApiException
from pprint import pprint

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

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

if __name__ == "__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?

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 with the details."}

Looks like vicious circle.

· 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 · ·

0 Answers

· Write an Answer

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.