get_operations
Fetch transaction history for a T-Bank account by date range, with optional state or instrument filters. Returns buys, sells, dividends, taxes, deposits, and withdrawals.
Instructions
Get list of operations (transactions) for an account within a date range.
Returns: buys, sells, dividends, coupons, taxes, commissions, deposits, withdrawals, etc. Each operation has: id, operationType (the code, e.g. OPERATION_TYPE_BUY), type (the same in Russian words), date, state, payment, price, quantity, quantityRest, figi, instrumentUid, positionUid, trades. A field that is zero or empty is left out; assetUid is left out too.
Canceled orders are operations as well, and carry the quantity and the payment they asked for: pass state="EXECUTED" before adding up money or quantities. quantity is what the order asked for and quantityRest what was not executed, so the executed quantity is their difference. A bond repayment has no quantity. Prices and quantities are as they were at the time: unlike candles, they are not adjusted for later splits.
Note: this method has no paging. An operation is about 450 characters, so about 100 of them fit into a client's limit, and a month of an active account can be twice that — keep the range to a week or two, or use get_operations_by_cursor, which pages. The API returns no more than 1000 operations, the latest ones; when that happens the result starts with a "note" saying so, and the earlier operations are not in it.
Args: account_id: Account ID from_date: Start date (YYYY-MM-DD), default: 14 days ago — about as much as a client's limit takes for an active account to_date: End date (YYYY-MM-DD, inclusive), default: now state: Filter by state: EXECUTED, CANCELED, PROGRESS (empty = all) figi: Filter by instrument — FIGI, ticker, ISIN or UID (empty = all instruments)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| figi | No | ||
| state | No | ||
| to_date | No | ||
| from_date | No | ||
| account_id | Yes |