Orders
The Order endpoints allow your bot to enter, monitor and cancel orders directly.
When entering an order, the bot must provide a unique id. In addition, once the order is accepted by the platform, a unique id will be generated by BEM. Both ids may be used to reference the order.
[POST] placeOrder
Description
Place an order on the platform.
Parameters
(Body)
Name | Type | Description | Mandatory |
---|---|---|---|
signalProvider | string | Name of the Bot | Yes |
signalProviderKey | string | Secret key | Yes |
extId | string | Unique ID generated by bot | Yes |
exchange | string | Target exchange for the order | Yes |
baseAsset | string | Base asset of the order. Side of the order pertains to this asset | Yes |
quoteAsset | string | Quote asset of the order | Yes |
type | string | ‘limit’ or ‘stopLimit’ | Yes |
side | string | ‘buy’ or ‘sell’ - pertains to baseAsset | Yes |
limitPrice | string | Limit price of the order | Yes |
stopPrice | string | Trigger level to activate order | Yes if type = stopLimit |
qtyPct | string | Percentage of availabe asset to buy or sell | Yes |
ttlType | string | Time to Last for the order; ‘secs’ or ‘gtc’ | Yes |
ttlSecs | string | Amount of seconds for the order to last | Yes if ttlType = ‘secs’ |
responseType | string | ‘FULL’ or ‘ACK’ | Yes |
Example
curl -X POST "https://signal.revenyou.io/paper/api/signal/v2/placeOrder" -H "accept: application/xml" -H "Content-Type: application/json" -d "{ \"signalProvider\": \"MyBot\", \"signalProviderKey\": \"MyKey\", \"extId\": \"00001\", \"exchange\": \"binance\", \"baseAsset\": \"BTC\", \"quoteAsset\": \"USDT\", \"type\": \"limit\", \"side\": \"buy\", \"limitPrice\": \"45000\", \"qtyPct\": \"60\", \"ttlType\": \"gtc\", \"responseType\": \"FULL\"}"
Please note the meaning of baseAsset and quoteAsset. The baseAsset is the product that is bought or sold (depending on the side of the order), the quoteAsset is the unit of the price. So, the below order body describes an order to buy BTC with a limit price of 47000 USDT. 40% of available USDT will be used to buy BTC. The limit order will be active for 30 seconds. If not filled in this time, it will be cancelled. Selling BTC for USDT only requires the side of the order to be changed; no switching of base- and quoteAsset is required.
{
"signalProvider": "MyBot",
"signalProviderKey": "MyKey",
"extId": "MyExtId",
"exchange": "binance",
"baseAsset": "BTC",
"quoteAsset": "USDT",
"limitPrice": "47000",
"qtyPct": "40",
"side": "buy",
"ttlType": "secs",
"ttlSecs": "30",
"type": "limit",
"responseType": "ACK"
}
Response
Name | Type | Description | Mandatory |
---|---|---|---|
succes | string | ‘true’ or ‘false’ | Yes |
orderId | string | BEM generated order id | Yes if succes = Yes |
status | string | acceptedByBEM / acceptedByExch / partiallyExecuted / rejectedByBEM / rejectedByExch / partiallyExecutedAndCanceled / fullyCanceled / fulfilled | Yes |
isBeingCanceled | string | Yes or No | Yes |
rejReason | string | No |
[POST] cancelOrder
Description
Cancel an order managed by the bot
Parameters
(Body)
Name | Type | Description | Mandatory |
---|---|---|---|
signalProvider | string | Name of the Bot | Yes |
signalProviderKey | string | Secret key | Yes |
orderId | string | Unique ID generated by BEM | Yes* (or extId) |
extId | string | Unique ID generated by the bot | Yes* (or orderId) |
Example
curl -X POST "https://signal.revenyou.io/paper/api/signal/v2/cancelOrder" -H "accept: application/xml" -H "Content-Type: application/json" -d "{ \"signalProvider\": \"MyBot\", \"signalProviderKey\": \"MyKey\", \"orderID\": \"Bem_Generated-ID\"}"
Response
Name | Type | Description | Mandatory |
---|---|---|---|
succes | string | ‘true’ or ‘false’ | Yes |
[GET] getOrderState
Description
Retreive the current state of an order
Parameters
(Query)
Name | Type | Description | Mandatory |
---|---|---|---|
signalProvider | string | Name of the Bot | Yes |
signalProviderKey | string | Secret key | Yes |
orderId | string | Unique ID generated by BEM | Yes* (or extId) |
extId | string | Unique ID generated by the bot | Yes* (or orderId) |
Example
curl -X GET "https://signal.revenyou.io/paper/api/signal/v2/getOrderState?signalProvider=MyBot&signalProviderKey=MyKey&extId=0001" -H "accept: application/xml"
Response
Name | Type | Description | Mandatory |
---|---|---|---|
succes | string | ‘true’ or ‘false’ | Yes |
orderId | string | BEM generated order id | Yes |
status | string | acceptedByBEM / acceptedByExch / partiallyExecuted / rejectedByBEM / rejectedByExch / partiallyExecutedAndCanceled / fullyCanceled / fulfilled | Yes |
isBeingCanceled | string | ‘yes’ or ‘no’ | Yes |
rejReason | string | No |
[GET] getOrderInfo
Description
Request complete info on a specific order
Parameters
(Query)
Name | Type | Description | Mandatory |
---|---|---|---|
signalProvider | string | Name of the Bot | Yes |
signalProviderKey | string | Secret key | Yes |
orderId | string | Unique ID generated by BEM | Yes* (or extId) |
extId | string | Unique ID generated by the bot | Yes* (or orderId) |
Example
curl -X GET "https://signal.revenyou.io/paper/api/signal/v2/getOrderInfo?signalProvider=MyBot&signalProviderKey=MyKey&orderId=BEM-generated-OrdeId" -H "accept: application/xml"
Response
Name | Type | Description | Mandatory |
---|---|---|---|
succes | string | ‘true’ or ‘false’ | Yes |
orderId | string | BEM generated order id | Yes |
signaleId | string | Signal this order belongs to | If part of signal |
extId | string | Unique ID generated by the bot | Yes |
signalProvider | string | Name of the Bot | Yes |
exchange | string | Target exchange for the order | Yes |
baseAsset | string | Base asset of the order | Yes |
quoteAsset | string | Quote asset of the order | Yes |
type | string | ‘limit’ or ‘stopLimit’ | Yes |
side | string | ‘buy’ or ‘sell’ - pertains to baseAsset | Yes |
limitPrice | string | Limit price of the order | Yes |
stopPrice | string | Trigger level to activate order | Yes if type = stopLimit |
qtyPct | string | Percentage of availabe asset to buy or sell | Yes |
ttlType | string | Time to Last for the order; ‘secs’ or ‘gtc’ | Yes |
ttlSecs | string | Amount of seconds for the order to last | Yes if ttlType = ‘secs’ |
status | string | acceptedByBEM / acceptedByExch / partiallyExecuted / rejectedByBEM / rejectedByExch / partiallyExecutedAndCanceled / fullyCanceled / fulfilled | Yes |
isBeingCanceled | string | ‘yes’ or ‘no’ | Yes |
qtyExecPct | string | qtyExecAbs / (qtyPct * available asset) | Yes |
creationTs | string | Time the order was created | Yes |
lastChangeTs | string | Time the order was last modified | Yes |
rejReason | string | No | |
trades | [Trade objects] | If the order has executions, they are shown here | No |
Trade Object
Name | Type | Description | Mandatory |
---|---|---|---|
id | string | Trade ID | Yes |
creationTs | string | Trade creation time | Yes |
price | string | Trade price | Yes |
[GET] getOrders
Description
Request complete list of orders from a bot
Parameters
(Query)
Name | Type | Description | Mandatory |
---|---|---|---|
signalProvider | string | Name of the Bot | Yes |
signalProviderKey | string | Secret key | Yes |
Example
curl -X GET "https://signal.revenyou.io/paper/api/signal/v2/getOrders?signalProvider=MyBot&signalProviderKey=MyKey" -H "accept: application/xml"
Response
Name | Type | Description | Mandatory |
---|---|---|---|
succes | string | ‘true’ or ‘false’ | Yes |
orders | [Order Info objects] | See getOrderInfo response | Yes |