Changing IOC Message for Partially Filled Trades

Written by BTSE

July 16, 2024

Dear Traders,

We are making slight changes to some of our automated API response messages, specifically for immediate-or-cancel (IOC) trades. 

For IOC trades, they typically have to be filled immediately, or else they’re automatically canceled. On some occasions they can be only partially filled. 

In the past, when orders were only partially filled, we would send an automated message notifying traders. 

Going forward, this message will also include a note confirming that the remaining orders have been canceled. 

This change will occur on July 24 for spot trades, and July 21 for futures trades. 

To see how each API response will be changed line by line, see below – note that new changes are highlighted:

 

API Changes & Affected Paths


Spot

  1. POST /api/v3.2/order
  2. POST /api/v3.1/order
  3. POST /api/v3/order

Futures

  1. POST /api/v2.1/order
  2. POST /api/v2.2/order

Spot Response – Before

[

    {

        “status”: 5,

        “symbol”: “BTC-USD”,

        “orderType”: 76,

        “price”: 62700,

        “side”: “BUY”,

        “size”: 0.10292,

        “orderID”: “0a83170e-dcf5-443e-befd-ae4eadb841a7”,

        “timestamp”: 1721018777581,

        “triggerPrice”: 0,

        “stopPrice”: null,

        “trigger”: false,

        “message”: “”,

        “averageFillPrice”: 62700,

        “fillSize”: 0.10292,

        “clOrderID”: “_W_lobtnh1721018777525”,

        “stealth”: 1,

        “deviation”: 1,

        “postOnly”: false,

        “originalSize”: 1,

        “remainingSize”: 0.89708,

        “orderDetailType”: null,

        “time_in_force”: “IOC”

    }

]

 

Spot Response – After

[

   {

        “status”: 5,

        “symbol”: “BTC-USD”,

        “orderType”: 76,

        “price”: 62564.6,

        “side”: “BUY”,

        “size”: 0.51366,

        “orderID”: “50529261-06e7-4fa8-9d94-3fb13c5df2e2”,

        “timestamp”: 1721018965453,

        “triggerPrice”: 0,

        “stopPrice”: null,

        “trigger”: false,

        “message”: “”,

        “averageFillPrice”: 62564.6,

        “fillSize”: 0.51366,

        “clOrderID”: “_W_vuhuyi1721018965425”,

        “stealth”: 1,

        “deviation”: 1,

        “postOnly”: false,

        “originalSize”: 5,

        “remainingSize”: 4.48634,

        “orderDetailType”: null,

        “time_in_force”: “IOC”

    },

    {

        “status”: 6,

        “symbol”: “BTC-USD”,

        “orderType”: 76,

        “price”: 62564.6,

        “side”: “BUY”,

        “size”: 5,

        “orderID”: “50529261-06e7-4fa8-9d94-3fb13c5df2e2”,

        “timestamp”: 1721018965453,

        “triggerPrice”: 0,

        “stopPrice”: null,

        “trigger”: false,

        “message”: “The order was canceled because it was not fully transacted immediately.”,

        “averageFillPrice”: 62564.6,

        “fillSize”: 0.51366,

        “clOrderID”: “_W_vuhuyi1721018965425”,

        “stealth”: 1,

        “deviation”: 1,

        “postOnly”: false,

        “originalSize”: 5,

        “remainingSize”: 0,

        “orderDetailType”: null,

        “time_in_force”: “IOC”

    }

]

 

Futures Response – Before

[

    {

        “status”: 5,

        “symbol”: “BTC-PERP”,

        “orderType”: 76,

        “price”: 62525.23323442,

        “side”: “BUY”,

        “size”: 1011,

        “orderID”: “5e761e49-4998-47a5-9ed1-13222f46db0d”,

        “timestamp”: 1721018861380,

        “triggerPrice”: 0,

        “trigger”: false,

        “deviation”: 100,

        “stealth”: 100,

        “message”: “”,

        “avgFillPrice”: 62525.23323442,

        “fillSize”: 1011,

        “clOrderID”: “_W_ccvrk1721018861338”,

        “originalSize”: 100000,

        “postOnly”: false,

        “remainingSize”: 98989,

        “orderDetailType”: null,

        “positionMode”: “ONE_WAY”,

        “positionDirection”: null,

        “positionId”: “BTC-PERP-USDT”,

        “time_in_force”: “IOC”

    }

]

 

Futures Response – After

