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

Pull Pos Qty from TOS #22

Closed shivamdpat94 closed 4 years ago

shivamdpat94 commented 4 years ago

Hello,

I've successfully connected to TOSDB and have integrated Custom quotes into my python code. I would like to also add "Pos Qty" from the marketwatch/quotes tab as well. It can be added to the table as a column but is not a Custom Quote. It is a Porfolio type instead. It may also go by the name "POSITION_QTY". In the meta_enum.py file, I have looked through the possible topics by looking into dir(cls) on line 124. I do not see anything like Pos Qty as a possible topic. I would like to be able to import data from TOS showing me my share sizes for each stock in the Marketwatch/quotes section. Is this possible using TOSDB?

jeog commented 4 years ago

The topics listed are the only ones available. The only other way to do this would be to access the data through a CUSTOM quote. I believe there is a function for this in thinkscript that you can try using inside a CUSTOM quote script: https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Portfolio/GetQuantity

shivamdpat94 commented 4 years ago

I've given that a try but it appears Portfolio functions such as GetQuotes() is not a callable function in custom quotes. I'm able to use the function in thinkscript when creating an indicator but not in thinkscript when developing a Custom Quote. I am assuming then that there is no way for my python program to be aware of my Portolio size as it is running.

jeog commented 4 years ago

Looks that way. You can always use the TDMA API directly - but that's significantly more work.