Trade Server Interface

event type

enum class EventType
{
	etLogin = 0,
	etLogOut,
	etOpenTicket,
	etModifyTicket,
	etCloseTicket,
	etTicket,	//send ticket
	etPosition,	//send position
	etAccount,  //send accountinfo
	etROrder,   //receive order
	etSOrder,    //reponse order info
	etSubSymbol,
	etUnSubSymbol,
	etPasswordChange,
	etAccountRemove,
	etPing,
	etPong,
	etSymbols,
};

Login

Request

{
		"event":0,
		"message":{
			"login":xxx,
			"password":"xxx"
}
}

Response

{
	"event":0,
    "message":{
	    "code":0				//OK=0
}
}

Logout

Request

{
		"event":1
}

Open New Ticket

Request

{
		"event":2,
		"message":{
			"login":xxx,
			"symbol":"xxx",
			"volume":xxx,
			"price":xxx,
			"type":xxx
}
}

Response

{
    "event":2,
    "message":{
        "code":0,
        "id":xx
    }
}

Alter Order

Request

{
		"event":3,
		"message":{
			"login":xxx,
			"order":xxx,
			"sl":xxx,
			"tp":xxx
}
}

Response

{
    "event":3,
    "message":{
        "code":0,
        "id":xx
    }
}

Close Postion

Request

{
		"event":2,
		"message":{
			"login":xxx,
			"symbol":"xxx",
			"volume":xxx,
			"price":xxx,
			"type":xxx
			"position":xxx
}
}

Response

{
    "event":2,
    "message":{
        "code":0,
        "id":xx
    }
}

Subscribe Tickets

Request

{
		"event":10,
		"message":{
			"login":xxx,
			"symbols":["xxx","xxx","xxx"]
}
}

UnSubscribe Tickets

Reqyest

{
		"event":11,
		"message":{
			"login":xxx,
			"symbols":["xxx","xxx","xxx"]
}
}

Pump Ticket

Request

{
	"event": 5,
	"message": {
		"timestamp": 1578023516,
		"symbol": "GOLD",
		"bid": 1270.41,
		"ask": 1271.41,
		"high": 1273.00,
		"low": 1269.00
	}
}

Pump Postion

Request

{
	"event": 6,
	"message": {
		"symbol":"GOLD",
		"login": 88252568,
		"position": 12770,
		"volume": 0.1,
		"price": 1271.41,
		"sl": 0,
		"tp": 1269.00,
		"storage": 0,
		"rateProfit":1,
		"digits":2,
		"contractSize":10000,
		"cmd": 6,
		"time": 1578309360,
		"opt": 1 //0--New;1--Alter;2--Delete
	}
}

AccountInfo

Request

{
	"event": 7,
	"message": {
		"login": 88252568,
		"blance": 1000,
		"equity": 1000, 
		"margin": 0,
		"marginFree": 1000,
		"marginLevel":100,
		"marginLeverage": 10,
		"profit": 0,
		"storage": 0, //
		"swap": 0,//
		"commission": 0,
		"floating": 0

	}
}

Response Place Order

Request

{
	"event": 9,
	"message": {
		"reqID": 10,       //RequestID
		"retCode": 10019  //Operation Code
	}
}

Ping

Requet

{
		"event":14
}

Pong

Request

{
		"event":15,
}

Get Symbols

Request

{
		"event":15
}

Response Get Symbols

Request

{
		"event":15,
		"message": {
			"symbols": {"GOLD":"desc","SILVER":"silver"}
		}
}
a756ae04-c0b4-4245-9c9e-406db0d0d956