Discontinued. Take a look to new project at: SaaS REST/JSON WebAPI

 

This is JSON/XML RESTful WebAPI to communicate with any number of MT4 servers using ManagerAPI.

It has SignalR endpoint to let you pull updates immediately it happen in trading platform like Pumping feature offered by MenagerAPI.

For authorizations any of Forms Authentication (Cookies) or OAuth could be used for everything: for Web UI, WebAPI and SignalR.

Configuration

To adjust settings you will have to modify Web.config file.

SignalR

To access real-time streaming endpoint you shall use /streaming relative path.

Functions

Simple ping

ping(string value) - to send any string and get back the same value.

Result: will be send back to hook pong(string value)

example:

var hub = $.connection.streaming;
hub.server.ping($.now());

hub.client.pong = function (msg) {
    console.log("pong: " + msg);
};
Subscribe to ticks stream

Role to be assigned: Ticks

subscribeToTicks(string symbol) - get all incoming ticks from server for selected instrument. As it appears in MT4 server.

Result: will be send back to hook onTick(TickInfo value)

example:

hub.server.subscribeToTicks("EURUSD");
hub.client.onTick = function (tick) {
    console.log(tick);
}
Subscribe to clients` margin updates

Role to be assigned: Margin

subscribeToMarginUpdates(int[] logins) - get margin updates for selected users.
subscribeToAllMarginUpdates() - to get margin updates for all users

You will get initial for all subscribed accounts immediately after call.

Every second updated values will be sent to hook onMarginUpdate(map<login,MarginInfo> values)

for example:

 hub.client.onMarginUpdate = function (perUserMargin) {
    $.each(perUserMargin, function () {
        console.log(this);
    });
};
Subscribe to opened orders updates

Role to be assigned: Opened orders

subscribeToOpenedOrders(int[] logins) - get open trades updates for selected users.
subscribeToAllOpenedOrders() - to get open orders updates for all users

You will get initial for all subscribed accounts immediately after call.

Every second it will send updates to hook onOrderUpdate(TradeRecord[] trades)

example:

hub.client.onOrderUpdate = function (trades) {
    $.each(trades, function () {
        console.log(this);
    });
};
  • No labels