erdewit / ib_insync

Python sync/async framework for Interactive Brokers API
BSD 2-Clause "Simplified" License
2.8k stars 743 forks source link

Decoder error #178

Closed eric0470 closed 5 years ago

eric0470 commented 5 years ago

Hi! I am getting decoding error. What could be reason of that?

Ib_insync: 0.9.53 TWS: 972.1s

terminal_1 | Error handling fields: ['34', '355', '301051225', 'MGC', 'FUT', '20191227', '0', '?', '10', 'NYMEX', 'USD', 'MGCZ9', 'MGC', 'SELL', '0.7143', '
LMT', '1516.9', '0.0', 'GTC', '4f0fac2a-57c8-449b-a5ff-bb9cd3e19668', 'U2056660', 'C', '0', 'algo', '11', '160673290', '0', '0', '0', '', '160673290.0/U20523
07/100', '', '', '', '', '', '', '', '', '', '0', '', '-1', '0', '', '', '', '', '', '', '0', '0', '0', '', '3', '0', '0', '', '0', '0', '', '0', 'None', '',
'0', '', '', '', '?', '0', '0', '', '0', '0', '', '', '', '', '', '0', '0', '0', '', '', '', '', '0', '', 'IB', '0', '0', '', '0', '0', 'Submitted', '1.7976
931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.79769
31348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '', '', '', '', '', '0', '0', '0', 'None', '1.7976931348623157E308', '1515.9', '1.79769
31348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '0', '', '', '', '1.7976931348623157E308', '1']
terminal_1 | Traceback (most recent call last):
terminal_1 | File "/usr/local/lib/python3.6/site-packages/ib_insync/decoder.py", line 188, in interpret
terminal_1 | handler(fields)
terminal_1 | File "/usr/local/lib/python3.6/site-packages/ib_insync/decoder.py", line 1014, in openOrder
terminal_1 | self.parse(o)
terminal_1 | File "/usr/local/lib/python3.6/site-packages/ib_insync/decoder.py", line 202, in parse
terminal_1 | setattr(obj, k, int(v) if v else default)
terminal_1 | ValueError: invalid literal for int() with base 10: '0.7143'
terminal_1 | Error handling fields: ['34', '355', '301051225', 'MGC', 'FUT', '20191227', '0', '?', '10', 'NYMEX', 'USD', 'MGCZ9', 'MGC', 'SELL', '0.2653', '
LMT', '1516.9', '0.0', 'GTC', '4f0fac2a-57c8-449b-a5ff-bb9cd3e19668', 'U2056660', 'C', '0', 'algo', '11', '160673290', '0', '0', '0', '', '160673290.0/U20523
07/100', '', '', '', '', '', '', '', '', '', '0', '', '-1', '0', '', '', '', '', '', '', '0', '0', '0', '', '3', '0', '0', '', '0', '0', '', '0', 'None', '',
'0', '', '', '', '?', '0', '0', '', '0', '0', '', '', '', '', '', '0', '0', '0', '', '', '', '', '0', '', 'IB', '0', '0', '', '0', '0', 'Submitted', '1.7976
931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.79769
31348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '', '', '', '', '', '0', '0', '0', 'None', '1.7976931348623157E308', '1515.9', '1.79769
31348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '0', '', '', '', '1.7976931348623157E308', '1']
terminal_1 | Traceback (most recent call last):
terminal_1 | File "/usr/local/lib/python3.6/site-packages/ib_insync/decoder.py", line 188, in interpret
terminal_1 | handler(fields)
terminal_1 | File "/usr/local/lib/python3.6/site-packages/ib_insync/decoder.py", line 1014, in openOrder
terminal_1 | self.parse(o)
terminal_1 | File "/usr/local/lib/python3.6/site-packages/ib_insync/decoder.py", line 202, in parse
terminal_1 | setattr(obj, k, int(v) if v else default)
terminal_1 | ValueError: invalid literal for int() with base 10: '0.2653'
terminal_1 | Error handling fields: ['34', '355', '301051225', 'MGC', 'FUT', '20191227', '0', '?', '10', 'NYMEX', 'USD', 'MGCZ9', 'MGC', 'SELL', '0.7347', '
LMT', '1516.9', '0.0', 'GTC', '4f0fac2a-57c8-449b-a5ff-bb9cd3e19668', 'U2056660', 'C', '0', 'algo', '11', '160673290', '0', '0', '0', '', '160673290.0/U20523
07/100', '', '', '', '', '', '', '', '', '', '0', '', '-1', '0', '', '', '', '', '', '', '0', '0', '0', '', '3', '0', '0', '', '0', '0', '', '0', 'None', '',
'0', '', '', '', '?', '0', '0', '', '0', '0', '', '', '', '', '', '0', '0', '0', '', '', '', '', '0', '', 'IB', '0', '0', '', '0', '0', 'PendingCancel', '1.
7976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.7
976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '', '', '', '', '', '0', '0', '0', 'None', '1.7976931348623157E308', '1515.9', '1.7
976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '0', '', '', '', '1.7976931348623157E308', '1']
terminal_1 | Traceback (most recent call last):
terminal_1 | File "/usr/local/lib/python3.6/site-packages/ib_insync/decoder.py", line 188, in interpret
terminal_1 | handler(fields)
terminal_1 | File "/usr/local/lib/python3.6/site-packages/ib_insync/decoder.py", line 1014, in openOrder
terminal_1 | self.parse(o)
terminal_1 | File "/usr/local/lib/python3.6/site-packages/ib_insync/decoder.py", line 202, in parse
terminal_1 | setattr(obj, k, int(v) if v else default)
terminal_1 | ValueError: invalid literal for int() with base 10: '0.7347'
terminal_1 | Error handling fields: ['34', '355', '301051225', 'MGC', 'FUT', '20191227', '0', '?', '10', 'NYMEX', 'USD', 'MGCZ9', 'MGC', 'SELL', '0.7347', '
LMT', '1516.9', '0.0', 'GTC', '4f0fac2a-57c8-449b-a5ff-bb9cd3e19668', 'U2056660', 'C', '0', 'algo', '11', '160673290', '0', '0', '0', '', '160673290.0/U20523
07/100', '', '', '', '', '', '', '', '', '', '0', '', '-1', '0', '', '', '', '', '', '', '0', '0', '0', '', '3', '0', '0', '', '0', '0', '', '0', 'None', '',
'0', '', '', '', '?', '0', '0', '', '0', '0', '', '', '', '', '', '0', '0', '0', '', '', '', '', '0', '', 'IB', '0', '0', '', '0', '0', 'PendingCancel', '1.
7976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.7
976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '', '', '', '', '', '0', '0', '0', 'None', '1.7976931348623157E308', '1515.9', '1.7
976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '1.7976931348623157E308', '0', '', '', '', '1.7976931348623157E308', '1']
terminal_1 | Traceback (most recent call last):
terminal_1 | File "/usr/local/lib/python3.6/site-packages/ib_insync/decoder.py", line 188, in interpret
terminal_1 | handler(fields)
terminal_1 | File "/usr/local/lib/python3.6/site-packages/ib_insync/decoder.py", line 1014, in openOrder
terminal_1 | self.parse(o)
terminal_1 | File "/usr/local/lib/python3.6/site-packages/ib_insync/decoder.py", line 202, in parse
terminal_1 | setattr(obj, k, int(v) if v else default)
terminal_1 | ValueError: invalid literal for int() with base 10: '0.7347'
erdewit commented 5 years ago

ValueError: invalid literal for int() with base 10: '0.7347'

Eric, thanks for the bug report. The field that trips up the decoder is for Order.totalQuantity which expects an integer and gets a float. A float should be allowed though and I've fixed this in the newest version (v0.9.56).