[

    {

        “status”: 5,

        “symbol”: “BTC-PERP”,

        “orderType”: 76,

        “price”: 62473.6,

        “side”: “BUY”,

        “size”: 246964,

        “orderID”: “955d6b38-4b9a-4c0b-b635-4404c4cc4af0”,

        “timestamp”: 1721019005770,

        “triggerPrice”: 0,

        “trigger”: false,

        “deviation”: 100,

        “stealth”: 100,

        “message”: “”,

        “avgFillPrice”: 62473.6,

        “fillSize”: 246964,

        “clOrderID”: “_W_qjgeq1721019005693”,

        “originalSize”: 500000,

        “postOnly”: false,

        “remainingSize”: 253036,

        “orderDetailType”: null,

        “positionMode”: “ISOLATED”,

        “positionDirection”: “LONG”,

        “positionId”: “BTC-PERP-USDT|2#10”,

        “time_in_force”: “IOC”

    },

    {

        “status”: 6,

        “symbol”: “BTC-PERP”,

        “orderType”: 76,

        “price”: 62473.6,

        “side”: “BUY”,

        “size”: 500000,

        “orderID”: “955d6b38-4b9a-4c0b-b635-4404c4cc4af0”,

        “timestamp”: 1721019005770,

        “triggerPrice”: 0,

        “trigger”: false,

        “deviation”: 100,

        “stealth”: 100,

        “message”: “The order was canceled because it was not fully transacted immediately.”,

        “avgFillPrice”: 62473.6,

        “fillSize”: 500000,

        “clOrderID”: “_W_qjgeq1721019005693”,

        “originalSize”: 500000,

        “postOnly”: false,

        “remainingSize”: 0,

        “orderDetailType”: null,

        “positionMode”: “ISOLATED”,

        “positionDirection”: “LONG”,

        “positionId”: “BTC-PERP-USDT|2#10”,

        “time_in_force”: “IOC”

    }

]

Web Socket Changes


Spot

  1. notificationApiV2

Futures

  1. notificationApiV2
  2. notificationApiV3

 

Spot notification for APIV2 – Before

{

    “topic”: “notificationApiV2”,

    “data”: {

        “symbol”: “LTC-USD”,

        “orderID”: “5512ee51-ba77-4559-8789-db74f98b7b16”,

        “side”: “MODE_BUY”,

        “type”: 76,

        “txType”: 0,

        “price”: 70.36774,

        “size”: 0.001,

        “triggerPrice”: 0,

        “pegPriceDeviation”: 1,

        “remainingSize”: 499.999,

        “originalSize”: 500,

        “stealth”: 1,

        “status”: 5,

        “timestamp”: 1721030578023,

        “avgFillPrice”: 70.36774,

        “fillSize”: 0.001,

        “clOrderID”: “_W_ogac1721030577965”,

        “maker”: false,

        “postOnly”: false,

        “orderUserInitiated”: true,

        “time_in_force”: “IOC”

    }

}

 

Spot notification for API v2 – After

{

    “topic”: “notificationApiV2”,

    “data”: {

        “symbol”: “LTC-USD”,

        “orderID”: “8ffffcb1-1c08-4233-b47b-fd6026bcbb55”,

        “side”: “MODE_BUY”,

        “type”: 76,

        “txType”: 0,

        “price”: 70.49,

        “size”: 500,

        “triggerPrice”: 0,

        “pegPriceDeviation”: 1,

        “remainingSize”: 0,

        “originalSize”: 500,

        “stealth”: 1,

        “status”: 6,

        “timestamp”: 1721030646163,

        “avgFillPrice”: 70.48310928,

        “fillSize”: 125.553,

        “clOrderID”: “_W_tpvxnpjn1721030646113”,

        “maker”: false,

        “postOnly”: false,

        “orderUserInitiated”: true,

        “time_in_force”: “IOC”

    }

}

{

    “topic”: “notificationApiV2”,

    “data”: {

        “symbol”: “LTC-USD”,

        “orderID”: “8ffffcb1-1c08-4233-b47b-fd6026bcbb55”,

        “side”: “MODE_BUY”,

        “type”: 76,

        “txType”: 0,

        “price”: 70.48310928,

        “size”: 125.553,

        “triggerPrice”: 0,

        “pegPriceDeviation”: 1,

        “remainingSize”: 374.447,

        “originalSize”: 500,

        “stealth”: 1,

        “status”: 5,

        “timestamp”: 1721030646163,

        “avgFillPrice”: 70.48310928,

        “fillSize”: 125.553,

        “clOrderID”: “_W_tpvxnpjn1721030646113”,

        “maker”: false,

        “postOnly”: false,

        “orderUserInitiated”: true,

        “time_in_force”: “IOC”

    }

}

 

Futures notification for API v2 – Before

{

    “topic”: “notificationApiV2”,

    “data”: [

        {

            “symbol”: “LTCPFC”,

            “orderID”: “407fc9c1-e0f3-4977-a4f0-d53e58d8f17d”,

            “side”: “BUY”,

            “type”: 76,

            “txType”: 0,

            “price”: 70.44,

            “size”: 2840,

            “triggerPrice”: 0,

            “pegPriceDeviation”: 1,

            “stealth”: 1,

            “status”: 5,

            “timestamp”: 1721030362920,

            “avgFillPrice”: 70.44,

            “fillSize”: 2840,

            “clOrderID”: “_W_wvypfhdv1721030362710”,

            “originalSize”: 5000,

            “postOnly”: false,

            “maker”: false,

            “remainingSize”: 2160,

            “positionId”: “LTCPFC-USD”,

            “orderDetailType”: null,

            “orderUserInitiated”: true,

            “time_in_force”: “IOC”

        }

    ]

}

 

Futures notification for API v2 – After

