Tim55667757 / TKSBrokerAPI

TKSBrokerAPI is the trading platform for automation and simplifying the implementation of trading scenarios, as well as working with Tinkoff Invest API server via the REST protocol. The TKSBrokerAPI platform may be used in two ways: from the console, it has a rich keys and commands, or you can use it as Python module.
https://tim55667757.github.io/TKSBrokerAPI/
Apache License 2.0
25 stars 9 forks source link

Incorrect calculation of available currencies #101

Closed Tim55667757 closed 1 year ago

Tim55667757 commented 1 year ago
## Portfolio distribution by assets

| Type                               | Uniques | Percent | Current cost       |
|------------------------------------|---------|---------|--------------------|
| Ruble                              | 1       | 96.93%  | 290230.05 rub      |
| Currencies                         | 3       | 0.04%   | 125.33 rub         |
| Shares                             | 2       | 3.03%   | 9076.60 rub        |

But in overview:

* **Portfolio cost:** 299431.98 RUB
* **Changes:** -29.95 RUB (-0.01%)

## Open positions

| Ticker [FIGI]               | Volume (blocked)                | Lots     | Curr. price  | Avg. price   | Current volume cost | Profit (%)                   |
|-----------------------------|---------------------------------|----------|--------------|--------------|---------------------|------------------------------|
| **Ruble:**                  |            290230.05 (0.00) rub |          |              |              |                     |                              |
|                             |                                 |          |              |              |                     |                              |
| **Currencies:**             |                                 |          |              |              |          125.33 RUB |                              |
| EUR_RUB__TOM [BBG0013HJJ31] |              1000.00 (0.00) eur | —        |    63.57 rub |    63.48 rub |           63.57 rub | +82.50 rub (+0.13%)          |
| RUB000UTSTOM [RUB000UTSTOM] |            166027.88 (0.00) rub | —        |     1.00 rub |     1.00 rub |            1.00 rub | 0.00 rub (0.00%)             |
| USD000UTSTOM [BBG0013HGFT4] |              1000.00 (0.00) usd | —        |    60.76 rub |    60.73 rub |           60.76 rub | +27.50 rub (+0.05%)          |
|                             |                                 |          |              |              |                     |                              |
Tim55667757 commented 1 year ago

Bug fixed in v1.6.dev150

Debug build: https://app.travis-ci.com/github/Tim55667757/TKSBrokerAPI/builds/260647729 PyPI artifact for testing: https://pypi.org/project/tksbrokerapi/1.6.dev150/

Test: image

# Client's portfolio

* **Actual on date:** [2023-02-14 19:59:01 UTC]
* **Account ID:** [2208805297]
* **Portfolio cost:** 582458.21 RUB
* **Changes:** -7253.45 RUB (-1.23%)

## Open positions

| Ticker [FIGI]               | Volume (blocked)                | Lots     | Curr. price  | Avg. price   | Current volume cost | Profit (%)                   |
|-----------------------------|---------------------------------|----------|--------------|--------------|---------------------|------------------------------|
|                             |                                 |          |              |              |                     |                              |
| **Currencies:**             |                                 |          |              |              |   **163297.35 RUB** |                              |
| USD000UTSTOM [BBG0013HGFT4] |                 0.34 (0.00) usd | —        |    73.80 rub |    71.87 rub |           25.09 rub | +0.66 rub (+2.70%)           |
| RUB000UTSTOM [RUB000UTSTOM] |              1241.97 (0.00) rub | —        |     1.00 rub |     1.00 rub |         1241.97 rub | 0.00 rub (0.00%)             |
| EUR_RUB__TOM [BBG0013HJJ31] |                 0.22 (0.00) eur | —        |    79.25 rub |    76.24 rub |           17.43 rub | +0.66 rub (+3.93%)           |
| HKDRUB_TOM [BBG0013HSW87]   |             17000.30 (0.00) hkd | —        |     9.53 rub |     9.46 rub |       162012.86 rub | +1105.53 rub (+0.69%)        |
|                             |                                 |          |              |              |                     |                              |
| **Shares:**                 |                                 |          |              |              |   **404250.35 RUB** |                              |
| LKOH [BBG004731032]         |                           6 (0) | 6        |  3918.00 rub |  3935.50 rub |        23508.00 rub | -105.00 rub (-0.44%)         |
| 3888 [BBG000TF4XZ9]         |                          30 (0) | 3        |    29.55 hkd |    29.60 hkd |          886.50 hkd | -1.50 hkd (-0.17%)           |
| YNDX [BBG006L8G4H1]         |                           4 (0) | 4        |  2027.40 rub |  2069.40 rub |         8109.60 rub | -168.00 rub (-2.03%)         |
| NLMK [BBG004S681B4]         |                          70 (0) | 7        |   123.54 rub |   126.72 rub |         8647.80 rub | -222.60 rub (-2.51%)         |
| AFLT [BBG004S683W7]         |                         910 (0) | 91       |    27.85 rub |    28.48 rub |        25343.50 rub | -576.90 rub (-2.23%)         |