Skip to content

Ameritrade Python interface to handle Authentication, Websocket streaming subscriptions and API requests

License

Notifications You must be signed in to change notification settings

LCuretti/Ameritrade-Interface

Repository files navigation

Ameritrade Python Interface

Handles Authentication, WebSocket streaming subscriptions and API requests. (Developed on Anaconda Spyder on Windows platform)

TDAuthentication.py:

Keeps a valid token access to be used by TDAPI(endpoint requests).

In order to get client_id, redirect_uri you have to register API client at https://developer.tdameritrade.com

There is an explaining video on how to register your API at Ameritrade: https://www.youtube.com/watch?v=qJ94sSyPGBw 

It handles different authentication methods.

Full Automated where account info will be stored for future authentication 
or Full Manual where you have to authenticate each 30 min.

New feature: Handles config file as an object.

TDAPI.py Based on areed1192:

Handle all API requests. GET, POST,PUT, PATCH.

In order to send a valid request it keep authenticating throuh TDAtuthentication Class.

Find below the table with all possible requests.

TDAPI-Test.py:

Has multiple endpoints check for the TDAPI file.

Customed create orders.

Pandas DataFrame output for each enpoint.

TDStream.py:

Handle all subscription for WebSocket streaming. SUBS, UNSUBS, ADD, LOGIN, LOGOUT, QOS.

In order to request the credentials it uses TDAPI Class.

Find below subscription table.

New feature: Keep alive method that subscribes back all subscription when connection comes alive again.
            CSV storadge. 
            Callback function to trigger observers when new data arrives.

TDStreamer-test-py:

Has multiple subscription method to test TDStream.

TDAPI requests table:

Screenshot

TDStream subscription table:

Screenshot

TO DO:

Add DataFrame interface to convert from JSON output.
Add parameter verification.

About

Ameritrade Python interface to handle Authentication, Websocket streaming subscriptions and API requests

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages