# Using the API, how to handle multiple orders with stops?

**URL:** <https://forums.collective2.com/t/using-the-api-how-to-handle-multiple-orders-with-stops/16744>\
**Category:** C2\
**Created:** [February 28, 2025, 8:35pm UTC](https://forums.collective2.com/t/using-the-api-how-to-handle-multiple-orders-with-stops/16744 "2025-02-28T20:35:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GarrickBradley3](https://yyz2.discourse-cdn.com/flex028/user_avatar/forums.collective2.com/garrickbradley3/32/19913_2.png) [@GarrickBradley3](https://forums.collective2.com/u/GarrickBradley3)\
**Post date:** [February 28, 2025, 8:35pm UTC](https://forums.collective2.com/t/using-the-api-how-to-handle-multiple-orders-with-stops/16744/1 "2025-02-28T20:35:32Z")

</div>

How do I submit an automated order if I have multiple orders pending?

Examples:

On 2/25 - Buy 10 IBM at market with Stop limit of 225.00  
ID = 11111111

On 2/27 - Buy 10 IBM at market with Stop limit of 230.00  
ID = 22222222

I need to sell 10 IBM, and delete the Stop order  
for ID=11111111.

If I’m using the programmer’s API, What series of orders / commands do I need to execute?

NewStrategyOrder  
CancelStrategyOrder  
ReplaceStrategyOrder

Which combination of functions do I need to execute?

Please advise

---

<div class="post-metadata">

**Author:** ![lorant\_algotrader](https://yyz2.discourse-cdn.com/flex028/user_avatar/forums.collective2.com/lorant_algotrader/32/21594_2.png) [@lorant\_algotrader](https://forums.collective2.com/u/lorant_algotrader)\
**Post date:** [March 5, 2025, 6:15pm UTC](https://forums.collective2.com/t/using-the-api-how-to-handle-multiple-orders-with-stops/16744/2 "2025-03-05T18:15:24Z")

</div>

Hello,

Here is the endpoint template that can be used to create an entry or exit order:

> [https://api-docs.collective2.com/apis/general/swagger/strategies](https://api-docs.collective2.com/apis/general/swagger/strategies)

```auto
https://api4-general.collective2.com/Strategies/NewStrategyOrder

{
  "Order": {
    "id": "<long>",
    "orderId": "<string>",
    "strategyId": "<long>",
    "strategyName": "<string>",
    "signalId": "<long>",
    "orderType": "2",
    "side": "2",
    "openClose": "C",
    "orderQuantity": "<double>",
    "limit": "<double>",
    "stop": "<double>",
    "tif": "1",
    "profitTarget": "<double>",
    "stopLoss": "<double>",
    "doNotCreateOCAGroup": null,
    "cancelReplaceSignalId": "<long>",
    "parentSignalId": "<long>",
    "doNotSyncToOpen": null,
    "c2Symbol": {
      "fullSymbol": "<string>",
      "symbolType": "<string>",
      "underlying": "<string>",
      "expiry": "<string>",
      "putOrCall": "<string>",
      "strikePrice": "<double>",
      "description": "<string>"
    },
    "exchangeSymbol": {
      "symbol": "<string>",
      "currency": "<string>",
      "securityExchange": "<string>",
      "securityType": "<string>",
      "maturityMonthYear": "<string>",
      "putOrCall": "<integer>",
      "strikePrice": "<double>",
      "priceMultiplier": "<double>"
    },
    "rejectMessage": "<string>"
  }
}

```

Since we do not support stop limit orders, I used a simple limit entry order in my sample and tried to replicate your logic (using Postman):

BUY AT MARKET: 10 IBM

```auto
https://api4-general.collective2.com/Strategies/NewStrategyOrder

{
    "Order": {
        "StrategyId": 148707328,
        "OrderType": "1",
        "Side": "1",
        "OrderQuantity": 10,
        "TIF": "0",
        "C2Symbol": {
            "FullSymbol": "IBM",
            "SymbolType": "stock"
        }
    }
}

{
    "Results": [
        {
            "SignalId": 151021037
        }
    ],
    "ResponseStatus": {
        "ErrorCode": "200"
    }
}

```

PLACE AN ENTRY LIMIT using PARENT SIGNAL ID

```auto
https://api4-general.collective2.com/Strategies/NewStrategyOrder

{
    "Order": {
        "StrategyId": 148707328,
        "OrderType": "2",
        "Side": "1",
        "OrderQuantity": 10,
        "Limit": "225.00",
        "parentSignalId": "151021037",
        "TIF": "0",
        "C2Symbol": {
            "FullSymbol": "IBM",
            "SymbolType": "stock"
        }
    }
}

{
    "Results": [
        {
            "SignalId": 151021062
        }
    ],
    "ResponseStatus": {
        "ErrorCode": "200"
    }
}

```

REPEAT THE SAME PROCESS 2 DAYS LATER (we will support ParkOrder in API v4 very soon)

```auto
https://api4-general.collective2.com/Strategies/NewStrategyOrder

{
    "Order": {
        "StrategyId": 148707328,
        "OrderType": "1",
        "Side": "1",
        "OrderQuantity": 10,
        "TIF": "0",
        "C2Symbol": {
            "FullSymbol": "IBM",
            "SymbolType": "stock"
        }
    }
}

{
    "Results": [
        {
            "SignalId": 151021166
        }
    ],
    "ResponseStatus": {
        "ErrorCode": "200"
    }
}

```

PLACE AN ENTRY LIMIT using PARENT SIGNAL ID

```auto
https://api4-general.collective2.com/Strategies/NewStrategyOrder

{
    "Order": {
        "StrategyId": 148707328,
        "OrderType": "2",
        "Side": "1",
        "OrderQuantity": 10,
        "Limit": "230.00",
        "parentSignalId": "151021166",
        "TIF": "0",
        "C2Symbol": {
            "FullSymbol": "IBM",
            "SymbolType": "stock"
        }
    }
}

{
    "Results": [
        {
            "SignalId": 151021189
        }
    ],
    "ResponseStatus": {
        "ErrorCode": "200"
    }
}

```

SELL 10 (partially close position)

```auto
https://api4-general.collective2.com/Strategies/NewStrategyOrder

{
    "Order": {
        "StrategyId": 148707328,
        "OrderType": "1",
        "Side": "2",
        "OrderQuantity": 10,
        "TIF": "0",
        "C2Symbol": {
            "FullSymbol": "IBM",
            "SymbolType": "stock"
        }
    }
}

{
    "Results": [
        {
            "SignalId": 151021217
        }
    ],
    "ResponseStatus": {
        "ErrorCode": "200"
    }
}

```

AND CANCEL THE DESIRED LIMIT (signal: 151021062)

```auto
https://api4-general.collective2.com/Strategies/CancelStrategyOrder?StrategyId=148707328&SignalId=151021062

{
    "Results": [
        {
            "SignalId": 151021062
        }
    ],
    "ResponseStatus": {
        "ErrorCode": "200"
    }
}

```

Let me know if I missed something…  
I hope this helps
