Cancel All Orders

Cancel every open order for a pseudo account in a single call, from any client language.

POST https://apix.stocksdeveloper.in/trading/cancelAllOrders
WriteReturns true on success7 languagesBroker independent
In short

The Cancel All Orders call cancels every open order for a given pseudo account in one call. A common use is to clear all pending orders before you start an intraday square-off. It is available in HTTP REST, Python, Java, C#, Excel, AmiBroker, and MetaTrader, and it returns true on success.

This call cancels all open orders for the given pseudo account. It is available in HTTP REST, Python, Java, C#, Excel, AmiBroker, and MetaTrader.

For related calls, see Cancel Order and Cancel Child Orders.

Code samples

Samples

HTTP

Example

curl https://apix.stocksdeveloper.in/trading/cancelAllOrders \
   -H "api-key: <your-api-key>" \
   -d "pseudoAccount=ACC_NAME"

Response

{
    "result":true,
    "error":null,
    "message":null,
    "status":true,
    "commandId":"6d4b5124-c1aa-4623-b0c5-8df779e0f44d"
}

Python

Signature

def cancel_all_orders(self, pseudo_account):

Example

response = autotrader.cancel_all_orders('XX1234')

if response.success():
    print("Result: {0}".format(response.result))
else:
    print("Message: {0}".format(response.message))

Java

Signature

/**
 * Cancels all open orders for the given account. For more information, please
 * see
 * <a href="https://stocksdeveloper.in/documentation/api/cancel-all-orders/">api
 * docs</a>.
 *
 * @param pseudoAccount pseudo account
 * @return <code>true</code> on success, <code>false</code> otherwise
 */
IOperationResponse<Boolean> 
	cancelAllOrders(String pseudoAccount);

Example

// Cancel all open orders for the given pseudo account
autotrader.cancelAllOrders("ACC_NAME");

C#

Signature

/// <summary>
/// Cancels all open orders for the given account. For more information, please
/// see
/// <a href="https://stocksdeveloper.in/documentation/api/cancel-all-orders/">api
/// docs</a>.
/// </summary>
/// <param name="pseudoAccount"> pseudo account </param>
/// <returns> <code>true</code> on success, <code>false</code> otherwise </returns>
IOperationResponse<bool?> 
	CancelAllOrders(string pseudoAccount);

Example

// Cancel all open orders for the given pseudo account
IOperationResponse<bool?> response = 
    autoTrader.CancelAllOrders("XX1234");

Excel

Signature

Public Function CancelAllOrders(PseudoAccount As String) As Boolean

Example

CancelAllOrders("ACC_NAME")

AmiBroker

Signature

function cancelAllOrders(account)

Example

/* Cancel all open orders for the given pseudo account */
cancelAllOrders("XX1234");

MetaTrader

Signature

/*
* Cancels all open orders for the given account. Returns true on success.
*/
bool cancelAllOrders(string account)

Example

// cancelAllOrders("XX1234");

cancelAllOrders(AT_ACCOUNT);

Postman

Postman is a widely used tool for API testing. We provide a collection of all our APIs in Postman collection format. See the Postman collection guide to learn how to use it.

Parameters

ParameterDescription
accountnickname of the broker account (also known as pseudo account)

Return value

DirectJava · C# · Python · HTTP

The call returns the order id given by your trading platform.

BridgeExcel · AmiBroker · MetaTrader

The call returns the library order id. The Desktop Client passes the request on to your broker.

Notes

To cancel a single order, see Cancel Order. To exit a bracket or cover order, see Cancel Child Orders. To flatten an entire portfolio, see Square Off Portfolio.

Was this page helpful?

Last updated 21 June 2026