MT5AccountMarginCallEventArgs StreamMarginCallUpdates(TradePlatformId)
method to MT5
hub to monitor MC/SO events. Every time something happen on server, you will receive structure which JS object has self-explanatory example below: account: {
"login": 2009,
"currencyDigits": 2,
"balance": 3025.7,
"credit": 0,
"margin": 3279.67,
"marginFree": 6.03,
"marginLevel": 100.18385996152051,
"marginLeverage": 100,
"profit": 386,
"storage": 0,
"floating": 386,
"equity": 3285.7,
"soActivation": "None",
"soTime": null,
"soLevel": 0,
"soEquity": 0,
"soMargin": 0,
"blockedCommission": -126,
"blockedProfit": -185428,
"marginInitial": 0,
"marginMaintenance": 0,
"assets": 0,
"liabilities": 0
}
type: "MarginCall"
direction: "Leave"
Direction can be Enter
or Leave
, Type
can be MarginCall
or StopOut
.
rights
enumerable, added missing values, so JSON parser will be ok;HistoryRequestByGroup
HistoryRequestByTickets
OrderRequestByTickets
DealRequestByTickets
ActivationFlags
field type switched from uint
to TradeActivationFlags
type;DealRequestByGroup
DealRequestByGroupSymbol
OrderGetByGroup
OrderGetBySymbol
OrderRequestByGroup
OrderRequestByGroupSymbol
PositionGetByGroup
PositionGetBySymbol
SymbolUpdate
added to MT5
controller;AggregationType
;OrderFilling
enum BoC
added, FOK
and IOC
renamed to FoK
and IoC
;OrderTime
GTC
-> GtC
;OrderActivation
Stoplimit
-> StopLimit
, Stopout
-> StopOut
;UsersRights
Technical
and ExcludeReports
enums added;Retcode
replaced with RetCode
where applicable;DealUpdate
method to MT5 controller;SubscribeToTicks
, SubscribeToAllTicks
, UnsubscribeFromAllTicks
.UserGetByLogins
PositionGetByTickets
GroupGet
GroupRequest
GroupRequestArray
OrderGet
OrderGetByTickets
OrderGetByLogins
DealRequestByTickets
DealRequestByLogins
DealRequestByTicket
ChartRequest
SymbolGet
01.01.1970
- null
will be returned, where date time is nullable field;SymbolRequestArray
SubscribeToSymbols
OnSymbol
and OnSymbolSync
callbacks;UnsubscribeFromSymbols
SubscribeToTicks
, SubscribeToAllTicks
OnTick
callback;UnsubscribeFromAllTicks
SubscribeToPositions
SubscribeToOrders
UserAdd
: If any of passwords (Password
or PasswordInvestor
) is null or empty, both of them will be generated.
We will generate passwords and call manager api method to create user.
If MT5 does not like our password, we will try again with a new pair, a maximum of 10 times;ManagerCurrent
returns updated structure signature;PositionGetByLogins
SMTTime
in favor of default .NET DateTime
to/from UnixTime
/FILETIME
converter;SubscribeToUsers
, updates will be sent through callback(-s):
OnUser
UnsubscribeFromUsers
SubscribeToDeals
, updates will be sent through callback(-s):
OnDeal
OnDealClean
UnsubscribeFromDeals
UserDelete
ClientDelete
UserGetByGroup
TimeGet
ManagerCurrent
UserAccountRequest
DealerSend
response signature changed;UserAccountGet
method to MT5
controller;UserUpdate
now POST
method;MT5Client
requires PersonName
;MT5
controller: added TimeServer
method;UserUpdate
, UserPasswordCheck
and UserPasswordChange
MT5 methods.ServerTime
method to MT4 endpoint;Connect
method supports ConnectArgs
structure where you can specify TimeoutMs
, in milliseconds (30 seconds by default). You shall start your duties from this method;SetTicksAggregationSettings
- not yet available;SubscribeToAllMarginUpdates
- not yet available;UnsubscribeFromAllMarginUpdates
- not yet available;UnsubscribeFromMarginUpdates
- not yet available;SubscribeToMarginUpdates
- not yet available;StreamMarginDiff
- not yet available;Ping
removed, use Connect
instead;All methods awaits structure and send structures.
Because of guide
Old code:
connection.invoke("SubscribeToTicks", tradePlatform, "EURUSD")
New code:
connection.invoke("SubscribeToTicks", {tradePlatform, symbol: "EURUSD"})
All callbacks now return structures.
Old code:
connection.on("onTick", function (tradePlatform, tick) {
/* your code here */
});
New code:
connection.on("onTick", function (args) {
const {tradePlatform, tick} = args;
/* your code here */
});
Check CPlugin.WebAPI.Realtime.ts for further details.
StreamTrades
sent updates for all platforms, regardless of chosen one;StreamUserUpdates
sent updates for all platforms, regardless of chosen one;RefreshAPI
method removed from /TradePlatforms
controller.TradesGetByLogin
method to MT4 RESTfulStreamUserUpdates
returns UserUpdate
structure which ispublic class UserUpdate
{
public TransactionType Type;
public UserRecord User;
}
StreamMarginDiff
to MT4 hub;StreamUserUpdates
to MT4 hub;{
"errorType": "MT4API",
"errorCode": "NotEnoughRights",
"errorDescription": "Not enough rights",
"requestId": "unique id"
}
JournalRequest
, TradeRecordsRequest
, TradesUserHistory
, CfgRequestSymbol
, AdmBalanceCheck
functions will not throw exception but will return BadRequest
if manager account does not have enough rights;IAsyncEnumerable<TradeExEventPayload> StreamTrades(Guid tradePlatform)
bool Connect(Guid tradePlatform)
OnMT4ConnectionStatus
will only be run once status changed, and never during connect to hub;Connect
method removed from MT4 hub;KeepConnectionAliveDuring
parameter;DealerBalance
MT5 methodClientRequest
MT5 methodUserRequest
MT5 methodTick
structure got LastTime
fieldStreamMarginCallUpdates
method to stream margin call updates. During subscription you get all accounts in M/C state. Then, only updates will be send (mc->normal and
normal->mc). Code example is hereStreamAllTicks
method to the MT4 hub, read more hereCfgRequestSymbolGroup
, more info hereClientAdd
HistoryRequest
, DealRequest
return customized enumsDealerSend
call now use customized enums, so call with
parameters {"Login":2000, "Action": "TA_DEALER_POS_EXECUTE", "Symbol":"EURUSD", "Volume":100, "Type": "OP_BUY", "PriceOrder": 1.01}
will not work, please convert arguments to
the new format {"Login":2000, "Action": "DealerPosExecute", "Symbol":"EURUSD", "Volume":100, "Type": "Buy", "PriceOrder": 1.01}
UserAdd
methodDealRequest
MT5 methodHistoryRequest
to MT5 controllerTestController::TryParseDateTime
to test .NET DateTime parser values validity;/healthz
URL endpoint to tell the status, possible values are (HTTP Code, string): [{200,Healthy}, {200,Degraded}, {503,Unhealthy}]
;UserRecordsRequest
method;api-version
passed within query string not supported anymore, to specify api version. Use URL path instead;v2
api endpoint;SignalR::MT4
hub now have method SetTicksAggregationSettings
. Take a look to demo page source code to get example of
use.OnlineExChanges
(OnlineEx
were used before), which is now distinct against changes.void SubscribeToOnlineUpdates(Guid tradePlatform)
, void UnsubscribeFromOnlineUpdates(Guid tradePlatform)
to MT4 hub and
corresponding OnOnlineUpdate(Guid tpConnectionKey, TransactionType transactionType, int login)
callback.UserRecordsRequest
and UsersRequest
methods to MT4
controllercacheId
of Guid
type,cacheTimeout
specifying timout in seconds./API/MT4/{mt4id}/JournalRequest/2020-08-01/2020-09-20/Full?cacheId=63cb3a5f-1bd6-445d-8da8-1b3d8a6ce70d&cacheTimeout=60
cacheId
specified, it will search in DB for cached record associated for this ID, if found - will return cached data instead.cacheTimeout
seconds record will be deleted from DB permanently and will not be available.OnMarginUpdate
Hub method returned zero balanceUnsubscribeFromMarginUpdates
to MT4Hub
MT4::JournalRequest
MT4Hub
called OnMarginUpdate
callback with empty list even client did not subscribe for itHubs:MT4
margin level will be sent for all subscribed users, if subscribed explicitly, does not matter if there any open positions. Or if subscribed to all data, it will send
for those accounts who have open positions.MT4::ManagerCommon
and MT4::ManagerCommonEx
methodsMT4::AdmBalanceCheck
login to be specified as of AdmBalanceCheck/<login>
MT4::AdmBalanceCheck
always return value of type AdmBalanceCheck
(in comparison to ManagerAPI which does not return anything, if balance is ok)MT4::AdmBalanceCheck
now supports only single login specified within URI AdmBalanceCheck/{login:int:min(1)}
MT4::AdmBalanceFix
now supports only single login specified within URI AdmBalanceCheck/{login:int:min(1)}
MT4::UserRecordNew
call result, passwords were suffixed with \0
charactersMT4::UserPasswordSet
now requires Update
permission, instead of Request
MT4::UserRecordNew
API method accept and return structure of type UserRecordNew
where password and password investor presented in plain text, and only once. Following
requests of user settings will return both passwords stored in base64MT4::AdmTradeRecordModify
methodMT4::AdmBalanceCheck
and MT4::AdmBalanceFix
methodsGET
method for MT4 MarginLevelRequest
which does not require pumping and does not need open trades to return a result (in comparison to MarginLevelGet
)SymbolAdd
. Then during whole WebAPI runtime it will collect prices for you into internal buffer. Keep in mind, this is not a history, only most
recent prices for each explicitely monitored symbol. By default, symbol will be in market watch when there are open trades on it. Otherwise, you will not see prices until add
symbol to watch list.TickInfoLast/{symbol}
- request prices for specified symbol onlyTickInfoLast
- request prices for all monitored symbolsGET MT4/<id>/TickInfoLast
GET MT4/<id>/TicksRequest
GET MT4/<id>/ChartRequest
POST API/MT4/<id>/CfgUpdateGroup
POST API/MT4/<id>/UserRecordUpdate
/odata/[controller]({id})
should be redirected to `/api/[controller]/{?id}POST /odata/TradePlatforms({Id})/NS.MT5DealerSend
to send trade request to MT5 server