Models
The supported model types between Server and Client are given in the following tables.
The Code in the table is the type value of the model. (The number on the top left of the model)
ShortName is the model code (which we use this way) that can be used as a variable, class, or enum name.
Mixes of types (letter code at the top right of the model) and usage patterns are as follows:
P: general packages. Contains type. There is no need to subscribe or login to any channel to receive or send.
U: General packages that are accessed only by logged-in users. These packages also do not have a /channel and subscription connection.
Code Example for Connecting Channels
Public Socket Messages
Channel 100 (Result)
A message sent from the server to the client. These are model-free results returned from requests sent to the server. For example, UserLogin, Subscription, and so on.
100 | Result | P |
---|---|---|
Type | number | Model type |
ID | number | Id value of the model being processed. It is used in some Result models. The value can be 0 when not in use. |
Ok | boolean | Transaction success |
message | string | transaction message. It usually contains short codes for the transaction. It should not be shown to the end user. For example, the value returned as subscription result: “join | trade: BTCTRY” is similar. |
Channel 101 (Request)
Extra requests sent to the server. For example, the Request model is sent when the last operations list is requested again.
101 | Request | P |
---|---|---|
type | number | Model type |
code | number | The request code. Designed in the same way as possible with package types. These request codes are listed at the end of the document. For example, the client must send this code value 421 (model type of final operations) to request that the last transactions be sent back to it. |
channel | string | If the request is sent over a particular channel, this value must be written to the channel name. For non-channel requests, null can be sent. |
event | string | If the request is sent over a particular event, this value must be written to the name of the event. For non-event requests, null can be sent. |
Channel 151 (Subscription)
A message sent from the client to the server. A model sent to subscribe to or unsubscribe from an event on a channel. Messages related to subscribed events are continuously sent to the user.
Request Example
151 | Subscription | P |
type | number | Model type |
channel | string | The name of the channel. For example; trade, orderbook, ticker etc. |
event | string | Event names are often used as “all” or upper-case as pair name (eg BTCTRY, ETHTRY). |
join | boolean |
|
Channel 401 (TickerAll)
A message sent from the server to the client. It is the model of all ticker data belonging to all Pairs.
Request Example
401 | TickerAll | C |
type | number | Model type |
items | TickerPair [] | An array of type TickerPair. The only difference is that there is no type variable in every TickerPair model. The TickerPair model is described below. |
Channel 402 (TickerPair)
A message sent from the server to the client. It is only a model of all ticker data for a particular Pair.
Request Example
402 | TickerPair | P |
type | number | Model type |
PS | string | Pair Symbol. For example; BTCTRY |
H | string | Highest price in the last 24 hours(high). |
L | string | The lowest price in the last 24 hours(low). |
La | string | The price of the last transaction(last). |
V | string | Volume. |
AV | string | Average price. |
D | string | Daily change amount. |
DS | string | Denominator Symbol. For example BTCTRY TRY. |
NS | string | Numerator Symbol. For example BTCTRY for BTC. |
PID | number | Pair Id value. |
O | number | Open. Price of the first transaction of the day. |
B | string | Bid. Best buy order price. |
A | string | Ask. Best selling order price. |
BA | string | BidAmount. Best bid order amount. |
AA | string | AskAmount. Best ask order amount. |
DP | string | Daily percent. 24-hour change rate. |
Channel 422 (TradeSingle)
A message sent from the server to the client represents a single trade data of the specified pair, executed as a taker order, and is sent as it occurs.
Request Example
422 | TradeSingle | P |
type | number | Model type |
PS | number | Pair Symbol. For example; BTCTRY. |
A | string | The amount of the transaction (Amount). |
S | number | Trade Side. Shows the side of the order.
|
D | number | Transaction date (Date). UnixTime is the value in milliseconds. |
P | string | The price at which the transaction was made (Price). |
I | string | The unique number of the transaction. (Uniqueness is valid only in its own pair) |
Channel 431 (OrderBookFull)
A message sent from the server to the client. It is the entire order book model of a particular Pair.
Request Example
431 | OrderBookFull | P |
type | number | Model type |
CS | number | ChangeSet. Change number. It comes in the form of sequential values. There is no control at this time. |
PS | string | Pair Symbol value. For example; BTCTRY |
AO | Order [] | List of sales orders. The Order object contains two variables: A, amount, and transaction quantity. P is the price, the transaction price. |
BO | Order [] | List of purchase orders. |
Channel 432 (OrderBookDifference)
A message sent from the server to the client. Sends order book data of only a particular Pair's changes. The user must have previous order book data to use this model. This data is sent automatically from the server when the event is subscribed.
Changing process is:
CP: Orders are transaction type.
0: Updated
1: New added
3: Deleted
P: Order price value.
A: Orders is the quantity.
Request Example
432 | OrderBookDifference | P |
type | number | Model type |
CS | number | ChangeSet. Change number. It comes in the form of sequential values. There is no control at this time. |
PS | string | Pair Symbol value. For example; BTCTRY |
CP | number | Changing Process of pair |
AO | ChangingOrder [] | List of sales orders. The Order object contains two variables: A, amount, and transaction quantity. P is the price, the transaction price. |
BO | ChangingOrder [] | List of purchase orders. |
Private Socket Messages
Channel 114 (UserLoginResult)
A message sent from the server to the client. This is the answer to the user input model. It is exactly the same as the Result model.When a request is made with a HMAC Authentication, user login response is received from channel 114.
114 | UserLoginResult | P |
Channel 423 (UserTrade)
A message sent from the server to the client. Socket message of user/transactions/trade
endpoint. When user's order match, message is sent to the client.
423 | UserTrade | U |
---|---|---|
type | number | Model Type |
id | number | Id of the trade. |
orderId | number | Order id of the trade. |
timestamp | number | Server time of the order |
numeratorSymbol | string | Numerator Symbol. For example for BTCTRY, it is BTC |
denominatorSymbol | string | Denominator Symbol. For example for BTCTRY, it is TRY |
amount | string | Amount of the trade. |
fee | string | Fee amount of the trade. |
tax | string | Tax amount of the trade. |
price | string | Price of the trade. |
orderType | string | This field indicates if it is a buy order or a sell order. |
orderClientId | string | Client Id of the order |
preciseAmount | number | Precise amount of the trade. |
Channel 441 (UserOrderMatch)
It is the model that contains the details of this process, which is sent from the server to the user when an order of the connected user is executed.
441 | UserOrderMatch | U |
type | number | Model type |
id | number | Id value of the model being processed. |
user | number | The id of the user being processed. |
isBid | boolean | True if the transaction is buying or false if the transaction is selling. |
method | number | transaction method. 0: limit, 1: market, 2: stop limit |
pair | number | pair id value of the transaction |
symbol | string | The pair symbol value of the operation. For example; BTCTRY |
amount | string | The amount of the transaction. |
price | string | The price at which the transaction occurred. |
clientId | string | ClientId of the order |
timestamp | date | Server time of the order |
Channel 451 (OrderInsert)
A message sent from the server to the client. When a user's order is added to the system, it is the model sent to the user. Newly added orders will be sent with the model. When this model is received from the server, the user's orders can be updated from the endpoint.
451 | orderınsert | U |
type | number | Model type |
pairId | number | The pair id value of the order |
symbol | string | The pair symbol value of the order |
ID | number | Order Id value |
method | number | Type of order (0: limit, 1: market, 2: stop limit) |
userId | number | The Id value of the user who issued the order |
price | string | Price of the order |
amount | string | Amount of order |
numLeft | number | total crypto amount |
denomLeft | number | total order amount (TRY, USDT, BTC) |
newOrderClientId | string | ClientId of the order |
Channel 452 (OrderDelete)
A message sent from the server to the client. When a user's order is deleted from the system, it is the model that is sent to the user. Deleted orders with model will be sent. When this model is received from the server, the user's orders can be updated from the endpoint. The model is the same as the OrderInsert model.
452 | OrderDelete | U |
Channel 453 (OrderUpdate)
A message sent from the server to the client. This is the model sent to the user when an order of the user is updated in the system. Orders updated with the model will be sent. When this model is received from the server, the user's orders can be updated from the endpoint. The model is the same as the OrderInsert model.
453 | OrderUpdate | U |
Last updated