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://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
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
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)
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
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)
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)
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