Class OrderClientSafe
- Namespace
- ViiSync.AccountApi
- Assembly
- ViiSync.AccountApi.dll
Connection-safe trading (MT5 OrderClientSafe): the same OrderSend / OrderClose / OrderModify / OrderDelete as
ViiSyncAccountApi, but a call that loses its connection (NO_CONNECTION) or its answer
(REQUEST_TIMEOUT) does not simply fail: the wrapper waits — up to TradeTimeoutSafe —
for the API to be connected again, then settles the outcome from the server's state:
- OrderClose / OrderDelete / OrderModify are idempotent on their target: if the position is gone / the order is no longer working / the levels are already in place, the call succeeded; otherwise it is sent once more.
- OrderSend is never re-sent (a second open would double the exposure): the new position or pending order is looked up by symbol, type, volume, magic and comment among the tickets that did not exist before the call; if the server has none, the original exception is thrown.
Refusals (NO_MONEY, INVALID_VOLUME, …) are not connection failures and are thrown at once, as by the API.
public sealed class OrderClientSafe
- Inheritance
-
OrderClientSafe
- Inherited Members
Constructors
- OrderClientSafe(ViiSyncAccountApi)
Wrap a (connected or connecting) API.
Properties
- Api
The API the calls go through.
- ReconnectPollMs
ViiSync extra: how often the wrapper polls the connection while waiting for a reconnect, ms.
- TradeTimeoutSafe
How long a call may take in total, including waiting for a reconnect, ms (MT5
TradeTimeoutSafe).
Methods
- OrderClose(long, string, double, double, OrderType, ulong, FillPolicy, long, PlacedType)
Connection-safe OrderClose(long, string, double, double, OrderType, ulong, FillPolicy, long, string?, long, PlacedType).
- OrderCloseAsync(long, string, double, double, OrderType, ulong, FillPolicy, long, PlacedType)
Async OrderClose(long, string, double, double, OrderType, ulong, FillPolicy, long, PlacedType).
- OrderDelete(long, OrderType, string, double, double)
Connection-safe OrderDelete(long, OrderType, string, double, double).
- OrderModify(long, string, double, double, OrderType, double, double, long, double, Expiration?, string?)
Connection-safe OrderModify(long, string, double, double, OrderType, double, double, long, double, Expiration?, string?).
- OrderSend(string, double, double, OrderType, double, double, ulong, string?, long, FillPolicy, TradeType, double, Expiration?, long, PlacedType)
Connection-safe OrderSend(string, double, double, OrderType, double, double, ulong, string?, long, FillPolicy, TradeType, double, Expiration?, long, PlacedType).