{

    “topic”: “notificationApiV2”,

    “data”: [

        {

            “symbol”: “LTCPFC”,

            “orderID”: “e69cd648-0985-4482-a6a6-354b28653724”,

            “side”: “BUY”,

            “type”: 76,

            “txType”: 0,

            “price”: 70.68,

            “size”: 300,

            “triggerPrice”: 0,

            “pegPriceDeviation”: 1,

            “stealth”: 1,

            “status”: 6,

            “timestamp”: 1721029306430,

            “avgFillPrice”: 70.68,

            “fillSize”: 289,

            “clOrderID”: “_W_vmwvfk1721029306387”,

            “originalSize”: 300,

            “postOnly”: false,

            “maker”: false,

            “remainingSize”: 0,

            “positionId”: “LTCPFC-USD”,

            “orderDetailType”: null,

            “orderUserInitiated”: true,

            “time_in_force”: “IOC”

        },

        {

            “symbol”: “LTCPFC”,

            “orderID”: “e69cd648-0985-4482-a6a6-354b28653724”,

            “side”: “BUY”,

            “type”: 76,

            “txType”: 0,

            “price”: 70.68,

            “size”: 289,

            “triggerPrice”: 0,

            “pegPriceDeviation”: 1,

            “stealth”: 1,

            “status”: 5,

            “timestamp”: 1721029306430,

            “avgFillPrice”: 70.68,

            “fillSize”: 289,

            “clOrderID”: “_W_vmwvfk1721029306387”,

            “originalSize”: 300,

            “postOnly”: false,

            “maker”: false,

            “remainingSize”: 11,

            “positionId”: “LTCPFC-USD”,

            “orderDetailType”: null,

            “orderUserInitiated”: true,

            “time_in_force”: “IOC”

        }

    ]

 

Futures notification for APIV3 – Before

{

    “topic”: “notificationApiV3”,

    “data”: [

        {

            “symbol”: “LTC-PERP”,

            “orderID”: “407fc9c1-e0f3-4977-a4f0-d53e58d8f17d”,

            “side”: “BUY”,

            “type”: 76,

            “txType”: 0,

            “price”: 70.44,

            “size”: 2840,

            “triggerPrice”: 0,

            “pegPriceDeviation”: 1,

            “stealth”: 1,

            “status”: 5,

            “timestamp”: 1721030362920,

            “avgFillPrice”: 70.44,

            “fillSize”: 2840,

            “clOrderID”: “_W_wvypfhdv1721030362710”,

            “originalSize”: 5000,

            “postOnly”: false,

            “maker”: false,

            “remainingSize”: 2160,

            “positionId”: “LTC-PERP-USDT”,

            “orderDetailType”: null,

            “orderUserInitiated”: true,

            “time_in_force”: “IOC”

        }

    ]

}

 

Futures notification for ApiV3- After

{

    “topic”: “notificationApiV3”,

    “data”: [

        {

            “symbol”: “LTC-PERP”,

            “orderID”: “e69cd648-0985-4482-a6a6-354b28653724”,

            “side”: “BUY”,

            “type”: 76,

            “txType”: 0,

            “price”: 70.68,

            “size”: 300,

            “triggerPrice”: 0,

            “pegPriceDeviation”: 1,

            “stealth”: 1,

            “status”: 6,

            “timestamp”: 1721029306430,

            “avgFillPrice”: 70.68,

            “fillSize”: 289,

            “clOrderID”: “_W_vmwvfk1721029306387”,

            “originalSize”: 300,

            “postOnly”: false,

            “maker”: false,

            “remainingSize”: 0,

            “positionId”: “LTC-PERP-USDT”,

            “orderDetailType”: null,

            “orderUserInitiated”: true,

            “time_in_force”: “IOC”

        },

        {

            “symbol”: “LTC-PERP”,

            “orderID”: “e69cd648-0985-4482-a6a6-354b28653724”,

            “side”: “BUY”,

            “type”: 76,

            “txType”: 0,

            “price”: 70.68,

            “size”: 289,

            “triggerPrice”: 0,

            “pegPriceDeviation”: 1,

            “stealth”: 1,

            “status”: 5,

            “timestamp”: 1721029306430,

            “avgFillPrice”: 70.68,

            “fillSize”: 289,

            “clOrderID”: “_W_vmwvfk1721029306387”,

            “originalSize”: 300,

            “postOnly”: false,

            “maker”: false,

            “remainingSize”: 11,

            “positionId”: “LTC-PERP-USDT”,

            “orderDetailType”: null,

            “orderUserInitiated”: true,

            “time_in_force”: “IOC”

        }

    ]

}

 

If you have any questions, please feel free to contact us at support@btse.com.


Our aim is to create a platform that offers users the most enjoyable trading experience. If you have any feedback, please reach out to us at support@btse.com or on X @BTSE_Official.

Note: BTSE blog content is intended solely to provide varying insights and perspectives. Unless otherwise noted, they do not represent the views of BTSE and should in no way be treated as investment advice. Markets are volatile, and trading brings rewards and risks. Trade with caution.

Related Articles

Stay Informed with BTSE

Join Our Newsletter

Never miss a beat with the latest updates and industry insights from BTSE.

Follow Us

Join our rapidly growing community and exclusive events!