dxsp.utils.account_utils.AccountUtils#

class dxsp.utils.account_utils.AccountUtils(**kwargs)[source]#

Bases: object

Class AccountUtils to interact with private related methods such as account balance, signing transactions, etc.

Parameters:

None

get_account_balance()[source]#
get_trading_asset_balance()[source]#
get_account_position()[source]#
get_account_margin()[source]#
get_account_open_positions()[source]#
get_account_pnl()[source]#
get_approve()[source]#
get_sign()[source]#
get_gas()[source]#
get_gas_price()[source]#

Methods

get_account_balance()

Retrieves the account balance of the user.

get_account_margin()

Get the account margin.

get_account_open_positions()

Get the open positions for the account.

get_account_pnl()

Get the open positions for the account.

get_account_position()

Retrieves the account position.

get_approve(token_address)

Given a token address, approve a token

get_gas(transaction)

Given a transaction, get gas estimate

get_gas_price()

search get gas price

get_sign(transaction)

Given a transaction, sign a transaction

get_trading_asset_balance()

Retrieves the balance of the trading asset for the current wallet address.

async get_account_balance() str[source]#

Retrieves the account balance of the user.

Returns:

A formatted string containing the account balance in Bitcoin (₿) and the trading asset balance like USDT (💵).

async get_trading_asset_balance() float[source]#

Retrieves the balance of the trading asset for the current wallet address.

Returns:

The balance of the trading asset as a float.

async get_account_position() str[source]#

Retrieves the account position.

Returns:

A string representing the account position.

async get_account_margin()[source]#

Get the account margin. Not yet implemented

Returns:

The account margin.

Return type:

int

async get_account_open_positions()[source]#

Get the open positions for the account. Not yet implemented

Returns:

The number of open positions

for the account.

async get_account_pnl()[source]#

Get the open positions for the account. Not yet implemented

Returns:

The number of open positions

for the account.

async get_approve(token_address)[source]#

Given a token address, approve a token

Parameters:

token_address (str) – The token address

Returns:

approval_tx_hash

async get_sign(transaction)[source]#

Given a transaction, sign a transaction

Parameters:

transaction (Transaction) – The transaction

Returns:

signed_tx_hash

async get_gas(transaction)[source]#

Given a transaction, get gas estimate

Parameters:

transaction (Transaction) – The transaction

Returns:

The gas estimate

Return type:

int

async get_gas_price()[source]#

search get gas price

Returns:

The gas price

Return type:

int