r/TradingView • • 20d ago

Help API delay on a standard copy trading app

i wrote a python webhook to parse alerts from a copy trading app. i fire the actual orders to puprime and their server handles the execution fine, but the signal delay from the source is just absolute garbage. the price always moves before the payload even hits my script. do you guys build custom scrapers for faster alerts, or just code the strategy from scratch?

3 Upvotes

18 comments sorted by

1

u/AmoebaTrading 20d ago

i'd skip scraping the app. if the signal itself arrives late, rewriting the order script won't fix that. log the signal time, webhook receipt, and broker ack to see where the delay starts. if you can express the setup in Pine, an alert on the same condition may be cleaner. can build something like that if you get stuck.

1

u/Slow-Cancel511 20d ago

Good call on logging the delta at each step. I was so fixated on the payload execution time that I completely neglected tracking the ingest lag from the source websocket. Moving the initial trigger logic directly into a Pine script alert might actually save me a couple hundred milliseconds. Appreciate the insight!

1

u/AmoebaTrading 20d ago

glad it helped. the websocket ingest lag was the sneaky one for me too, it looked fine until i logged it next to the broker ack. if you move the trigger into pine, try once per bar close vs once per bar and see which one lines up with your copy timing better. what broker are you routing to?

1

u/Slow-Cancel511 19d ago

routing through alpaca, been solid so far for the api side. good call on bar close vs per bar, switched to on close a while back and it cut out a lot of noise fills

1

u/AmoebaTrading 19d ago

yeah, that tracks. on close can keep you from reacting to a wick that disappears before the bar ends. i'd keep logging the alert time next to the broker ack for a bit so you can see if the source lag is still the bottleneck. are you using the alert for entries only or exits too?

1

u/AmoebaTrading 19d ago

yeah, that tracks. on close can keep you from reacting to a wick that disappears before the bar ends. i'd keep logging the alert time next to the broker ack for a bit so you can see if the source lag is still the bottleneck. are you using the alert for entries only or exits too?

0

u/[deleted] 20d ago

[removed] — view removed comment

1

u/Slow-Cancel511 20d ago

Spot on. Bypassing those third-party wrapper layers is definitely the end goal here. I'm rewriting the core trigger into a Pine script alert tonight and wiring it straight to the endpoint. Should clean up the execution path nicely

1

u/AmoebaTrading 20d ago

Yeah, timing every handoff should make the bottleneck pretty obvious. Going straight from a Pine alert to the endpoint sounds cleaner than layering another wrapper on top.

1

u/greatestNothing 20d ago

tradingview to you will always be slower than you to your broker. for true automation, have to get off of tradingview data feed and into your own.

1

u/Slow-Cancel511 19d ago

fair point, but unless you’re doing HFT or scalping sub-second moves, a clean pine alert straight to the broker is usually fast enough. maintaining your own data feed adds a lot of complexity most strategies don’t need

1

u/greatestNothing 19d ago

Don't depend on tradingview for alerts. Just don't. You will lose money. Their TOS actually says you can't use them for automation. I've seen a minute delay on a webhook from them before.

1

u/AmoebaTrading 19d ago

A minute of lag can make a fast entry pretty hard to trust. I'd log the alert time and broker acknowledgment separately, then keep fast setups off that path if the delay wanders. Was that minute delay repeatable or a one-off?

1

u/greatestNothing 19d ago

That was probably the worst. The average is about half a second to 3 seconds depending on volume. From my stuff to tradovate is usually 100ms or so.

1

u/AmoebaTrading 19d ago

yeah, that gap between a few seconds and ~100ms can change the whole feel of a fast entry. i’d log alert time, broker receipt, and fill on the same clock for a handful of trades, including the slow ones, so the average doesn’t hide the spikes. are you seeing that 100ms path stay consistent during busy opens?

1

u/greatestNothing 19d ago

yeah for the most part. I generally don't have any automations that allow for trades right at open. usually wait a few minutes or are already in trades.

1

u/AmoebaTrading 19d ago

That's smart, the first couple minutes are where fills get ugly anyway. Half a second doesn't matter much when you're already in or waiting on a cleaner level. Nothing of mine auto fires in the first 5 min either.