Moelf / TDAmeritrade.jl

A pure Julia wrapper for TD Ameritrade APIs
https://moelf.github.io/TDAmeritrade.jl/dev/
MIT License
10 stars 3 forks source link

Streaming data? #14

Open X3Coyote opened 1 year ago

X3Coyote commented 1 year ago

Hello, I'm trying to get the user preferences for streaming, but I'm pretty new to Julia. I need access to streaming data.

where would I add this:

function get_user_principals(fields::AbstractString="") uri = construct_api("userprincipals", ["fields" => fields]) head = ["Authorization" => "Bearer "*AUTH_KEY.ACCESS_TOKEN] resp = HTTP.get(uri, head) body = resp.body |> JSON3.read return body end

I also have this to use it:

using Pkg, DataFrames, TDAmeritrade, HTTP

TD_auth()

Retrieve user info and preferences for real-time operations

fields = "streamerSubscriptionKeys,streamerConnectionInfo,preferences,surrogateIds" principals = get_user_principals(fields)

Access the retrieved information

streamerSubscriptionKeys = principals["streamerSubscriptionKeys"] streamerConnectionInfo = principals["streamerConnectionInfo"] preferences = principals["preferences"] surrogateIds = principals["surrogateIds"]

Print or further process the retrieved information

println("Streamer Subscription Keys: $streamerSubscriptionKeys") println("Streamer Connection Info: $streamerConnectionInfo") println("Preferences: $preferences") println("Surrogate IDs: $surrogateIds")

Moelf commented 1 year ago

I don't quite understand what you're trying to ask

X3Coyote commented 1 year ago

I am basically trying to get the user principals. This is needed to get access to the info needed for real-time data.

see this page: https://developer.tdameritrade.com/user-principal/apis/get/userprincipals-0

I need data to be able to get real-time data.

My question is how do I add it to your TDAmerica.jl ?

X3Coyote commented 11 months ago

I resolved real-time streaming.

Moelf commented 11 months ago

Do you want to make a PR?

X3Coyote commented 11 months ago

I'm going to do some testing then I may upload it for you if you like. I'm still learning the ins and outs of Julia. I'm still working on some error correction..