dxsp.utils.account_utils.AccountUtils#
- class dxsp.utils.account_utils.AccountUtils(**kwargs)[source]#
Bases:
objectClass AccountUtils to interact with private related methods such as account balance, signing transactions, etc.
- Parameters:
None
Methods
Retrieves the account balance of the user.
Get the account margin.
Get the open positions for the account.
Get the open positions for the account.
Retrieves the account position.
get_approve(token_address)Given a token address, approve a token
get_gas(transaction)Given a transaction, get gas estimate
search get gas price
get_sign(transaction)Given a transaction, sign a transaction
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