unofficial_tabdeal_api.tabdeal_client

This is the class of Tabdeal client.

Classes

TabdealClient

a client class to communicate with Tabdeal platform.

Module Contents

class unofficial_tabdeal_api.tabdeal_client.TabdealClient(*, user_hash, authorization_key, _is_test=False)

Bases: unofficial_tabdeal_api.authorization.AuthorizationClass, unofficial_tabdeal_api.margin.MarginClass, unofficial_tabdeal_api.wallet.WalletClass, unofficial_tabdeal_api.order.OrderClass

a client class to communicate with Tabdeal platform.

Parameters:
  • user_hash (str)

  • authorization_key (str)

  • _is_test (bool)

async _validate_trade_conditions(order)

Validate trade conditions for a margin order.

Parameters:

order (MarginOrderModel) – The margin order to validate.

Returns:

True if the trade conditions are valid, False otherwise.

Return type:

bool

async _open_order(order)

Open a margin order.

Parameters:

order (MarginOrderModel) – The margin order to open.

Returns:

None

Return type:

None

async _wait_for_order_fill(order)

Wait for the margin order to be filled.

Parameters:

order (MarginOrderModel) – The margin order to wait for.

Returns:

True if the order is filled, False otherwise.

Return type:

bool

async _setup_stop_loss_take_profit(order)

Setup stop loss and take profit for a margin order.

Parameters:

order (MarginOrderModel) – The margin order to setup SL/TP for.

Returns:

The margin asset ID.

Return type:

int

async _wait_for_order_close(margin_asset_id)

Wait for the margin order to close.

Parameters:

margin_asset_id (int) – The ID of the margin asset to wait for.

Return type:

None

async _withdraw_balance_if_requested(order)

Withdraw balance from margin asset to wallet if requested.

Parameters:

order (MarginOrderModel) – The margin order containing the asset symbol.

Return type:

None

async trade_margin_order(*, order, withdraw_balance_after_trade)

Trade a margin order.

Parameters:
  • order (MarginOrderModel) – MarginOrderModel object containing order details.

  • withdraw_balance_after_trade (bool) – Flag indicating whether to withdraw balance after trade.

Returns:

Whether the trade was successful or not.

Return type:

bool