Депозиты (tbank.deposit)¶
Депозитные счета компании: карточка депозита (баланс, ставка, условия, автопролонгация), открытие нового депозита и пополнение.
Хост:
secured-openapi.tbank.ru, требуется mTLS-сертификат (cert).Суммы:
Decimalв валюте депозита. Провод:camelCase.Клиенты:
tbank.deposit.DepositClient(async) иtbank.deposit.sync.DepositClient(sync).
from decimal import Decimal
from tbank.deposit import DepositClient
from tbank.deposit.models import OpenDepositRequest, ReplenishDepositRequest
from tbank.deposit.enums import Capitalisation, Currency, PayFrequency
client = DepositClient(
token="business-token",
cert=("client.pem", "client-key.pem"),
)
# карточка депозита
details = await client.get_deposit_details("D-АГ-123")
print(details.balance.amount, details.account_info.rate)
print(details.account_info.replenish.is_accessible)
# открыть депозит
opened = await client.open_deposit(OpenDepositRequest(
term=181,
capitalisation=Capitalisation.DEPOSIT,
currency=Currency.RUB,
is_replenish_available=True,
is_withdraw_available=False,
pay_frequency=PayFrequency.MATURITY,
))
print(opened.open_id, opened.application_id)
# пополнить депозит с расчётного счёта
await client.replenish_deposit(ReplenishDepositRequest(
deposit_agreement="D-АГ-123",
source_agreement="40702810000000000000",
amount=Decimal("50000"),
))
Клиент¶
- class tbank.deposit.aio.DepositClient(token, *, base_url=None, sandbox=False, cert=None, verify=True, retry=None, transport=None)[исходный код]¶
Базовые классы:
BaseAsyncClientАсинхронный клиент депозитов: карточка счёта, открытие и пополнение.
Домен работает на secured-хосте и требует mTLS-сертификата (cert). Суммы — Decimal в валюте депозита. Провод — camelCase.
- Параметры:
token (str)
base_url (Optional[str])
sandbox (bool)
cert (Optional[CertTypes])
verify (VerifyTypes)
retry (Optional[RetryPolicy])
transport (Optional[AsyncTransport])
- decimal_body: ClassVar[bool] = True¶
True → тело парсится с parse_float=Decimal (точные денежные суммы).
- async get_deposit_details(agreement_number)[исходный код]¶
Карточка депозита: баланс, договор, ставка, условия.
- Параметры:
agreement_number (str)
- Тип результата:
- async open_deposit(request)[исходный код]¶
Открыть депозит. Возвращает идентификаторы процесса и заявки.
- Параметры:
request (OpenDepositRequest)
- Тип результата:
- async replenish_deposit(request)[исходный код]¶
Пополнить депозит с указанного счёта-источника.
- Параметры:
request (ReplenishDepositRequest)
- Тип результата:
None
Модели¶
- class tbank.deposit.models.DepositModel[исходный код]¶
Базовые классы:
BaseModelБазовая модель домена: snake_case в Python, camelCase на проводе.
- model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class tbank.deposit.models.DepositBalance(*, amount, currencyCode, paidAmount, lockedAmount, fineAmount=None)[исходный код]¶
Базовые классы:
DepositModel- Параметры:
- model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class tbank.deposit.models.AutoProlongation(*, status)[исходный код]¶
Базовые классы:
DepositModel- Параметры:
status (AutoProlongationStatus)
- model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class tbank.deposit.models.DepositAgreementInfo(*, agreementNumber, interestAgreementNumber, autoProlongation, attachedAgreementNumber=None, activationDate=None, endingDate=None, closingDate=None, prolongationDate=None)[исходный код]¶
Базовые классы:
DepositModel- Параметры:
- model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class tbank.deposit.models.CapitalisationInfo(*, type)[исходный код]¶
Базовые классы:
DepositModel- Параметры:
type (Capitalisation)
- model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class tbank.deposit.models.WithdrawInfo(*, isAccessible, minSum=None)[исходный код]¶
Базовые классы:
DepositModel- model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class tbank.deposit.models.ReplenishInfo(*, isAccessible)[исходный код]¶
Базовые классы:
DepositModel- Параметры:
isAccessible (bool)
- model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class tbank.deposit.models.DepositAccountInfo(*, accountNumber, status, rate, capitalisation, minAmount, maxCurrent, maxAmount, withdraw, replenish, payFrequency, openDate=None, name=None)[исходный код]¶
Базовые классы:
DepositModel- Параметры:
accountNumber (str)
status (DepositAccountStatus)
rate (Decimal)
capitalisation (CapitalisationInfo)
minAmount (Decimal)
maxCurrent (Decimal)
maxAmount (Decimal)
withdraw (WithdrawInfo)
replenish (ReplenishInfo)
payFrequency (PayFrequency)
openDate (date | None)
name (str | None)
- model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class tbank.deposit.models.DepositAccountDetails(*, product, period, balance, agreementInfo, accountInfo)[исходный код]¶
Базовые классы:
DepositModelПолная карточка депозита.
- Параметры:
product (str)
period (int)
balance (DepositBalance)
agreementInfo (DepositAgreementInfo)
accountInfo (DepositAccountInfo)
- model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class tbank.deposit.models.OpenDepositRequest(*, term, capitalisation, currency, isReplenishAvailable, isWithdrawAvailable, payFrequency, linkedAccount=None)[исходный код]¶
Базовые классы:
DepositModel- Параметры:
term (int)
capitalisation (Capitalisation)
currency (Currency)
isReplenishAvailable (bool)
isWithdrawAvailable (bool)
payFrequency (PayFrequency)
linkedAccount (str | None)
- model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class tbank.deposit.models.OpenDepositResult(*, openId, applicationId)[исходный код]¶
Базовые классы:
DepositModel- model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class tbank.deposit.models.ReplenishDepositRequest(*, depositAgreement, sourceAgreement, amount)[исходный код]¶
Базовые классы:
DepositModel- Параметры:
- model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Перечисления¶
- class tbank.deposit.enums.Currency(*values)[исходный код]¶
-
Валюта депозита.
- RUB = 'RUB'¶
- RUR = 'RUR'¶
- USD = 'USD'¶
- EUR = 'EUR'¶
- GBP = 'GBP'¶
- CNY = 'CNY'¶
- class tbank.deposit.enums.Capitalisation(*values)[исходный код]¶
-
Признак капитализации процентов.
- DEPOSIT = 'DEPOSIT'¶
- ACCOUNT = 'ACCOUNT'¶
- class tbank.deposit.enums.PayFrequency(*values)[исходный код]¶
-
Периодичность выплаты процентов.
- NORMAL = 'NORMAL'¶
- MATURITY = 'MATURITY'¶
- class tbank.deposit.enums.AutoProlongationStatus(*values)[исходный код]¶
-
Статус автопролонгации депозита.
- INACTIVE = 'INACTIVE'¶
- ACTIVE = 'ACTIVE'¶
- INACCESSIBLE = 'INACCESSIBLE'¶