# Trades (Spot)

## Place order

{% hint style="info" %}
Please refer to the official BingX API Docs for the Required parameters.

<https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Place+order>
{% endhint %}

#### Function Name:

```javascript
placeOrderSpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myBingxExchange  = createExchange({
      exchange: "bingx",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "bingx"
  });

async function placeOrderSpot(exchange, options) {
    try {
        let result = await exchange.placeOrderSpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await placeOrderSpot(myBingxExchange, {
	symbol: "<string>",
	side: "<string>",
	type: "<string>"
});
```

## Place multiple orders

{% hint style="info" %}
Please refer to the official BingX API Docs for the Required parameters.

<https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Place+multiple+orders>
{% endhint %}

#### Function Name:

```javascript
placeBatchOrderSpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myBingxExchange  = createExchange({
      exchange: "bingx",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "bingx"
  });

async function placeBatchOrderSpot(exchange, options) {
    try {
        let result = await exchange.placeBatchOrderSpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await placeBatchOrderSpot(myBingxExchange);
```

## Cancel Order

{% hint style="info" %}
Please refer to the official BingX API Docs for the Required parameters.

<https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel+Order>
{% endhint %}

#### Function Name:

```javascript
cancelOrderSpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myBingxExchange  = createExchange({
      exchange: "bingx",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "bingx"
  });

async function cancelOrderSpot(exchange, options) {
    try {
        let result = await exchange.cancelOrderSpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await cancelOrderSpot(myBingxExchange, {
	symbol: "<string>"
});
```

## Cancel multiple orders

{% hint style="info" %}
Please refer to the official BingX API Docs for the Required parameters.

<https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel+multiple+orders>
{% endhint %}

#### Function Name:

```javascript
batchCancelOrderSpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myBingxExchange  = createExchange({
      exchange: "bingx",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "bingx"
  });

async function batchCancelOrderSpot(exchange, options) {
    try {
        let result = await exchange.batchCancelOrderSpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await batchCancelOrderSpot(myBingxExchange, {
	symbol: "<string>",
	orderIds: "<string>"
});
```

## Cancel all Open Orders on a Symbol

{% hint style="info" %}
Please refer to the official BingX API Docs for the Required parameters.

<https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel+all+Open+Orders+on+a+Symbol>
{% endhint %}

#### Function Name:

```javascript
cancelAllSymbolOrdersSpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myBingxExchange  = createExchange({
      exchange: "bingx",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "bingx"
  });

async function cancelAllSymbolOrdersSpot(exchange, options) {
    try {
        let result = await exchange.cancelAllSymbolOrdersSpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await cancelAllSymbolOrdersSpot(myBingxExchange);
```

## Cancel an Existing Order and Send a New Orde

{% hint style="info" %}
Please refer to the official BingX API Docs for the Required parameters.

<https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel+an+Existing+Order+and+Send+a+New+Orde>
{% endhint %}

#### Function Name:

```javascript
cancelOrderAndPlaceOrderSpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myBingxExchange  = createExchange({
      exchange: "bingx",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "bingx"
  });

async function cancelOrderAndPlaceOrderSpot(exchange, options) {
    try {
        let result = await exchange.cancelOrderAndPlaceOrderSpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await cancelOrderAndPlaceOrderSpot(myBingxExchange, {
	symbol: "<string>",
	CancelReplaceMode: "<string>",
	side: "<string>",
	type: "<string>",
	stopPrice: "<string>"
});
```

## Query Order details

{% hint style="info" %}
Please refer to the official BingX API Docs for the Required parameters.

<https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query+Order+details>
{% endhint %}

#### Function Name:

```javascript
getOrderDetailsSpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myBingxExchange  = createExchange({
      exchange: "bingx",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "bingx"
  });

async function getOrderDetailsSpot(exchange, options) {
    try {
        let result = await exchange.getOrderDetailsSpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getOrderDetailsSpot(myBingxExchange, {
	symbol: "<string>"
});
```

## Current Open Orders

{% hint style="info" %}
Please refer to the official BingX API Docs for the Required parameters.

<https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Current+Open+Orders>
{% endhint %}

#### Function Name:

```javascript
getOpenOrdersSpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myBingxExchange  = createExchange({
      exchange: "bingx",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "bingx"
  });

async function getOpenOrdersSpot(exchange, options) {
    try {
        let result = await exchange.getOpenOrdersSpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getOpenOrdersSpot(myBingxExchange);
```

## Query Order history

{% hint style="info" %}
Please refer to the official BingX API Docs for the Required parameters.

<https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query+Order+history>
{% endhint %}

#### Function Name:

```javascript
getOrderHistorySpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myBingxExchange  = createExchange({
      exchange: "bingx",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "bingx"
  });

async function getOrderHistorySpot(exchange, options) {
    try {
        let result = await exchange.getOrderHistorySpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getOrderHistorySpot(myBingxExchange);
```

## Query transaction details

{% hint style="info" %}
Please refer to the official BingX API Docs for the Required parameters.

<https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query+transaction+details>
{% endhint %}

#### Function Name:

```javascript
getTransactionDetailsSpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myBingxExchange  = createExchange({
      exchange: "bingx",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "bingx"
  });

async function getTransactionDetailsSpot(exchange, options) {
    try {
        let result = await exchange.getTransactionDetailsSpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getTransactionDetailsSpot(myBingxExchange, {
	orderId: "<long>"
});
```

## Query Trading Commission Rate

{% hint style="info" %}
Please refer to the official BingX API Docs for the Required parameters.

<https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query+Trading+Commission+Rate>
{% endhint %}

#### Function Name:

```javascript
getTradingCommissionRateSpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myBingxExchange  = createExchange({
      exchange: "bingx",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "bingx"
  });

async function getTradingCommissionRateSpot(exchange, options) {
    try {
        let result = await exchange.getTradingCommissionRateSpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getTradingCommissionRateSpot(myBingxExchange);
```

## Cancel All After

{% hint style="info" %}
Please refer to the official BingX API Docs for the Required parameters.

<https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel+All+After>
{% endhint %}

#### Function Name:

```javascript
cancelAllAfterSpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myBingxExchange  = createExchange({
      exchange: "bingx",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "bingx"
  });

async function cancelAllAfterSpot(exchange, options) {
    try {
        let result = await exchange.cancelAllAfterSpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await cancelAllAfterSpot(myBingxExchange);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.compendium.finance/pendax/using-pendax-sdk/bingx-functions/trades-spot.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
