Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Streaming data? #14

Open
X3Coyote opened this issue May 19, 2023 · 5 comments
Open

Streaming data? #14

X3Coyote opened this issue May 19, 2023 · 5 comments

Comments

@X3Coyote
Copy link

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
Copy link
Owner

Moelf commented May 19, 2023

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

@X3Coyote
Copy link
Author

X3Coyote commented May 19, 2023

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
Copy link
Author

I resolved real-time streaming.

@Moelf
Copy link
Owner

Moelf commented Aug 22, 2023

Do you want to make a PR?

@X3Coyote
Copy link
Author

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..

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants