ByteSmith Profile picture
Dec 4, 2022 6 tweets 2 min read Read on X
Many a times we / #algotrading folks have had this question in our mind what if we had multiple different strategy running in separate processes (or have multiple strategy python scripts) and we need WebSocket data feed to each one of those strategy process running individually
However, our brokers allow 1-3 WebSocket connection at any given time, So the obvious question lies ahead of us is how to solve this problem.

The Answer to this question isn't straight as we can have multiple way out of this problem, and nothing is the best or worst, every
single solution will come with its own tradeoff, so we need to see which tradeoff is acceptable to us and won't affect us drastically which can have an adverse effect on our strategies.

The Simplest of all with negligible tradeoffs shall be having a
Local WebSocket Mirror & Broadcast Server.

So, You Need To Setup Like This:
- Initiate and Persist a Single WebSocket Connection with the broker with all the required instruments subscribed in FullQuote mode.
- And in your ticker WebSocket on_message method / function
instead of parsing the incoming packet, just forward the received binary / text packets to local WebSocket Server.

- In Your Individual Strategy Scripts, instead of connecting to the broker WebSocket feed, connect to the local WebSocket Mirror & Broadcast Server.
With this method you can share one broker API WebSocket with any number of individual strategy process / scripts without exhausting API resources and making no concessions with the performance or WebSocket data feed speed.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with ByteSmith

ByteSmith Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @xoreax_eaxeax

Apr 19
@pythontrader999 Thank you for the kind words bhai 🙏. However, I forgot to mention that I have only discussed the NSE. Let me also attach tweets on the BSE LPP Mechanism, which is slightly different from NSE.

While the reference price calculation is almost similar to what NSE does based on the
@pythontrader999 simple average of trade prices in that contract in the last 30 seconds, the LPP calculation mechanism is significantly different from the NSE one.

In BSE, Limit price orders within the Limit Protection Price (LPP) range (higher for buy orders & lower for sell orders) of 60% of
@pythontrader999 the reference price for Option contracts (subject to minimum LPP value of Rs 30) and 3% of reference price for Future Contracts (subject to minimum LPP value of Rs 1.50) shall be accepted by the trading system and orders beyond this price range would get rejected.
Read 8 tweets
Apr 19
@pythontrader999 When you place a SLL (Stop Limit) order, it is initially placed in the exchange's SL Trigger Book. As soon as its trigger point is breached, the exchange will perform a Limit Price Protection (LPP) validation on your SL limit order before moving it from the SL Trigger Book to the Image
@pythontrader999 RL (Regular Lot) book for matching and fill at the price you defined as the limit price.

It's important to note that when you place a SLL order, LPP validation is conducted. If the order is triggered later, another LPP validation is done. If either of these validations fails,
@pythontrader999 your SLL order will be rejected.

However, if the first LPP validation passes and your SLL order reaches the exchange, sitting in the SLT (Stop Limit Trigger) book waiting to be triggered, and then it is triggered, the exchange will perform another LPP validation before
Read 14 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(