Search code examples
botspybit

ImportError: cannot import name 'usdt_perpetual' from 'pybit'


I am following a tutorial on building a bot for statistic arbitrage.

The following command should be executed:

from pybit import usdt_perpetual

I'm getting an error:

ImportError: cannot import name 'usdt_perpetual' from 'pybit'

The pybit version I use is 1.3.6 as the instructor commented in a recent message below the video that only this version will work with the code provided in the tutorial (I guess it was created 1 or 2 years ago).

Why can this error occur?

Thank you!


Solution

  • It seems that there is no such function in the module itself. Probably the author of the tutorial created a helper function called usdt_perpetual, because normally I see an example of using websockets to get usdt price https://github.com/verata-veritatis/pybit/blob/eb0454085bc6d0fadeeb3ed2b174b6ab16c9f20e/examples/websocket_example.py#L9