jeog / TDAmeritradeAPI

Front-end library - with C, C++, Python, and Java interfaces - for the recently expanded TDAmeritrade API
GNU General Public License v3.0
238 stars 61 forks source link

Question: Depth of book endpoints support? #5

Closed goodboy closed 5 years ago

goodboy commented 5 years ago

Hey I'm super curious if your library supports the book end point(s).

The streaming tutorial lists support but it seems undocumented?.

A brief search of the repo shows some enum defs but no code for making actual requests / setting up streams.

Any tips or insight is greatly appreciated. Cool project btw.

jeog commented 5 years ago

I didn't include any of the undocumented services. When I get a chance I'll check the docs for the old version of the API and see if there's something we can do. It might also be a good idea to create a generic Subscription object that allows the user to add raw string services, fields etc. so they can experiment with different services.

goodboy commented 5 years ago

@jeog amazing.

It might also be a good idea to create a generic Subscription object that allows the user to add raw string services, fields etc. so they can experiment with different services.

Sounds great. I sent an email to the api address to see what they had to say about it. I'll report back with anything useful.

goodboy commented 5 years ago

Got a response back from them:

Thank you for your email. We will continue to update the Streamer documentation as time comes. In this particular case, the fields listed in each subsection are the services that you can subscribe to. For a request for streaming Level 2 on MSFT, as an example, here is your request:

requests": [
    {
        "service":"NASDAQ_BOOK",

        "requestid":"3",

        "command":"SUBS",

        "account":userPrincipalsResponse.accounts[0].accountId,

        "source":userPrincipalsResponse.streamerInfo.appId,

        "parameters": {

            "keys":"MSFT",

            "fields":"0,1,2"

        }

    }

]

@jeog I assume this looks more familiar to you then to me ;)

jeog commented 5 years ago

Ok, the docs from the old API show the same fields, just a different format, so it looks like w/ some trial and error you can get that.

Hopefully, if I get some time this weekend, I can push a Raw/Generic Subscription that will allow for trying out all these undocumented services. Then whatever works can be added to the other subscription objects.

jeog commented 5 years ago

Added a raw subscription object so for the example they provided you would do:

sub = stream.RawSubscription( "NASDAQ_BOOK", "SUBS", {"keys":"MSFT", "fields":"0,1,2"} )

session = stream.StreamingSession( credentials, callback )
session.start( sub )

I got a good response from the server so should be good to go.

goodboy commented 5 years ago

@jeog awesome. Sorry I didn't get back to you. Should be playing with this soon!