Thinkorswim (ameritrade) API for real time data

Some number of months ago in this thread ( TOS (Think or Swim) API) there was a conversation about using tdameritrade/Thinkorswim API to get real time data. I've come back to wanting to do that. I've been trying to use their scanners to create some intraday alerts but they are just too limited; and I have not had good success using the IQFeed data before.

It looks like at some point they opened up their API for account holders as I checked in today and it seems their minimum account size went away and they are promoting this. I think rugmo pointed this out in the thread above.

I'm going to look into this further but am not that technical so was wondering if anyone has gotten anywhere in creating or having a 3rd party create a dataplugin or if anyone would be interested at this point in collaborating to get one created.


I'm fully supportive with you here.

Given that TD Ameritrade, combined with Schwab (now via takeover), controls something like 24 trillion dollars and dwarfs IB in comparison; allows trading and Real-time data as well as data history, for stocks, stock options, futures, futures options, bonds and Forex, as well as FREE commissions, I believe is too valuable a brokerage service to not be supported and utilize officially by Amibroker. Especially with a free API and no account size restrictions or data restrictions that I'm aware of.

Tom being the best programmer out there would have no problem adding it. I'm sure it would vastly increase AB's USA customer base as a result IMHO. I'm sure the combined company will be rolling out more international exchange support as well.

If it were me (and I know it isn't), I would design it so AB would be able to API trade, not just from multiple accounts at the same brokerage firm, but also with different brokerages firms, with regards to an aggregate account data being fed by two different brokerage firms and/or get data from any one of them as well. Maybe able to serve that info outside AB across a local network to other AB instances or custom apps. After all it is called Amibroker.

Even though it would be on the top of my wish list, it sure would be a great Christmas present ;)~ Hehehe

Take a look at TD Ameritrade API:

What they offer is REST API via Json, which is just a web site that responds to HTTP requests with plain text output.
That is the worst possible solution performance-wise.
High-performance data vendors (eSignal / IQFeed) send data using proprietary, compressed binary protocol and they save this way TONS of bandwidth and TONS of nonsense processing that is required to convert binary data (from exchange) to Json (plain text, very "elaborate" format) send over slow HTTP and convert back from JSon (again plain text elaborate) to binary data that is consumed by application.

With such design you can not expect to steam reliably just a < 100 symbols data (less than IB).

Unfortunatelly business decisions in corporations are NOT made by software developers who know the subject and performance consequences, but a bunch of white collar idiots that know nothing about programming and the result is pushing inefficient solutions.

I would guarantee that I will hear instant and never ending flood of complaints on performance of any plugin using TD Ameritrade API simply because of simple bad decision to choose JSon as transfer medium.

Oh... and if you wonder why they don't provide tick and one second backfills, the answer is simple: they can't simply because this format is so inefficient.

Here are some pointers:

Reading the comments provides some insight as to "quality" of the API.

Oh sniffle ;( So the listing for Binary or ASync is not any good either? That's a real shame. Here is further info on them (indexed).

Protocols and QoS

What about just an API to sends orders, trade confirms and account/position info? Just a thought. I'll check if they have a more enterprise connection solution offering not advertised.

1 Like

Sending orders via REST/Json is no problem as amount of data and bandwidth required is nowhere near to the amount of data that you need to stream tick-by-tick data for say 1000 symbols in real-time

In the link that you included we can read

4.3 Update Frequency

Streaming data is updated approximately every 750 ms – 800 ms.

Now people are complaining about 250ms Interactive Brokers aggregation, this (TD API) is 3 times worse.

For the comparison, it is not unusual to see real time stream of over 200 trades per second on single instrument such as ES future, that (assuming steady flow of ticks) is new data every 5ms. That is 150 times faster than TDA can handle.

Here is what can happen on ES future in 250ms:
(Image courtesy of Investopedia, full article:

But of course, for just order placement you can work with REST/Json as the bandwidth requirements are 1000+ times smaller than to deliver tick-by-tick steam.


Yes agreed, I have tried to work with the complete and raw HUGE ES files from the CME, which is pretty impossible/practical. So when viewing any historical tick of the ES, they all seem to be aggregated to some level because the data is just too vast.

The only thing I would say for arguments sake, is although I can't speak for others, I would imagine "we" wouldn't be trying to run a HF shop with this, and orders may be updated every 5 seconds max but most likely 1 minute intervals based on data updated snapshots.

Also, what do you think about level II data, but only referenced when an order needs to be placed, do you think the level II data would be much too late/old? I guess it would depend on the instrument traded.

There is also the utility of historical intra-day and EOD data which would be useful for testing purposes and scans (once a data update is made, i.e, a snapshot in time). I just don't know how long a full or limited symbol snapshot could be obtained under those bandwidth numbers you reference etc.

Thanks for your input Tom, just thinking and podering. Happy Weekend, be safe!