ibflex.parser.FlexParserError: SymbolSummary.tradeDate - Can't convert 'MULTI' to <class 'datetime.date'>
raivil opened this issue · comments
Hey @csingley.
Found this issue recently while testing the package from master branch.
>>> res = parser.parse(response)
Traceback (most recent call last):
File "/root_folder/ibflex/ibflex/parser.py", line 303, in convert
prepped_value = prep(value)
^^^^^^^^^^^
File "/root_folder/ibflex/ibflex/parser.py", line 176, in prep_date
date_format = DATE_FORMATS[len(value)][value.count('/')]
~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 5
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root_folder/ibflex/ibflex/parser.py", line 159, in parse_element_attr
converted = ATTRIB_CONVERTERS[Type](value=value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root_folder/ibflex/ibflex/parser.py", line 324, in optional_convert
return None if value in ("", "-", "--", "N/A") else func(value)
^^^^^^^^^^^
File "/root_folder/ibflex/ibflex/parser.py", line 314, in convert
raise FlexParserError(
ibflex.parser.FlexParserError: Can't convert 'MULTI' to <class 'datetime.date'>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root_folder/ibflex/ibflex/parser.py", line 53, in parse
parsed = parse_element(root)
^^^^^^^^^^^^^^^^^^^
File "/root_folder/ibflex/ibflex/parser.py", line 85, in parse_element
return parse_data_element(elem)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/root_folder/ibflex/ibflex/parser.py", line 125, in parse_data_element
contained_elements = {child.tag: parse_element(child) for child in elem}
^^^^^^^^^^^^^^^^^^^^
File "/root_folder/ibflex/ibflex/parser.py", line 80, in parse_element
return parse_element_container(elem)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root_folder/ibflex/ibflex/parser.py", line 101, in parse_element_container
instances = tuple(parse_data_element(child) for child in elem)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root_folder/ibflex/ibflex/parser.py", line 101, in <genexpr>
instances = tuple(parse_data_element(child) for child in elem)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root_folder/ibflex/ibflex/parser.py", line 125, in parse_data_element
contained_elements = {child.tag: parse_element(child) for child in elem}
^^^^^^^^^^^^^^^^^^^^
File "/root_folder/ibflex/ibflex/parser.py", line 83, in parse_element
return parse_element_container(elem)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root_folder/ibflex/ibflex/parser.py", line 101, in parse_element_container
instances = tuple(parse_data_element(child) for child in elem)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root_folder/ibflex/ibflex/parser.py", line 101, in <genexpr>
instances = tuple(parse_data_element(child) for child in elem)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root_folder/ibflex/ibflex/parser.py", line 115, in parse_data_element
attrs = dict(
^^^^^
File "/root_folder/ibflex/ibflex/parser.py", line 116, in <genexpr>
parse_element_attr(Class, k, v)
File "/root_folder/ibflex/ibflex/parser.py", line 166, in parse_element_attr
raise FlexParserError(msg)
ibflex.parser.FlexParserError: SymbolSummary.tradeDate - Can't convert 'MULTI' to <class 'datetime.date'>
For now, I'll just remove this attribute from the query configuration.
Best regards.