unofficial_tabdeal_api.models

This module holds the data models for the API.

Classes

PairModel

Model for the isolated symbol pair details.

TriggerPriceModel

Model for the trigger price details.

CurrencyModel

Model for the currency details.

CurrencyCreditModel

Model for the currency credit details.

IsolatedSymbolDetailsModel

Model for isolated symbol details.

MarginOpenOrderModel

Model for open margin orders.

MarginOrderModel

This is the class storing information about a margin order.

TransferFromMarginModel

Model for transferring USDT from margin asset.

TransferToMarginModel

Model for transferring USDT to margin asset.

WalletDetailsModel

Model for wallet details.

Module Contents

class unofficial_tabdeal_api.models.PairModel(/, **data)

Bases: pydantic.BaseModel

Model for the isolated symbol pair details.

Parameters:

data (Any)

base_precision_visible: int

Precision of the base currency visible to user, e.g. 8

first_currency_precision: int

Precision of the first currency, e.g. 8

id: int

Pair ID

last_trade_price: decimal.Decimal

NOT YET KNOWN

price_precision: int

Precision of the price, e.g. 2

quote_precision_visible: int

Precision of the quote currency visible to user, e.g. 2

representation_name: str

Representation name of the pair, e.g. بیت‌ کوین-تتر

symbol: str

Symbol of the pair, e.g. BTC_USDT

symbol_fa: str

Symbol in Persian, e.g. بیت‌ کوین-تتر

class unofficial_tabdeal_api.models.TriggerPriceModel(/, **data)

Bases: pydantic.BaseModel

Model for the trigger price details.

Parameters:

data (Any)

sl_price: decimal.Decimal | None = None

Stop Loss price, e.g. 9500.00

tp_price: decimal.Decimal | None = None

Take Profit price, e.g. 10500.00

class unofficial_tabdeal_api.models.CurrencyModel(/, **data)

Bases: pydantic.BaseModel

Model for the currency details.

Parameters:

data (Any)

id: int | None = None

ID of the currency.

server MAY NOT SEND this property in some requests, Therefore, it defaults to None if not provided

AVAILABLE: get_margin_all_open_orders

NOT AVAILABLE: get_isolated_symbol_details

name: str

Name of the currency, e.g. ‘TetherUS’

name_fa: str

Name of the currency in Persian, e.g. ‘تتر’

precision: int | None = None

Precision of the currency, e.g. 8.

server MAY NOT SEND this property in some requests, Therefore, it defaults to None

if not provided.

AVAILABLE: get_margin_all_open_orders

NOT AVAILABLE: get_isolated_symbol_details

representation_name: str

Representation name of the currency, e.g. ‘تتر’

symbol: str

Symbol of the currency, e.g. ‘USDT’

class unofficial_tabdeal_api.models.CurrencyCreditModel(/, **data)

Bases: pydantic.BaseModel

Model for the currency credit details.

Parameters:

data (Any)

amount: decimal.Decimal

Total amount of the currency, e.g. 1100.00

available_amount: decimal.Decimal

Available amount of the currency, e.g. 1000.00

average_entry_price: decimal.Decimal

Average entry price of the currency, e.g. 10000.00

borrow: decimal.Decimal

NOT YET KNOWN

currency: CurrencyModel

Currency details of the credit

frozen_amount: decimal.Decimal

Frozen amount of the currency, e.g. 100.00

genre: str | None = None

Genre of the currency, e.g. ‘IsolatedMargin’

server MAY NOT SEND this property in some requests, Therefore, it defaults to None if not provided

AVAILABLE: get_isolated_symbol_details

NOT AVAILABLE: get_margin_all_open_orders

genre_fa: str | None = None

Genre of the currency in Persian, e.g. ‘کیف پول معامله اهرم‌دار Isolated’

server MAY NOT SEND this property in some requests, Therefore, it defaults to None if not provided

AVAILABLE: get_isolated_symbol_details

NOT AVAILABLE: get_margin_all_open_orders

interest: decimal.Decimal

Interest on the currency, e.g. 10.00

irt_average_entry_price: decimal.Decimal

Average entry price of the currency in IRT, e.g. 100000000.00

irt_value: decimal.Decimal

Amount of credit in symbol as IRT, e.g. 10000000.00

is_borrowable: bool

Whether the currency is borrowable, e.g. True or False

max_transfer_out_amount: decimal.Decimal | None = None

Max amount of the currency that can be transferred out, e.g. 900.00

server MAY NOT SEND this property in some requests, Therefore, it defaults to None if not provided

AVAILABLE: get_isolated_symbol_details

NOT AVAILABLE: get_margin_all_open_orders

pair: PairModel | None = None

Pair details of the credit

server MAY NOT SEND this property in some requests, Therefore, it defaults to None if not provided

AVAILABLE: get_isolated_symbol_details

NOT AVAILABLE: get_margin_all_open_orders

position: decimal.Decimal

NOT YET KNOWN

position_usdt_value: decimal.Decimal | None = None

Value of the position as USDT. For example, 93427.9345

server MAY NOT SEND this property in some requests, Therefore, it defaults to None if not provided.

AVAILABLE: get_margin_all_open_orders

NOT AVAILABLE: get_isolated_symbol_details

position_irt_value: decimal.Decimal | None = None

Value of the position as IRT. For example, 3255.787

