robswc / tradingview-webhooks-bot

a framework 🏗 for trading with tradingview webhooks!
http://tvwb.robswc.me
GNU General Public License v3.0
591 stars 180 forks source link

Wondering if this can handle multiple requests at once? #59

Open dorienh opened 1 year ago

dorienh commented 1 year ago

If I were to send 5 webhooks at the same time (each for different strategies), would I be able to handle them properly?

robswc commented 1 year ago

Good question!

It will depend on if the action contains "blocking" functions. i.e. if the action takes a minute to complete, it would take 5 min to complete 5 times.

I could look into making "AsyncActions" which would not be blocking.

Btw, this is all assuming you get 5 actions at once. If you're just talking about 5 strategies that don't all fire at once (and your actions don't take minutes upon minutes to complete) you should be fine! It could theoretically handle unlimited strategies, only limited to how long the actions take to complete.

dorienh commented 1 year ago

I'm mostly wondering if any webhook may get lost. Imagine a close short order comes (takes 5s to execute), but the next open long webhook comes 1s later. It's put in some queue?

devmehta91 commented 5 months ago

afaik he's saying to adapt the action function to run asynchronously -- then this would not be issue, ever.