Eventually Support WebSockets For Handling Orders

It would be nice to see Alpaca eventually add the WebSocket protocol to interface with the current API (primarily dealing with creating/deleting orders) to cut out the overhead of the HTTP protocol, granting slightly faster execution and lower latency especially for more higher frequency algorithms.

2 Likes

Isn’t this what the Streaming is for? See: https://docs.alpaca.markets/api-documentation/api-v2/streaming/

That’s used for listening to order events like order fills, created, canceled, etc… I’m advocating for there to eventually be methods to invoke using Web Sockets to actually create/delete orders. :+1:

2 Likes

Excuse my ignorance, but what would be the advantage of this?

It would cut out the overhead of the HTTP protocol providing slightly more efficient and faster execution for higher frequency algorithms.

2 Likes

Also, not specifically just higher frequency algorithms, but in general quicker execution times is better regardless of the strategy.

Yeah, sounds good.

Everybody tells me that for real HFT it´s not a good idea to use Alpaca since trader closer to the markets, with probably direct link or something like that, will always beat you in speed.

However your websocket proposal sounds like a welcomed improvement.

If you’re dealing with hundreds of trades per second definitely not a good idea with Alpaca, probably short term trading strategies that are entering and exiting positions within the range of a couple of minutes would likely benefit the most from this.

Yeah, even a strategy in the seconds would benefit…

1 Like

Yes, any decrease in order processing time would be very welcome.

1 Like

For what it’s worth, we have improved our order processing in our backend last week by removing the major bottleneck in order processing. There is still a lot of room to improve, but this was one of the major improvements.

2 Likes

i can see a change but it looks on “market sell” the liquidity is incorrect, if i do a market sell its not within the price margins, this might be due to a collar under the price if im wrong. but i didn’t know theirs a collar required for a limit sell