jeog / TOSDataBridge

A collection of resources for pulling real-time streaming data off of TDAmeritrade's ThinkOrSwim(TOS) platform; providing C, C++, Java and Python interfaces.
GNU General Public License v3.0
321 stars 69 forks source link
api c c-plus-plus concurrency dde dll finance ipc java java-wrapper jna market-data python python-wrapper real-time tcp thinkorswim tos virtualization windows

TOSDataBridge


TOSDataBridge (TOSDB) is an open-source collection of resources for pulling real-time streaming data off of TDAmeritrade's ThinkOrSwim(TOS) platform, providing C, C++, Java and Python interfaces.

TOSDB uses TOS's antiquated, yet still useful, DDE feature, directly through the Windows API. The C / C++ interfaces are implemented as a shared library that communicates with a backend Windows Service.

The Python and Java interfaces wrap this library in a more object-oriented, user-friendly format.

The core implementation is not portable, but the python interface does provides a thin virtualization layer over TCP. A user running Windows in a Virtual Machine, for instance, can expose the same python interface to a different host system running python3.


Updates


Accessing the TDAmeritrade API Directly

Ameritrade recently expanded and opened up their API for streaming/historical data, account access, and trade execution. Take a look at a new front-end library for it that's currently in development. If you're simply looking for light-weight access to real-time market data and/or custom TOS studies/strategies data TOSDataBridge is probably a better approach.

New Symbols for Futures Contracts

Ameritrade recently changed the symbols needed for futures contracts. For example, "/ES" is now "/ES:XCME".

/ES:XCME
/NQ:XCME
/YM:XCBT
/RTY:XCME
/NKD:XCME
/EMD:XCME
/VX:XCBF
/BTC:XCME
/XBT:XCBF
/CL:XNYM
/QM:XNYM
/NG:XNYM
/QG:XNYM
/RB:XNYM
/HO:XNYM
/BZ:XNYM
/GC:XCEC
/MGC:XCEC
/SI:XCEC
/SIL:XCEC
/HG:XCEC
/PL:XNYM
/PA:XNYM
/ZB:XCBT
/ZN:XCBT
/ZF:XCBT
/ZT:XCBT
/UB:XCBT
/TN:XCBT
/GE:XCME
/ZQ:XCBT
/GLB:XCME
/6A:XCME
/M6A:XCME
/6B:XCME
/M6B:XCME
/6C:XCME
/6E:XCME
/E7:XCME
/M6E:XCME
/6J:XCME
/J7:XCME
/6M:XCME
/6N:XCME
/6S:XCME
/ZC:XCBT
/XC:XCBT
/ZS:XCBT
/XK:XCBT
/ZW:XCBT
/XW:XCBT
/KE:XCBT
/ZM:XCBT
/ZL:XCBT
/ZO:XCBT
/HE:XCME
/GF:XCME
/LE:XCME
/LBS:XCME
/FNG:IFUS
/MME:IFUS
/DX:IFUS
/YG:IFUS
/YI:IFUS
/CT:IFUS
/CC:IFUS
/KC:IFUS
/SB:IFUS
/OJ:IFUS

Requirements


Versions


New Features


Quick Setup


Quick Start


  1. You may need to white-list some of these files (specifically tos-databridge-engine-[x86|x64].exe) in your Anti-Virus software before proceeding.
  2. Start the service:

    (Admin) C:\> SC start TOSDataBridge

    (consider having the service begin automatically on startup to avoid this step in the future; see #9 in the Installation Details.)

  3. Log on to your TOS platform
For C/C++:
For Python:
For Java:

Build (optional)


Contents


Docs


Installation

Details

C/C++ API

Python

Java

Troubleshooting

FAQ

Contributions


This project grew out of personal need and is maintained by a single developer. Contributions - testing, bug fixes, suggestions, extensions, whatever - are always welcome. If you want to contribute something non-trivial it's recommended you communicate the intention first to avoid unnecessary and/or conflicting work.

Simply reporting bugs or questioning unintuitive interface design can be very helpful.

License & Terms


TOSDB is released under the GNU General Public License(GPL); a copy (LICENSE.txt) should be included. If not, see http://www.gnu.org/licenses. The author reserves the right to issue current and/or future versions of TOSDB under other licensing agreements. Any party that wishes to use TOSDB, in whole or in part, in any way not explicitly stipulated by the GPL, is thereby required to obtain a separate license from the author. The author reserves all other rights.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

By choosing to use the software - under the broadest interpretation of the term "use" - you absolve the author of ANY and ALL responsibility, for ANY and ALL damages incurred; including, but not limited to, damages arising from the accuracy and/or timeliness of data the software does, or does not, provide.

Furthermore, TOSDB is in no way related to TDAmeritrade or affiliated parties; users of TOSDB must abide by their terms of service and are solely responsible for any violations therein.


Copyright (C) 2014 Jonathon Ogden