# Binance

## Binance Spot

The names of the functions related to the Binance spot start with `privateAPI.binance_`.

***

### 1. Get Account Information

{% code overflow="wrap" %}

```python
privateAPI.binance_account_info() -> dict
```

{% endcode %}

Get an account information, including the balance, fee rate, and etc.

[API Documentation](https://binance-docs.github.io/apidocs/spot/en/#account-information-user_data)

#### Arguments

None

#### Response

Same as the response in the API documentation.

***

### 2. Get Asset Balance

{% code overflow="wrap" %}

```python
privateAPI.binance_asset_balance(asset: str) -> dict
```

{% endcode %}

Get the tradable amount(`free`) and locked amount(`locked`) of the asset in the Binance spot account.

This function filters the elements of the `balance` value in the response of the [binance\_account\_info()](#1.-get-account-information).&#x20;

#### Arguments

* `asset` : (string) The name of the asset to get the balance.

#### Response

* `asset` : (string) The name of the asset.
* `free` : (string) The tradable amount of the asset.
* `locked` : (string) The amount of locked asset.

```python
# response example
{ 
    "asset": "BTC",
    "free": "4723846.89208129",
    "locked": "0.00000000"
}
```

***

### 3. Market Order by Amount

{% code overflow="wrap" %}

```python
privateAPI.binance_market_order_by_amount(amount: float, symbol: str, orderside: str) -> dict
```

{% endcode %}

Create a new market order. In this function, the currency of the amount is a **base asset**. For example, If the `symbol = 'BTCUSDT'`(base asset = BTC, quote asset = USDT) and `amount=0.15`, then it creates an order of size **0.15 BTC**.

[API Documentation](https://binance-docs.github.io/apidocs/spot/en/#new-order-trade)

#### Arguments

* `amount` : (float) The amount of the order.
* `symbol` : (string) The name of the symbol to trade.
* `orderside` : (string) To buy, set it as `'buy'`, or `'sell'` to sell.

#### Response

Same as the response in the API documentation.

***

### 4. Market Order by Quote Asset Quantity

{% code overflow="wrap" %}

```python
privateAPI.binance_market_order_by_quote_qty(quoteqty: float, symbol: str, orderside: str) -> dict
```

{% endcode %}

Create a new market order by the amount of the order in the quote asset. In this function, the currency of the amount is a **quote asset**. For example, If the `symbol = 'BTCUSDT'`(base asset = BTC, quote asset = USDT) and `quoteqty=120`, then it creates an order of size **120 USDT**.

[API Documentation](https://binance-docs.github.io/apidocs/spot/en/#new-order-trade)

#### Arguments

* `quoteqty` : (float) The amount of the order in quote asset.
* `symbol` : (string) The name of the symbol to trade.
* `orderside` : (string) To buy, set it as `'buy'`, or `'sell'` to sell.

#### Response

Same as the response in the API documentation.

***

### 5. Limit Order by Amount

{% code overflow="wrap" %}

```python
privateAPI.binance_limit_order_by_amount(amount: float, price: float, symbol: str, orderside: str) -> dict
```

{% endcode %}

Create a new limit order. In this function, the currency of the amount is a **base asset**.

[API Documentation](https://binance-docs.github.io/apidocs/spot/en/#new-order-trade)

#### Arguments

* `amount` : (float) The amount of the order.
* `price` : (float) The price for the order to be filled.
* `symbol` : (string) The name of the symbol to trade.
* `orderside` : (string) To buy, set it as `'buy'`, or `'sell'` to sell.

#### Response

Same as the response in the API documentation.

***

### 6. Cancel Orders on Symbol

{% code overflow="wrap" %}

```python
privateAPI.binance_cancel_orders_on_symbol(symbol: str) -> any
```

{% endcode %}

Cancel all open orders of the symbol.

[API Documentation](https://binance-docs.github.io/apidocs/spot/en/#cancel-all-open-orders-on-a-symbol-trade)

#### Arguments

* `symbol` : (string) The name of the symbol to cancel.

#### Response

Same as the response in the API documentation.

***

## Binance USDⓈ-M Futures

The names of the functions related to the Binance USDⓈ-M futures start with `privateAPI.binance_futures_`.

### 1. Get Account Balance

{% code overflow="wrap" %}

```python
privateAPI.binance_futures_account_balance() -> list
```

{% endcode %}

Get the balance of the assets in the Binance USD-M futures account.

[API Documentation](https://binance-docs.github.io/apidocs/futures/en/#futures-account-balance-v2-user_data)

#### Arguments

None

#### Response

Same as the response in the API documentation.

***

### 2. Get Account Information

{% code overflow="wrap" %}

```python
privateAPI.binance_futures_account_info() -> dict
```

{% endcode %}

Get the account information of the Binance USDⓈ-M futures account.

[API Documentation](https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data)

#### Arguments

None

#### Response

Same as the response in the API documentation.

***

### 3. Get Position Information

{% code overflow="wrap" %}

```python
privateAPI.binance_futures_position_info() -> list
```

{% endcode %}

Get the open position information of the Binance USDⓈ-M futures account.

[API Documentation](https://binance-docs.github.io/apidocs/futures/en/#position-information-v2-user_data)

#### Arguments

None

#### Response

Same as the response in the API documentation.

***

### 4. Market Order

{% code overflow="wrap" %}

```python
privateAPI.binance_futures_market_order(leverage: int, symbol: str, side: str, qty: float) -> dict
```

{% endcode %}

Set the leverage of the symbol and create a market order.

[API Documentation](https://binance-docs.github.io/apidocs/futures/en/#new-order-trade)

#### Arguments

* `leverage` : (int) The leverage value to set.
* `symbol` : (string) The name of the symbol.
* `side` : (string) `'BUY'` to open long & close short position, or `'SELL'` to open short & close long position.
* `qty` : (float) The contract size to set order. In most case, it is the amount in **base asset**. For instance, `symbol=ETHUSDT`, and `qty=0.12` will create an order of contract size **0.12 ETH**.

#### Response

Same as the response in the API documentation.

***

### 5. Limit Order

{% code overflow="wrap" %}

```python
privateAPI.binance_futures_limit_order(leverage: int, symbol: str, side: str, qty: float, price: float) -> dict
```

{% endcode %}

Set the leverage of the symbol and create a limit order.

[API Documentation](https://binance-docs.github.io/apidocs/futures/en/#new-order-trade)

#### Arguments

* `leverage` : (int) The leverage value to set.
* `symbol` : (string) The name of the symbol.
* `side` : (string) `'BUY'` to open long & close short position, or `'SELL'` to open short & close long position.
* `qty` : (float) The contract size to set order. In most case, it is the amount in **base asset**. For instance, `symbol=ETHUSDT` and `qty=0.12` will create an order of contract size **0.12 ETH**.
* `price` : (float) The price for the order to be filled.

#### Response

Same as the response in the API documentation.

***

### 6. Cancel Orders on Symbol

{% code overflow="wrap" %}

```python
privateAPI.binance_futures_cancel_orders_on_symbol(symbol: str) -> any
```

{% endcode %}

Cancel all open orders of the symbol.

[API Documentation](https://binance-docs.github.io/apidocs/futures/en/#cancel-all-open-orders-trade)

#### Arguments

* `symbol` : (string) The name of the symbol to cancel.

#### Response

Same as the response in the API documentation.

***

## Binance COIN-M Futures

The names of the functions related to the Binance COIN-M futures start with `privateAPI.binance_cm_futures_`.

### 1. Get Account Information

{% code overflow="wrap" %}

```python
privateAPI.binance_cm_futures_account_info() -> dict
```

{% endcode %}

Get the account information in the Binance COIN-M Futures account.

[API Documentation](https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data)

#### Arguments

None

#### Response

Same as the response in the API documentation.

***

### 2. Get Position Information

{% code overflow="wrap" %}

```python
privateAPI.binance_cm_futures_position_info() -> list
```

{% endcode %}

Get the open position information in the Binance COIN-M Futures account.

[API Documentation](https://binance-docs.github.io/apidocs/delivery/en/#position-information-user_data)

#### Arguments

None

#### Response

Same as the response in the API documentation.

***

### 3. Market Order

{% code overflow="wrap" %}

```python
privateAPI.binance_cm_futures_market_order(leverage: int, symbol: str, side: str, qty: float) -> dict
```

{% endcode %}

Set the leverage of the symbol and create a market order.

[API Documentation](https://binance-docs.github.io/apidocs/delivery/en/#new-order-trade)

#### Arguments

* `leverage` : (int) The leverage value to set.
* `symbol` : (string) The name of the symbol.
* `side` : (string) `'BUY'` to open long & close short position, or `'SELL'` to open short & close long position.
* `qty` : (float) The size of the contract(=**CONT**) to set order. In most case, **1 CONT** is a size of  **10 USD**, while some symbols such as **BTCUSD** have 1 CONT as **100 USD**. For instance, `symbol=ETHUSD` and `qty=20` will create an order of ETHUSD with the contract size **200 USD**, but `symbol=BTCUSD` and `qty=20` will create an order of BTCUSD with the contract size **2000 USD**.

#### Response

Same as the response in the API documentation.

***

### 4. Limit Order

{% code overflow="wrap" %}

```python
privateAPI.binance_cm_futures_limit_order(leverage: int, symbol: str, side: str, qty: float, price: float) -> dict
```

{% endcode %}

Set the leverage of the symbol and create a limit order.

[API Documentation](https://binance-docs.github.io/apidocs/delivery/en/#new-order-trade)

#### Arguments

* `leverage` : (int) The leverage value to set.
* `symbol` : (string) The name of the symbol.
* `side` : (string) `'BUY'` to open long & close short position, or `'SELL'` to open short & close long position.
* `qty` : (float) The size of the contract(=**CONT**) to set order. In most case, **1 CONT** is a size of  **10 USD**, while some symbols such as **BTCUSD** have 1 CONT as **100 USD**. For instance, `symbol=ETHUSD` and `qty=20` will create an order of ETHUSD with the contract size **200 USD**, but `symbol=BTCUSD` and `qty=20` will create an order of BTCUSD with the contract size **2000 USD**.
* `price` : (float) The price for the order to be filled.

#### Response

Same as the response in the API documentation.

***

### 5. Cancel Orders on Symbol

{% code overflow="wrap" %}

```python
privateAPI.binance_cm_futures_cancel_orders_on_symbol(symbol: str) -> any
```

{% endcode %}

Cancel all open orders of the symbol.

[API Documentation](https://binance-docs.github.io/apidocs/delivery/en/#cancel-all-open-orders-trade)

#### Arguments

* `symbol` : (string) The name of the symbol to cancel.

#### Response

Same as the response in the API documentation.


---

# 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.unblinked.com/library/python-library/private-api/binance.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.
