Skip to content

[Bug] Округляются операции связанные с налогом #244

Open
kakoskakos opened this issue Jul 27, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@kakoskakos
Copy link

Что случилось?

В методе GetOperations некорректно возвращаются суммы связанные с налогом, они всегда приходят целыми числами.

В логах пример:
пришли дивиденды стоимостью 225, налог по ним: 29, однако 225 * 0.13 = 29.25
пришли купоны стоимостью 215.65, налог по ним: 28, однако 215.65 * 0.13 = 28.03

Воспроизведение

with tinkoff.Client(token) as client:
            operations: tinkoff.OperationsResponse = client.operations.get_operations(
                account_id=account_id, from_=date_from, to=date_to, state=1)
            operations.operations.sort(key=lambda v: v.parent_operation_id)
            return operations.operations

Tinkoff Invest Version

0.2.0-beta58

Python Version

3.9

OS

Linux

Логи

Operation(id='1234', parent_operation_id='', currency='rub', payment=MoneyValue(currency='rub', units=-29, nano=0), price=MoneyValue(currency='', units=0, nano=0), state=<OperationState.OPERATION_STATE_EXECUTED: 1>, quantity=0, quantity_rest=0, figi='', instrument_type='', date=datetime.datetime(2020, 12, 7, 12, 15, 54, tzinfo=datetime.timezone.utc), type='Удержание налога по дивидендам', operation_type=<OperationType.OPERATION_TYPE_DIVIDEND_TAX: 8>, trades=[], asset_uid='', position_uid='', instrument_uid='')
Operation(id='1234', parent_operation_id='', currency='rub', payment=MoneyValue(currency='rub', units=225, nano=0), price=MoneyValue(currency='', units=0, nano=0), state=<OperationState.OPERATION_STATE_EXECUTED: 1>, quantity=0, quantity_rest=0, figi='BBG002Z693D3', instrument_type='share', date=datetime.datetime(2020, 12, 7, 9, 55, 44, tzinfo=datetime.timezone.utc), type='Выплата дивидендов', operation_type=<OperationType.OPERATION_TYPE_DIVIDEND: 21>, trades=[], asset_uid='89bfabb6-149f-4205-9359-8e764981e478', position_uid='aaf82d2d-2374-4ad3-8e95-ae048c95d734', instrument_uid='267d6529-6cda-473a-9f3d-72ce085ab167')

Operation(id='1234', parent_operation_id='', currency='rub', payment=MoneyValue(currency='rub', units=-28, nano=0), price=MoneyValue(currency='', units=0, nano=0), state=<OperationState.OPERATION_STATE_EXECUTED: 1>, quantity=0, quantity_rest=0, figi='', instrument_type='', date=datetime.datetime(2021, 2, 4, 17, 23, 56, tzinfo=datetime.timezone.utc), type='Удержание НДФЛ по купонам', operation_type=<OperationType.OPERATION_TYPE_BOND_TAX: 2>, trades=[], asset_uid='', position_uid='', instrument_uid='')
Operation(id='1234', parent_operation_id='', currency='rub', payment=MoneyValue(currency='rub', units=215, nano=650000000), price=MoneyValue(currency='', units=0, nano=0), state=<OperationState.OPERATION_STATE_EXECUTED: 1>, quantity=0, quantity_rest=0, figi='BBG00PYL4HX2', instrument_type='bond', date=datetime.datetime(2021, 2, 3, 22, 54, 37, tzinfo=datetime.timezone.utc), type='Выплата купонов', operation_type=<OperationType.OPERATION_TYPE_COUPON: 23>, trades=[], asset_uid='b5bfc0ce-d306-4fb9-b20e-c14e8455c9b6', position_uid='fa6a31c6-09cc-4326-aaac-b197f581f47f', instrument_uid='c127d4f4-29a1-422b-aaec-bc31e1b70c6c')
@kakoskakos kakoskakos added the bug Something isn't working label Jul 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants