AlgoVesta › Glossary › Idempotency

Order Execution

Idempotency

Idempotency means that performing the same operation more than once has the same effect as performing it once; in trading automation it is the property that a signal delivered twice, or an order request sent twice after a network error, results in one position, not two.

Why it matters

Duplicates are normal in messaging systems: Telegram can deliver an edited message as a new event, a webhook sender retries when it does not get a fast acknowledgement, and a trader can click "send test signal" twice. Without idempotency each duplicate becomes a real order with real margin. The problem is worst exactly when the system is under stress, during venue slowdowns and outages, which is when retries and duplicate deliveries multiply.

How AlgoVesta handles it

AlgoVesta applies idempotency at several points. Incoming Telegram messages are recorded by their message identifier, so the same message is not processed twice. A duplicate guard rejects a second signal for the same account, symbol and direction within a short window, which absorbs re-posts and double clicks; the rejection is logged with its reason rather than silently dropped. Order placements are not retried blindly after ambiguous failures; the platform reconciles against the exchange's positions and trade history to decide whether an order actually exists before acting again. Each strategy has its own webhook token, and each execution is tied to the signal that caused it, so the same signal cannot be executed by two paths. See retry logic and the TradingView bot page.

Example

A TradingView alert is configured on a one-minute chart and, because of a strategy setting, fires twice within the same bar with an identical message. The first request opens a long on ETHUSDT. The second arrives 20 seconds later and is rejected by the duplicate guard as the same symbol and direction within the window; it appears in the signal log as blocked with the duplicate reason, and no second position is opened.

Common mistakes

In practice

See how AlgoVesta automates this