Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: tuple indices must be integers or slices, not str (Bybit) #378

Open
batareikin opened this issue Feb 7, 2023 · 0 comments
Open

Comments

@batareikin
Copy link

batareikin commented Feb 7, 2023

Could you please advise on how to fix this permanently showing up error:

future: <Task finished name='Task-3090' coro=<Bot.on_market_stream_event() done, defined at /home/.../passivbot.py:802> exception=TypeError('tuple indices must be integers or slices, not str')>
Traceback (most recent call last):
File "/home/.../passivbot.py", line 821, in on_market_stream_event
await self.cancel_and_create()
File "/home/.../passivbot.py", line 796, in cancel_and_create
results.append(await self.create_orders(to_create[: self.max_n_orders_per_batch]))
File "/home/.../passivbot.py", line 351, in create_orders
for order in sorted(orders, key=lambda x: calc_diff(x["price"], self.price)):
File "/home/.../passivbot.py", line 351, in
for order in sorted(orders, key=lambda x: calc_diff(x["price"], self.price)):
TypeError: tuple indices must be integers or slices, not str
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Then, after an execution of "cancel order" :
(2023-02-07T08:29:52 INFO short: -3437.0 @ 0.09142 sWE: 1.1221 pprc diff -0.001 EMAs: [0.091306, 0.091306, 0.091306] e 0.0 @ 0.0 | c 687.0 @ 0.09124
2023-02-07T08:29:52 INFO updating position with REST API before creating initial entries. Last price 0.09132
2023-02-07T08:29:55 INFO cancelled order DOGEUSDT buy short 687.0 0.09124
2023-02-07T08:29:55 INFO cancelled order DOGEUSDT buy short 687.0 0.09118
2023-02-07T08:29:55 INFO cancelled order DOGEUSDT buy short 687.0 0.09112)

passivbot.py shows yet another error:

ERROR error handling user stream event, tuple indices must be integers or slices, not str
Traceback (most recent call last):
File "/home/.../passivbot.py", line 982, in on_user_stream_event
await self.cancel_and_create()
File "/home/.../passivbot.py", line 796, in cancel_and_create
results.append(await self.create_orders(to_create[: self.max_n_orders_per_batch]))
File "/home/.../passivbot.py", line 351, in create_orders
for order in sorted(orders, key=lambda x: calc_diff(x["price"], self.price)):
File "/home/..../passivbot.py", line 351, in
for order in sorted(orders, key=lambda x: calc_diff(x["price"], self.price)):
TypeError: tuple indices must be integers or slices, not str

These two errors fix would be highly appreciated.

@batareikin batareikin changed the title Task exception was never retrieved (working with Bybit) TypeError: tuple indices must be integers or slices, not str (Bybit) Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant