Order Handling

Order Status

For order status monitoring there are 6 commands available. Generic commands and specific commands that require an order identifier.

Generic

The generic commands don't require an orderId and will work on all orders. The generic commands are;

  • IsAnyOrderOpen

  • IsAnyOrderFinished

  • CancelAllOrders

IsAnyOrderOpen

Will return true when the bot as any open order active. Can be used to skip or execute parts that depend on having an order open or not.

IsAnyOrderFinished

Will be true if the engine has received a finished order between the last and current update cycle. The order can be rejected, cancelled, partially filled or filled order. Basically everything not active on the exchange. The command can be used to skip parts of the script that handles orders of that kind.

CancelOrders

Requests to cancel all the current open orders once the script is executed.

Specific

The specific commands require an order id and will only control that specific order. The specific commands are;

  • IsOrderOpen

  • IsOrderFilled

  • CancelOrder

Example:

if not IsOrderOpen(orderId) then
    if IsOrderFilled(orderId) then
        -- Order is filled
    else
        -- Order is cancelled/rejected
    end
end

IsOrderOpen

Will return true when the order is still active on the exchange.

IsOrderFilled

Will only return true when the order is filled 100%.

CancelOrder

Requests to cancel a specific open orders once the script is executed.

OrderContainer

The command returns a collection of every order detail known. When used in the script editor, we can index properties in 2 different ways. Both will return the same value.

order = OrderContainer(orderId)
isOpen = order.isOpen
isOpen = order[4]

Order List

GetAllOpenOrders

Returns all the current open orders associated with the bot. The items in the collection are the same as the result of OrderContainer.

GetAllFinishedOrders

Returns a collection of the last 50 (partially) filled orders. The items in the collection are the same as the result of OrderContainer.

Order Amounts

GetOrderFilledAmount

Returns the amount filled when the order is not active on the exchange anymore.

GetOrderCancelledAmount

Returns the remaining amount the order is not active on the exchange anymore.

Order Timestamps

GetOrderOpenTime

When the order is still active on the exchange it will return the time-span in seconds. If the order is not active, it will return the total time it was live on the exchange.

Last updated