Connect Info

Connect Info

endpoint:

testnet : https://ws.testnet.mycoinstory.com

required: socketio

https://socket.io/docs/

address: "",
query: {
	"apiKey": [apiKey, expire, signature]
}

// example
// apiKey=J/8N1DME4jZ7aUB5LTpQqUB+7az+n6SPLPjQbzTGgrY=,4f4492703c006cdfb4d22691cd65cbb652ff0555cf032efc78b09f01f89ca0b0

// signature generate example
path = "/all"
HEX(HMAC_SHA256(apiSecret, path))
HEX(HMAC_SHA256("9wFVH+WfCxyGS5G6WFbk42HX+GZ5wjQWm/HSl01ky6c=", "/all"))

Init Connect

channel: "connectMessage"
data: String
ex) "private connect success" || "invalid api-key" || "invalid signature"

Data

Position

channel: "positions"
data: {
	BTCUSDT: {
		SINGLE: {
			symbol: "BTCUSDT", // string
			positionId: 58, // long
			marginType: "ISOLATED", // string
			entryPrice: 8255, // double
			quantity: 100, // long
			positionQuantity: 100, // long
			direction: "LONG", // string
			positionEntryMargin: "0.0012125984251968504", // string
			orderMargin: "0.0018654948890550987", // string
			leverage: "10.148620901215", // string
			liquidationPrice: "13938.67783727", // string
			positionType: "SINGLE", // string
			buyOrderPrice: "7097.3790569948", // string
			buyOrderQuantity: 849, // long
			sellOrderPrice: "7103.085902047168", // string
			sellOrderQuantity: 743, // long
			closeByQuantity: 0, // long
			openCumTpnl: "0.000939497364555892", // string
			cumRPNL: 0.0008937843798050679, // double

			// only change data
			changeDetailType: "LOCK", // string
	
			// The data sent periodically includes the following values.
			adlPoint: 0.06818181818181818, // higher the safety
			upnl: "0.00077435", // string
			roe: "0.693021611974", // string
			positionValue: "0.01133953", // string
			initialMargin: "0.001117346414", // string
		}
	},
	TMTGUSDT: {}
}

changeDetailType

Balance

channel: "balance"
data: {
	accountId: 53, // long
	availableBalance: 0.9999590812732282, // double
	asset: "BTC", // string
	positionEntryMargin: 0.00003933685991692, // double
	lockedBalance: 0, // double
	orderMargin: 0, // double
	walletBalance: 0.9999984181331452, // double
	withdrawableBalance: -0.00003931249700706019, // double

	// The data sent periodically includes the following values.
	UPNL: 0.0000274492898, // double
	marginBalance: 1.0000258674229452, // double
	positionMargin: 0.00006678614971692001, // double
}

OrderBook

channel: "orderbook"
// init data
data: {
	"action": "partial", // string
	"symbol": "BTCUSDT", // string
	"data": {
		"ask": [],
		"bid": [
			{
				"quantity": 101829, // long
				"price": 20000, // double
				"priceId": "2000000", // string
				"orderSide": "SELL",  // string "SELL" || "BUY"
				"timestamp": 1595899407809, // long
				"tx": 72278088 // long
			},
			{...}
		]
	}
}

// update data
data: {
	"action": "update",
	"symbol": "BTCUSDT",
	"data": {
		"delete": [],
		"insert": [],
		"update": [
			{
				"quantity": 16196, // long
				"price": 10937.5, // double
				"priceId": "1093750", // string
				"orderSide": "BUY", // string "BUY" || "SELL"
				"timestamp": 1595995004223, // long
				"tx": 74415916, // long
			},
		]
	}
}

OrderActive