question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: 'Entity' object is not subscriptable

See original GitHub issue

I’ve often come across this error either right after executing an order or when loading non-historical data.

Here’s an example after execution

May 27 10:11:57  /app/.heroku/python/lib/python3.6/site-packages/alpaca_trade_api/stream2.py:151: UserWarning: Discarding nonzero nanoseconds in conversion
May 27 10:11:57    await handler(self, channel, ent)
May 27 10:12:12  sleep 3 seconds and retrying https://paper-api.alpaca.markets/v2/account 3 more time(s)...
May 27 10:12:15  sleep 3 seconds and retrying https://paper-api.alpaca.markets/v2/account 3 more time(s)...
May 27 10:12:19  sleep 3 seconds and retrying https://paper-api.alpaca.markets/v2/account 3 more time(s)...
May 27 10:12:22  sleep 3 seconds and retrying https://paper-api.alpaca.markets/v2/account 3 more time(s)...
May 27 10:12:25  buy_bracket - limitprice=826.360, price=822.569, stopprice=820.885
May 27 10:12:25  Exception in thread Thread-1:
May 27 10:12:25  Traceback (most recent call last):
May 27 10:12:25    File "/app/.heroku/python/lib/python3.6/threading.py", line 916, in _bootstrap_inner
May 27 10:12:25      self.run()
May 27 10:12:25    File "/app/.heroku/python/lib/python3.6/threading.py", line 864, in run
May 27 10:12:25      self._target(*self._args, **self._kwargs)
May 27 10:12:25    File "/app/.heroku/python/lib/python3.6/site-packages/alpaca_backtrader_api/alpacastore.py", line 328, in _t_streaming_listener
May 27 10:12:25      self._transaction(trans)
May 27 10:12:25    File "/app/.heroku/python/lib/python3.6/site-packages/alpaca_backtrader_api/alpacastore.py", line 650, in _transaction
May 27 10:12:25      oid = trans['id']
May 27 10:12:25  TypeError: 'Entity' object is not subscriptable

This happens both using polygon and not using polygon.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
jtbalescommented, Jun 3, 2020

Just tested it and that did the trick, thanks

1reaction
shlomikushchicommented, Jun 3, 2020

a fix for this issue is available in the master branch. install it like this: pip install -U git+https://github.com/alpacahq/alpaca-backtrader-api let me know id this still happens

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: 'int' object is not subscriptable (python)
I'm having problems making a matrix multiplication algorithm in python3. This results in the TypeError: 'int' object is not subscriptable ...
Read more >
TypeError: 'int' object is not subscriptable [Solved Python ...
The Python error "TypeError: 'int' object is not subscriptable" occurs when you try to treat an integer like a subscriptable object.
Read more >
TypeError: object is not subscriptable in Python
The Python "TypeError: object is not subscriptable" occurs when we access a non-subscriptable object at a specific index. To solve the error, ...
Read more >
typeerror: 'function' object is not subscriptable
What Causes the TypeError: function object is not subscriptable? There are two main causes of this error: attempting to call a function with...
Read more >
TypeError: 'NoneType' object is not subscriptable" for a ...
The error says , a non-subscriptable data type is being subscripted. Subscription means, referring a value inside a data structure either by index...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found