tastyworks_api
tastyworks_api copied to clipboard
Account DataStreamer
Is your feature request related to a problem? Please describe. N/A
Describe the solution you'd like
In addition to the datastream of the securities (wss://tasty.dxfeed.com/live/cometd), there is also an account websocket stream available at wss://streamer.tastyworks.com/
which streams Account-level events like Order, AccountBalance, etc. I haven't gone too deep, but this is what the TastyWorks Trader Platform Web UI listens to. Same OAuth token as other API services.
When someone has time, we should expose this as well. My quick hack job is here: https://gist.github.com/jonovate/9ef88d44fd73282ae90d5c35ec2a9c33
Describe alternatives you've considered N/A
Additional context My eventual goal is to automatically generate a {d}% Limit Sell, or even an automatic Stop Loss, as soon as I place the Order - features TOS has that TW does not.
That's a useful feature. Thank you. I will however look at expanding the basic features first and making them more reliable if necessary.
If you would like this in sooner, please feel free to fork and submit a pull request. I'd be happy to take a look at work on it with you.
I'm pretty far ahead of you :) -- but they're more for my own needs. https://github.com/jonovate/tastyworks_api
Nice! I would appreciate if you want to share any of that code as a PR to this project.
I don't have tests for my changes - so it would be a good issue for someone else to move it over and write tests :)
I don't have tests for my changes - so it would be a good issue for someone else to move it over and write tests :)
@jonovate I have been using your account streamer code to detect my order fills and send to a slack channel. Recently it started throwing an error at me that is way over my head to fix. Here is an image depicting the error. https://gyazo.com/be35dccb382b7981ab5fcdb7ca9ed187
@tmills86 I switched from TW. It may take me a while to troubleshoot.
At what exact time does the error come up? On startup, or on Order fill or ???
@jonovate Line 82 of https://github.com/jonovate/tastyworks_api/blob/master/tastyworks/example_account_streamer.py will produce this error. Seems on startup of calling the AccountEvent object
@tmills86 : From a (very) quick look at your error, it seem to me that TW have added a request-id
field to their schema. Probably a good issue would be to harden that code a bit and ignore data which is not catered for on our side. That's one of the disadvantages of writing an unofficial API is that we're always one step behind unfortunately :)
@jonovate : It would be greatly appreciated it if you could PR the changes you've done on your side. Even if they need to be polished more, any extra help and assistance always goes a long way :)
@boyan-soubachov That was my suspicion as well, I just can't seem to figure out where/how to filter that out.
@tmills86 - Fixed - https://github.com/jonovate/tastyworks_api/commits/master.
As Boyan said, Tastyworks changed the Data Format coming back and Python DataClass didn't like. It appears the Account Subscribe now inherits from a similar base class as Heartbeat (both have a request-id
and auth-token
now...)
@boyan-soubachov - If I find time -- I have 0% test coverage and it's like a second standalone command, versus integrated with yours.
Thanks Jonathon,
I’ll try and merge whatever code you have in there and adapt it to fit the current code base a bit more. I just haven’t had the time to maintain this project as of recent due to personal priorities
On 23 Jul 2019, at 05:27, Jonathon J. Howey [email protected] wrote:
@tmills86 - Fixed - https://github.com/jonovate/tastyworks_api/commits/master.
As Boyan said, Tastyworks changed the Data Format coming back and Python DataClass didn't like. It appears the Account Subscribe on their side inherits from the same base class as Heartbeat (which both have a request-id and auth-token now...
@boyan-soubachov - If I find time -- I have 0% test coverage and it's like a second standalone command, versus integrated with yours.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Thank you guys!! I'm new to python and figuring out this error was way over my head! I really appreciate the help! I learned a lot in the process!