server MAY NOT SEND this property in some requests, Therefore, it defaults to None if not provided.

AVAILABLE: get_margin_all_open_orders

NOT AVAILABLE: get_isolated_symbol_details

position_value: decimal.Decimal

NOT YET KNOWN

usdt_value: decimal.Decimal

Amount of credit in symbol as USDT, e.g. 1000.00

class unofficial_tabdeal_api.models.IsolatedSymbolDetailsModel(/, **data)

Bases: pydantic.BaseModel

Model for isolated symbol details.

Parameters:

data (Any)

active: bool

Whether the isolated symbol is active for trading, e.g. True or False

borrow_active: bool

Whether the isolated symbol is active for borrowing credit, e.g. True or False

break_even_point: decimal.Decimal

Break-even point for the isolated symbol, e.g. 10000.00 This is the point where the profit/loss is zero.

first_currency_borrowable_amount: decimal.Decimal

Borrowable amount of the first currency, e.g. 1000.00

first_currency_credit: CurrencyCreditModel

Currency details of first symbol.

id: int

ID of the isolated symbol market, e.g. 157092

margin_active: bool

Whether the isolated symbol is active for margin trading, e.g. True or False

max_margin_level: decimal.Decimal

Max margin level for the isolated symbol, e.g. 60.0 This is defined by symbol and user trading amount

pair: PairModel

Isolated symbol pair details.

second_currency_borrowable_amount: decimal.Decimal

Borrowable amount of the second currency, e.g. 1000.00

second_currency_credit: CurrencyCreditModel

Currency details of second symbol, for example, USDT in BTCUSDT

trader: int

ID of the trader, e.g. 5403

transfer_active: bool

Whether the isolated symbol is active for transferring credit, e.g. True or False

trigger_price: TriggerPriceModel

User-set trigger price points for Stop loss and Take profit.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class unofficial_tabdeal_api.models.MarginOpenOrderModel(/, **data)

Bases: pydantic.BaseModel

Model for open margin orders.

Parameters:

data (Any)

break_even_point: decimal.Decimal

Break-even point for the isolated symbol, e.g. 10000.00 This is the point where the profit/loss is zero.

first_currency_credit: CurrencyCreditModel

Currency details of first symbol, for example, BTC in BTCUSDT

id: int

ID of the isolated symbol market. for example, 157092.

is_long: bool

Whether the order is Long(True) or not (Short = False)

is_order_filled: bool

Whether the order is filled completely(True) or not(False)

pair: PairModel

Isolated symbol pair details.

risk_name: str

Amount of risk in string, determined by server. For example, ‘Moderate’

second_currency_credit: CurrencyCreditModel

Currency details of second symbol, for example, USDT in BTCUSDT

trigger_price: TriggerPriceModel

User-set trigger price points for Stop loss and Take profit.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class unofficial_tabdeal_api.models.MarginOrderModel(/, **data)

Bases: pydantic.BaseModel

This is the class storing information about a margin order.

Parameters:

data (Any)

deposit_amount: decimal.Decimal

Deposit amount for the order, e.g. 1000.00

isolated_symbol: str

Symbol of the order, e.g. BTCUSDT

margin_level: decimal.Decimal

Margin level of the order, Must be greater than 0 and less than or equal to MAX_ALLOWED_MARGIN_LEVEL

order_price: decimal.Decimal

Price of the order, e.g. 10000.00

order_side: unofficial_tabdeal_api.enums.OrderSide

Side of the order, either BUY or SELL

stop_loss_percent: decimal.Decimal

Percentile of tolerate-able loss, e.g. 5 for 5%

take_profit_percent: decimal.Decimal

Percentile of expected profit, e.g. 10 for 10%

class unofficial_tabdeal_api.models.TransferFromMarginModel(/, **data)

Bases: pydantic.BaseModel

Model for transferring USDT from margin asset.

Parameters:

data (Any)

account_genre: str = 'IsolatedMargin'

Genre of the account, e.g. ‘IsolatedMargin’, ‘Spot’, …

amount: decimal.Decimal

Amount to transfer, must be a positive decimal value.

currency_symbol: str = 'USDT'

Currency symbol for the transfer, defaults to ‘USDT’.

other_account_genre: str = 'Main'

Genre of the other account, e.g. ‘Main’.

pair_symbol: str

Symbol of the trading pair, e.g. ‘BTCUSDT’.

transfer_direction: str = 'Out'

Direction of transfer, e.g. ‘Out’ for transferring out of margin asset.

class unofficial_tabdeal_api.models.TransferToMarginModel(/, **data)

Bases: pydantic.BaseModel

Model for transferring USDT to margin asset.

Parameters:

data (Any)

amount: int = 0

A default value that is always 0 for no reason.

currency_symbol: str = 'USDT'

Currency symbol for the transfer, defaults to ‘USDT’.

pair_symbol: str

Symbol of the trading pair, e.g. ‘BTCUSDT’.

transfer_amount_from_main: decimal.Decimal

Amount to transfer from main account, must be a positive decimal value.

class unofficial_tabdeal_api.models.WalletDetailsModel(/, **data)

Bases: pydantic.BaseModel

Model for wallet details.

Parameters:

data (Any)

tether_us: decimal.Decimal

Amount of Tether US in the wallet, must be a positive decimal value.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].