The tda-api is an unofficial wrapper for the TD Ameritrade APIs. It offers you an elegant programmatic interface over each endpoint. There are many things you can do using this package like login and authentication, Quotes, fundamentals, historical pricing data e.t.c. But if you are getting the error like no module named tda then this post is for you. In this entire tutorial, you will learn how to solve the issue of no module named tda easily.
What is the No Module named error?
No module named error is also known as ModuleNotFoundError. When you are getting this type of error then the python interpreter is telling you that the specific package is not installed in your system. To remove the error you have to install that package before using it in the program.
Why no module named tda error comes?
There can be many reasons for getting the no module named tda error. But the main and root cause of the error is that you must not have installed the package you are importing in your code. For example, If I import auth and client from the tda then I will get the underline below the word tda. The python interpreter is telling you that the TDA package is not installed in your system.
from tda import auth, client
The same case will be for command prompt or terminal if you are trying to import auth and client package then you will get the ModuleNotFoundError: No module named tda error.
How to solve the No Module named tda error?
The solution for this No module named tda error is very simple. You have to install the tda-api package in your system using the pip command. You have to also check the version of the python before using the pip command. As there are two ways of using the pip command that is the pip or pip3. If your system has a python 3. xx version then use the pip3 command and if it is python 2. xx then use the pip command.
Use the below command to check the version of the python.
My system has python 3. xx version, that’s why I will use the pip3 command.
Run the below command to install the tda-api python package in your system.
pip3 install tda-api
Now if you again import the auth and client from the tda module then you will not get the modulenotfounderror tda error.
If you are using the TD Ameritrade APIs and want to integrate them into your python code then you have to use the tda-api python module. And if you are getting the ModuleNotFoundError for tda module then the above solution will work for you.