Group Abstract Group Abstract

Message Boards Message Boards

1
|
18.8K Views
|
11 Replies
|
5 Total Likes
View groups...
Share
Share this post:

TD Ameritrade API

Posted 4 years ago

Does anyone have experience developing a wrapper or client in Mathematica for interfacing with an asynchronous REST API that also requires token authentication? In particular, I want to communicate with the TD Ameritrade API which would allow for the reception of real time streaming financial data of every sort and also execute trades. I'd like to use Mathematica for real time analysis of the incoming data. I have looked at the Wolfram documentation on external API's but there are not any real world examples only lists of functions which is of no help at all.

POSTED BY: Kerry Litvin
11 Replies

Hi Kerry There was this Community post some years ago about how to access a TD-Ameritrade account use URLFetch, which has now been superseded by URLRead and URLExecute. See https://community.wolfram.com/groups/-/m/t/512676

Michael

POSTED BY: Michael Kelly
POSTED BY: Josh Cameron
Posted 3 years ago

Josh, I tried that link you posted but it says http 403, not authorized. Is that link still good?
Thx

Bart

POSTED BY: Bart J

Hi Guys,

I have attached the TD wrapper. It could be improved a lot, but it will give you a great flavor of what you can do. I would think of it mainly as a good way of testing out a proof of concept, rather than something you could trade with at this point.

https://www.wolframcloud.com/obj/62db899d-0697-48f6-bca0-ac4b51e8bb79

My thinking is this is a good way of seeing what you can actually do with live market data in the Mathematica. My plan is to try and write some option pricing code, and see if I can come up with anything useful.

Anyway, good luck. Happy to help people if you get stuck, and would love other to add improvements so we can all use the cleanest code possible.

Thanks

Josh

POSTED BY: Josh Cameron

One other note. The Tasty Works / Tasty Trade platform is owned and was/is developed by the original people from Think or Swim (Tom Sosnoff and company) which was sold to TD several years ago. They will be providing an API to the Tasty Works platform in the coming weeks which is supposed to be much more user friendly than the TD API. Additionally, since Tasty Works was developed by the same TOS development team and professional traders they knew of all the shortcoming in TOS and have worked to modernize and update every shortcoming and have made the trade execution orders of magnitude faster in Tasty Works than on TD's TOS platform. It is my understanding that since the time TD bought out TOS there has been little if any real modernization of the platform. In fact, with Charles Schwabb's purchase of TD's retail trading business there is little hope for any substantial upgrades to TOS in the immediate future. In short, Tasty Works is essentially a completely overhauled version of TOS both on the front end user interface and the back end execution technologies. I am told that Tasty Works trades are executed via a high frequency trading firm. Something to consider if you are not completely committed to TD and TOS.

https://tastyworks.com/

https://www.tastytrade.com/

POSTED BY: Kerry Litvin

Josh, any relation to Ross Cameron of Warrior Trading and YouTube fame? I think he has the most views of anyone on YouTube discussing day trading.

https://youtu.be/txWaMpSzHhM

Here is the link to the TD API site for developers:

https://developer.tdameritrade.com/apis

POSTED BY: Kerry Litvin

Also there are several very good videos on YouTube describing detailed TD API interface wrappers developed in Python including links to Git Hub where the complete code can be downloaded. I suppose if we could simply use Mathematica to make the calls to the TD API via the provided Python code that may be a workaround.

This fellow's channel has very good information using Python:

https://youtu.be/P5YanfJFlNs

As does this channel:

https://youtu.be/qJ94sSyPGBw

POSTED BY: Kerry Litvin

Also there are several very good videos on YouTube describing detailed TD API interface wrappers developed in Python including links to Git Hub where the complete code can be downloaded. I suppose if we could simply use Mathematica to make the calls to the TD API via the provided Python code that may be a workaround.

This fellow's channel has very good information using Python:

https://youtu.be/P5YanfJFlNs

As does this channel:

https://youtu.be/qJ94sSyPGBw

POSTED BY: Kerry Litvin

Additionally TD provided the following little bit of information:

A callback URL is something you assign to your application during the application registration process. If your application is local to your computer, you can use a locally hosted callback URL like https://127.0.0.1:8080.

POSTED BY: Kerry Litvin
POSTED BY: Kerry Litvin

Josh:

Please post when you have a solution.

I skimmed through the reddit link you provided. It is good that it lead you to a solution path. However, that quick look tells me that there is something a bit convoluted (but if it works? it works!). The parts that are of concern is going to another site just to get a URL Decode or Encode.

Keep us posted

Hans

POSTED BY: Hans Michel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard