The market maker needs to implement following 5 Tokenlon-MMSK interfaces:
- The pairs interface asks market maker for authorized trading currency pairs
- The indicativePrice interface asks market maker to provide a reference price for a specific trading currency pair
- The price interface asks the market maker quoting prices for a specific trading amount
- The deal interface: Once the quote confirmed by the users, the Tokenlon Server will push an order to the MMSK, and MMSK then notifies the market maker via the deal interface
- The exception interface: Once the order has some exception situation, the Tokenlon Server will push an exception order to the MMSK, and MMSK then notifies the market maker via the exception interface
Request
curl 'HTTP_SERVER_ENDPOINT/pairs'
Response
// Returned in normal conditions
{
"result": true,
"pairs": [
"SNT/ETH",
"OMG/ETH",
"DAI/ETH"
]
}
// Returned in other circumstances
{
"result": false,
"message": "Exception"
}
Request address: HTTP_SERVER_ENDPOINT/pairs
pairs
array item represents a trading pair, such as "SNT/ETH"
Market makers need to support { base: 'SNT', quote: 'ETH' }
and { base: 'ETH', quote: 'SNT' }
.
GET
none
Name | Type | Description |
---|---|---|
result | Boolean | whether normal return |
pairs | Array | pair string array |
Name | Type | Description |
---|---|---|
result | Boolean | whether normal return |
message | String | possible error information |
Request
curl 'HTTP_SERVER_ENDPOINT/indicativePrice?base=SNT"e=OMG&amount=30&side=BUY'
Response
// Returned in normal conditions
{
"result": true,
"exchangeable": true,
"price": 0.00017508,
"minAmount": 0.0002,
"maxAmount": 100
}
// Returned in other circumstances
{
"result": false,
"exchangeable": false,
"minAmount": 0.0002,
"maxAmount": 100,
"message": "insufficient balance"
}
Request URL: HTTP_SERVER_ENDPOINT/indicativePrice
amount
can be 0
or undefined
The primary use for this is the initial price, that is displayed when the user hasn’t yet entered a quantity into the exchange frontend, and at that time, the Indicative Price need is expected to response an price without amount. After the user entered an amount
into the frontend,if that amount is valid(can accept this amount's trade) the Indicative Price is expected to be close to Quotes/Deal Price
GET
Name | Type | Mandatory | Description |
---|---|---|---|
base | String | YES | base symbol |
quote | String | YES | quote symbol |
side | String | YES | 'BUY' or 'SELL' |
amount | Number | NO | BUY or SELL base amount |
Name | Type | Description |
---|---|---|
result | Boolean | whether normal return |
exchangeable | Boolean | Whether is tradable |
minAmount | Number | The minimum amount that base token can be traded |
maxAmount | Number | The maximum amount that base token can be traded |
price | Number |
Name | Type | Description |
---|---|---|
result | Boolean | whether normal return |
exchangeable | Boolean | Whether is tradable |
minAmount | Number | The minimum amount that base token can be traded |
maxAmount | Number | The maximum amount that base token can be traded |
message | String | possible error information |
Request
curl 'HTTP_SERVER_ENDPOINT/price?base=SNT"e=OMG&amount=30&side=BUY&uniqId=dfdsfjsidf'
Response
// Returned in normal conditions
{
"result": true,
"exchangeable": true,
"price": 0.00017508,
"minAmount": 0.0002,
"maxAmount": 100,
"quoteId": "asfadsf-dsfsdf-ggsd-qwe-rgjty"
}
// Returned in other circumstances
{
"result": false,
"exchangeable": false,
"minAmount": 0.0002,
"maxAmount": 100,
"message": "insufficient balance"
}
Request URL: HTTP_SERVER_ENDPOINT/price
uniqId
(uniqId: pujft40a
、uniqId: pujft40a-1
、uniqId: pujft40a-2
are treated as the same uniqId
) of the user. The market maker needs to return the quoteId to track orders’ life-cycle. If the order corresponding to the quoteId
exceeds 30s and the deal
interface does not receive the order confirmed notification corresponding to the quoteId
, the quotes corresponding to the quoteId
is considered invalid and the position locks can be removed.
GET
Name | Type | Mandatory | Description |
---|---|---|---|
base | String | YES | base symbol |
quote | String | YES | quote symbol |
side | String | YES | 'BUY' or 'SELL' |
amount | Number | YES | BUY or SELL base amount |
uniqId | String | YES | Identifies each unique user |
Name | Type | Description |
---|---|---|
result | Boolean | whether normal return |
exchangeable | Boolean | Whether is tradable |
minAmount | Number | The minimum amount that base token can be traded |
maxAmount | Number | The maximum amount that base token can be traded |
price | Number | |
quoteId | String | A unique value used to track the final order of the quotation and the transaction status. |
Name | Type | Description |
---|---|---|
result | Boolean | whether normal return |
exchangeable | Boolean | Whether is tradable |
minAmount | Number | The minimum amount that base token can be traded |
maxAmount | Number | The maximum amount that base token can be traded |
message | String | possible error information |
Request
curl -X POST \
HTTP_SERVER_ENDPOINT/deal \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d '{"makerToken": "SNT","takerToken":"OMG","makerTokenAmount":30,"takerTokenAmount":0.1,"quoteId":"234dsfasd-sdfasdf-sdfasf","timestamp":1231234324}'
Response
{
"result": true
}
Request address: HTTP_SERVER_ENDPOINT/deal
POST
Name | Type | Mandatory | Description |
---|---|---|---|
makerToken | String | YES | token symbol |
takerToken | String | YES | token symbol |
makerTokenAmount | Number | YES | maker token's amount |
takerTokenAmount | Number | YES | taker token's amount |
quoteId | String | YES | quoteId from price interface |
timestamp | Number | YES |
Name | Type | Description |
---|---|---|
result | Boolean | We suggest you just return true . If you return false , Tokenlon will always retry to send this notification to you, and it maybe repeat your hedge. |
Request
curl -X POST \
HTTP_SERVER_ENDPOINT/exception \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d '{"makerToken": "SNT","takerToken":"OMG","makerTokenAmount":30,"takerTokenAmount":0.1,"quoteId":"234dsfasd-sdfasdf-sdfasf","timestamp":1231234324,"type":"FAILED"}'
Response
{
"result": true
}
Name | Type | Mandatory | Description |
---|---|---|---|
makerToken | String | YES | token symbol |
takerToken | String | YES | token symbol |
makerTokenAmount | Number | YES | maker token's amount |
takerTokenAmount | Number | YES | taker token's amount |
quoteId | String | YES | quoteId from price interface |
type | String | YES | 'FAILED' means that order failed; 'TIMEOUT' means that order timeout(also failed too);'DELAY' means that order is executed but Tokenlon didn't notify MM by deal API |
timestamp | Number | YES |
Name | Type | Description |
---|---|---|
result | Boolean | We suggest you just return true . If you return false , Tokenlon will always retry to send this notification to you, and it maybe repeat your processing. |