API to automate your trading
API to automate your trading
curl -i -X GET \ 'https://api4-general.collective2.com/Autotrade/GetAutotradedStrategies?PersonId=0' \ -H 'Authorization: Bearer <YOUR_Bearer myAPIkey_HERE>'
{ "results": [ { "id": 0, "personId": 0, "account": "string", "scalingPercentage": 0.1, "strategyId": 0, "strategyName": "string", "brokerId": 0, "brokerName": "string", "startDate": "2019-08-24T14:15:22Z", "lastModified": "2019-08-24T14:15:22Z" } ], "pagination": { "prev_cursor": "string", "next_cursor": "string" }, "responseStatus": { "errorCode": "string", "message": "string", "errors": [ { … } ] } }
curl -i -X GET \ https://api4-general.collective2.com/Autotrade/GetAutotraders \ -H 'Authorization: Bearer <YOUR_Bearer myAPIkey_HERE>'
{ "results": [ { "id": 0, "personId": 0, "account": "string", "scalingPercentage": 0.1, "strategyId": 0, "strategyName": "string", "brokerId": 0, "brokerName": "string", "startDate": "2019-08-24T14:15:22Z", "lastModified": "2019-08-24T14:15:22Z" } ], "pagination": { "prev_cursor": "string", "next_cursor": "string" }, "responseStatus": { "errorCode": "string", "message": "string", "errors": [ { … } ] } }
curl -i -X GET \ 'https://api4-general.collective2.com/Autotrade/GetAutotradeSettings?PersonId=0' \ -H 'Authorization: Bearer <YOUR_Bearer myAPIkey_HERE>'
{ "results": [ { "id": 0, "personId": 0, "firstName": "string", "lastName": "string", "email": "string", "country": "string", "state": "string", "language": "string", "siteDomain": "string", "brokerId": 0, "connection": "string", "introducingBrokerId": 0, "introducingBroker": "string", "strategyId": 0, "strategyName": "string", "account": "string", "accountType": 0, "brokerUserID": "string", "currency": "string", "salesRepId": 0, "salesRep": "string", "isTradeLeader": true, "isManualDiscardedPosition": true, "isConfirmationNeeded": true, "isSyncEnabled": true, "isBrokerEnabled": true, "isAutotradeDisabled": true, "isAutotradeDisabledReason": "string", "syncDisabledReason": "string", "firstBrokerActivationDate": "2019-08-24T14:15:22Z", "netLiquidationValue": 0.1, "netLiquidationValueDate": "2019-08-24T14:15:22Z", "virtualLimitOrdersEnabled": true, "scalingPercentage": 0.1, "settingsLastUpdateUTC": "2019-08-24T14:15:22Z", "enabledFutures": true, "futuresLong": true, "futuresShort": true, "minFutures": 0, "maxFutures": 0, "enabledForex": true, "forexEnabledLong": true, "forexEnabledShort": true, "forexLotSize": 0, "minForex": 0, "maxForex": 0, "enabledStocks": true, "stocksLong": true, "stocksShort": true, "maxStocksDollars": 0, "tradeStocksAsCFD": true, "enabledOptions": true, "optionsLong": true, "optionsShort": true, "minOptions": 0, "maxOptions": 0 } ], "responseStatus": { "errorCode": "string", "message": "string", "errors": [ { … } ] } }
Set to TRUE if you want to enable the account for Autotrade. The StartAutotrade endpoint will automatically enable this setting. It may be disabled if your account is delinked by the broker, or if we detect rare unexpected activity in your account such as a margin call, pattern day trader, account becomes restricted by the broker, etc.
curl -i -X PUT \ https://api4-general.collective2.com/Autotrade/SetAutotradeSettings \ -H 'Authorization: Bearer <YOUR_Bearer myAPIkey_HERE>' \ -H 'Content-Type: application/json' \ -d '{ "Account": "string", "PersonId": 0, "BrokerId": 0 }'
{ "results": [ true ], "responseStatus": { "errorCode": "string", "message": "string", "errors": [ { … } ] } }
curl -i -X GET \ 'https://api4-general.collective2.com/Autotrade/GetDashBoard?Account=string&PersonId=0' \ -H 'Authorization: Bearer <YOUR_Bearer myAPIkey_HERE>'
{ "results": [ { "personId": 0, "brokerName": "string", "account": "string", "strategyId": 0, "strategyName": "string", "startDate": "2019-08-24T14:15:22Z", "todayReturn": 0.1, "totalReturn": 0.1 } ], "responseStatus": { "errorCode": "string", "message": "string", "errors": [ { … } ] } }
curl -i -X GET \ https://api4-general.collective2.com/Autotrade/SearchAccounts \ -H 'Authorization: Bearer <YOUR_Bearer myAPIkey_HERE>'
{ "results": [ { "id": 0, "personId": 0, "account": "string", "brokerName": "string", "brokerId": 0, "firstName": "string", "lastName": "string", "email": "string", "language": "string", "whiteLabelSiteId": 0, "geoSite": "string", "countryCode": "string", "divisionCode": "string", "authenticatedDate": "2019-08-24T14:15:22Z" } ], "pagination": { "prev_cursor": "string", "next_cursor": "string" }, "responseStatus": { "errorCode": "string", "message": "string", "errors": [ { … } ] } }
curl -i -X GET \ 'https://api4-general.collective2.com/Autotrade/GetAutotradeActiveOrders?Account=string&PersonId=0' \ -H 'Authorization: Bearer <YOUR_Bearer myAPIkey_HERE>'
{ "results": [ { "id": 0, "orderId": "string", "strategyId": 0, "strategyName": "string", "signalId": 0, "orderType": "1", "side": "1", "openClose": "O", "orderQuantity": 0.1, "limit": 0.1, "stop": 0.1, "tif": "0", "profitTarget": 0.1, "stopLoss": 0.1, "doNotCreateOCAGroup": null, "cancelReplaceSignalId": 0, "parentSignalId": 0, "doNotSyncToOpen": null, "c2Symbol": { … }, "exchangeSymbol": { … }, "rejectMessage": "string", "brokerId": 0, "orderStatus": "string", "filledQuantity": 0.1, "avgFillPrice": 0.1, "postedDate": "2019-08-24T14:15:22Z", "signalType": 0, "info": "string" } ], "responseStatus": { "errorCode": "string", "message": "string", "errors": [ { … } ] } }
'A' = PendingNew, '0' = Working, '1' = Partially filled, '2' = Filled, '4' = Canceled, '5' = Replaced, '6' = Pending Cancel, '8' = Rejected, 'C' = Expired, 'E' = Pending Replace (Optional)
Result size limit. We will enforce a max size limit for all endpoints. Default is 1000
curl -i -X GET \ 'https://api4-general.collective2.com/Autotrade/GetAutotradeHistoricalOrders?Account=string&PersonId=0' \ -H 'Authorization: Bearer <YOUR_Bearer myAPIkey_HERE>'
{ "results": [ { "id": 0, "orderId": "string", "strategyId": 0, "strategyName": "string", "signalId": 0, "orderType": "1", "side": "1", "openClose": "O", "orderQuantity": 0.1, "limit": 0.1, "stop": 0.1, "tif": "0", "profitTarget": 0.1, "stopLoss": 0.1, "doNotCreateOCAGroup": null, "cancelReplaceSignalId": 0, "parentSignalId": 0, "doNotSyncToOpen": null, "c2Symbol": { … }, "exchangeSymbol": { … }, "rejectMessage": "string", "brokerId": 0, "orderStatus": "string", "filledQuantity": 0.1, "avgFillPrice": 0.1, "postedDate": "2019-08-24T14:15:22Z", "signalType": 0, "info": "string" } ], "pagination": { "prev_cursor": "string", "next_cursor": "string" }, "responseStatus": { "errorCode": "string", "message": "string", "errors": [ { … } ] } }
curl -i -X GET \ 'https://api4-general.collective2.com/Autotrade/GetAutoTradeOpenPositions?Account=string' \ -H 'Authorization: Bearer <YOUR_Bearer myAPIkey_HERE>'
{ "results": [ { "quantity": 0.1, "c2Symbol": { … }, "exchangeSymbol": { … }, "strategyId": 0, "strategyName": "string", "currency": "string", "openedDate": "2019-08-24T14:15:22Z", "avgPx": 0.1 } ], "responseStatus": { "errorCode": "string", "message": "string", "errors": [ { … } ] } }
The OrderId. Only required in NewAutotradeOrder and ReplaceAutotradeOrder endpoints
'1' = Market, '2' = Limit, '3' = Stop
Enum Value | Description |
---|---|
1 | Market |
2 | Limit |
3 | Stop |
Only required in ReplaceAutotradeOrder endpoint. 'O' = Open, 'C' = Close
Enum Value | Description |
---|---|
O | Open |
C | Close |
The time in force. 0 = Day, 1 = Good Till Cancel (GTC)
Enum Value | Description |
---|---|
0 | Day |
1 | GTC |
Only available in NewStrategyOrder endpoint. The C2-formatted Price at which to place a exit conditional order
Only available in NewStrategyOrder endpoint. The C2-formatted Price at which to place a exit conditional order
Only available in NewStrategyOrder endpoint. Default is false. Used to indicate the ProfitTarget and StopLoss orders should not be added to a OCA group. Each exit order will be managed separately
Used to specify that this order is conditional (a child) on another
Used to indicate this order should not be synched in the brokerage account. Only applies to Opening non-market orders
curl -i -X POST \ https://api4-general.collective2.com/Autotrade/NewAutotradeOrder \ -H 'Authorization: Bearer <YOUR_Bearer myAPIkey_HERE>' \ -H 'Content-Type: application/json' \ -d '{ "Account": "string", "PersonId": 0, "Order": {} }'
{ "results": [ { "signalId": 0, "profitTargetSignalId": 0, "stopLossSignalId": 0, "exitSignalsOCAGroupId": 0 } ], "responseStatus": { "errorCode": "string", "message": "string", "errors": [ { … } ] } }
curl -i -X DELETE \ 'https://api4-general.collective2.com/Autotrade/CancelAutotradeOrder?Account=string&OrderId=string&PersonId=0' \ -H 'Authorization: Bearer <YOUR_Bearer myAPIkey_HERE>'
{ "results": [ { "signalId": 0, "profitTargetSignalId": 0, "stopLossSignalId": 0, "exitSignalsOCAGroupId": 0 } ], "responseStatus": { "errorCode": "string", "message": "string", "errors": [ { … } ] } }
curl -i -X PUT \ https://api4-general.collective2.com/Autotrade/ReplaceAutotradeOrder \ -H 'Authorization: Bearer <YOUR_Bearer myAPIkey_HERE>' \ -H 'Content-Type: application/json' \ -d '{ "Account": "string", "PersonId": 0, "OrderId": "string", "Price": 0.1 }'
{ "results": [ { "signalId": 0, "profitTargetSignalId": 0, "stopLossSignalId": 0, "exitSignalsOCAGroupId": 0 } ], "responseStatus": { "errorCode": "string", "message": "string", "errors": [ { … } ] } }
curl -i -X GET \ https://api4-general.collective2.com/Autotrade/GetBrokers \ -H 'Authorization: Bearer <YOUR_Bearer myAPIkey_HERE>'
{ "results": [ { "id": 0, "name": "string", "isEnabled": true, "connectionName": "string" } ], "responseStatus": { "errorCode": "string", "message": "string", "errors": [ { … } ] } }
(optional) TRUE to enable the Futures asset class when autotrading this strategy. Default is FALSE
(optional) Set a maximum number of contracts to hold in a position for this strategy
(optional) Set a maximum number of units (each unit on C2 is 10000 currency units) to hold in a position for this strategy
(optional) TRUE to enable autotrading Stocks for this strategy. Default is FALSE
(optional) Set a maximum number of dollars to hold in a position for this strategy (no decimals)
(optional) TRUE to enable autotrading Options for this strategy. Default is FALSE
(optional) TRUE to enable the shorting of Options when autotrading this strategy. Default is FALSE
(optional) Set a maximum number of contracts to hold in a position for this strategy
(optional) TRUE to prevent joining currently open positions in the strategy. Only applies to new Autotrade setups: this setting must not be set when modifing an existing Autotrade setup.
(optional) Dollar value of the automated stop loss which will rest in addition to the strategy stop loss orders
(optional) The Brokerage account username. Only needed for specific Brokers, please enquire with support at help@collective2.com
curl -i -X POST \ https://api4-general.collective2.com/Autotrade/StartAutotrade \ -H 'Authorization: Bearer <YOUR_Bearer myAPIkey_HERE>' \ -H 'Content-Type: application/json' \ -d '{ "Account": "string", "PersonId": 0, "BrokerId": 0, "StrategyId": 0, "ScalingPercentage": 0 }'
curl -i -X GET \ https://api4-general.collective2.com/Autotrade/GetSimResults \ -H 'Authorization: Bearer <YOUR_Bearer myAPIkey_HERE>'
{ "results": [ { "personId": 0, "firstName": "string", "lastName": "string", "email": "string", "account": "string", "strategyId": 0, "strategyName": "string", "startDate": "2019-08-24T14:15:22Z", "endDate": "2019-08-24T14:15:22Z", "startEquity": 0, "endEquity": 0, "totalReturn": 0.1, "totalDelta": 0.1, "scalingFactor": 0 } ], "responseStatus": { "errorCode": "string", "message": "string", "errors": [ { … } ] } }
curl -i -X PUT \ https://api4-general.collective2.com/Autotrade/ResetPaperTrade \ -H 'Authorization: Bearer <YOUR_Bearer myAPIkey_HERE>' \ -H 'Content-Type: application/json' \ -d '{ "Account": "string", "PersonId": 0 }'
{ "results": [ true ], "responseStatus": { "errorCode": "string", "message": "string", "errors": [ { … } ] } }
curl -i -X POST \ https://api4-general.collective2.com/General/Hello \ -H 'Authorization: Bearer <YOUR_Bearer myAPIkey_HERE>' \ -H 'Content-Type: application/json' \ -d '{ "Name": "string" }'
{ "results": [ "string" ], "responseStatus": { "errorCode": "string", "message": "string", "errors": [ { … } ] } }