# Spot Account/Trade

## User API default symbol

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

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#user-api-default-symbol>
{% endhint %}

#### Function Name:

```javascript
getSelfSymbolsSpot()
```

#### Usage:

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

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

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

let result = await getSelfSymbolsSpot(myMexcExchanges);
```

## New Order

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

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#test-new-order>
{% endhint %}

#### Function Name:

```javascript
newOrderSpot()
```

#### Usage:

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

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

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

let result = await newOrderSpot(myMexcExchanges,
         {
              symbol: "MXUSDT",
              side: "BUY",
              type: "MARKET",
              quoteOrderQty: "8"
         });
```

## Test New Order

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

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#new-order>
{% endhint %}

#### Function Name:

```javascript
testNewOrderSpot()
```

#### Usage:

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

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

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

let result = await testNewOrderSpot(myMexcExchanges,
         {
             symbol: "BTCUSDT",
             side: "BUY",
             type: "LIMIT",
             price: "20000",
             quantity: "0.0002"
         });
```

## Cancel Order

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

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#batch-orders>
{% endhint %}

#### Function Name:

```javascript
cancelOrderSpot()
```

#### Usage:

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

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

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(myMexcExchanges,
         {
             symbol: "MXUSDT",
             orderId: "65f257f2b17f491393980f6e1a5a8331"
         });
```

## Cancel all Open Orders on a Symbol

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

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#cancel-all-open-orders-on-a-symbol>
{% endhint %}

#### Function Name:

```javascript
cancelOpenOrdersSpot()
```

#### Usage:

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

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

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

let result = await cancelOpenOrdersSpot(myMexcExchanges,
         {
             symbol: "MXUSDT"
         });
```

## Query Order

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

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#query-order>
{% endhint %}

#### Function Name:

```javascript
getOrderSpot()
```

#### Usage:

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

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

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

let result = await getOrderSpot(myMexcExchanges,
         {
             symbol: "MXUSDT",
             orderId: "65f257f2b17f491393980f6e1a5a8331"
         });
```

## Current Open Orders

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

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#current-open-orders>
{% endhint %}

#### Function Name:

```javascript
getOpenOrdersSpot()
```

#### Usage:

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

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

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(myMexcExchanges,
         {
             symbol: "MXUSDT"
         });
```

## All Orders

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

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#all-orders>
{% endhint %}

#### Function Name:

```javascript
getAllOrdersSpot()
```

#### Usage:

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

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

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

let result = await getAllOrdersSpot(myMexcExchanges,
         {
             symbol: "MXUSDT"
         });
```

## Account Information

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

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#account-information>
{% endhint %}

#### Function Name:

```javascript
getSpotAccountInfo()
```

#### Usage:

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

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

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

let result = await getSpotAccountInfo(myMexcExchanges);
```

## Account Trade List

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

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#account-trade-list>
{% endhint %}

#### Function Name:

```javascript
getAccountTradeListSpot()
```

#### Usage:

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

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

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

let result = await getAccountTradeListSpot(myMexcExchanges, {symbol: "MXUSDT"});
```

## Enable MX Deduct

{% hint style="danger" %}
This function is currently under construction and may fail or give unexpected behavior
{% endhint %}

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

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#enable-mx-deduct>
{% endhint %}

#### Function Name:

```javascript
enableMxDeduct()
```

#### Usage:

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

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

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

let result = await enableMxDeduct(myMexcExchanges, {mxDeductEnable: "true"});
```

## Query MX Deduct Status

{% hint style="danger" %}
This function is currently under construction and may fail or give unexpected behavior
{% endhint %}

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

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#query-mx-deduct-status>
{% endhint %}

#### Function Name:

```javascript
getMxDeductStatus()
```

#### Usage:

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

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

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

let result = await getMxDeductStatus(myMexcExchanges);
```
