Bingex.Swap (Bingex v0.1.13)

Provides an interface to interact with the BingX Swap API.

Summary

Functions

Requests to cancel all orders by their market symbol (ex. BTC-USDT) with account credentials.

Request to close all positions by market symbol (ex. BTC-USDT) with account credentials.

Requests to get current swap balance.

Query the capital flow of the perpetual contract under the current account.

Request the opening leverage and available positions of the user in the specified symbol contract.

Request to get all user's orders (pending, active, ...) by an optional period (start_time, end_time) and an optional limit of returned amount of orders with account credentials.

Request to the positions state of perpetual contracts by with account credentials.

Request to the position history of perpetual contracts by an optional period (start_time, end_time) with account credentials.

Requests to get current server time.

Requests to place an order using order data with account credentials.

Requests to place bunch of orders using list of order data with account credentials.

Requests to place a test order using order data with account credentials.

Request to set user's leverage amount by market symbol, position side and account credentials. Position side can be either :crossed or :isolated. Currently, BingX allows leverage from 1 to 125.

Request to set user's margin mode by market symbol and account credentials. Margin mode can be either :crossed or :isolated.

Functions

cancel_all_orders(symbol, api_key, secret_key)

Requests to cancel all orders by their market symbol (ex. BTC-USDT) with account credentials.

close_all_positions(symbol, api_key, secret_key)

Request to close all positions by market symbol (ex. BTC-USDT) with account credentials.

get_balance(api_key, secret_key)

Requests to get current swap balance.

get_contracts(symbol \\ nil)

get_income_history(symbol, api_key, secret_key, opts \\ [])

Query the capital flow of the perpetual contract under the current account.

get_leverage(symbol, api_key, secret_key)

Request the opening leverage and available positions of the user in the specified symbol contract.

get_orders_history(symbol, api_key, secret_key, opts \\ [])

Request to get all user's orders (pending, active, ...) by an optional period (start_time, end_time) and an optional limit of returned amount of orders with account credentials.

get_positions(symbol, api_key, secret_key)

Request to the positions state of perpetual contracts by with account credentials.

get_positions_history(symbol, start_time, end_time, api_key, secret_key)

Request to the position history of perpetual contracts by an optional period (start_time, end_time) with account credentials.

get_quotes(symbol \\ nil)

get_server_time()

Requests to get current server time.

place_order(order, api_key, secret_key)

Requests to place an order using order data with account credentials.

place_orders(orders, api_key, secret_key)

Requests to place bunch of orders using list of order data with account credentials.

place_test_order(order, api_key, secret_key)

Requests to place a test order using order data with account credentials.

set_leverage(symbol, position_side, leverage, api_key, secret_key)

Request to set user's leverage amount by market symbol, position side and account credentials. Position side can be either :crossed or :isolated. Currently, BingX allows leverage from 1 to 125.

set_margin_mode(symbol, margin_mode, api_key, secret_key)

Request to set user's margin mode by market symbol and account credentials. Margin mode can be either :crossed or :isolated.