Skip to content

Commit

Permalink
Merge pull request #87 from Tim55667757/develop
Browse files Browse the repository at this point in the history
release-1.5 finalization
  • Loading branch information
Tim55667757 authored Nov 21, 2022
2 parents fe5b19e + a990fb0 commit 4cd78e5
Show file tree
Hide file tree
Showing 18 changed files with 15,978 additions and 13,423 deletions.
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ jobs:
after_failure:
- echo "Some issues occurred. See full logs."
after_success:
- echo "All stages PRE-BUILDING -> TESTING -> BUILDING -> PUBLISHING to PyPI - done"
- |
if [ $TRAVIS_PULL_REQUEST == false ]; then
echo "All stages PRE-BUILDING -> TESTING -> BUILDING -> PUBLISHING to PyPI - done";
else
echo "All PR stages PRE-BUILDING -> TESTING -> BUILDING -> [PUBLISHING to PyPI][SKIPPED] - done";
fi
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,42 @@
* 🎁 Поддержать проект донатом на ЮМани-кошелёк: [410015019068268](https://yoomoney.ru/quickpay/shop-widget?writer=seller&targets=%D0%94%D0%BE%D0%BD%D0%B0%D1%82%20(%D0%BF%D0%BE%D0%B4%D0%B0%D1%80%D0%BE%D0%BA)%20%D0%B4%D0%BB%D1%8F%20%D0%B0%D0%B2%D1%82%D0%BE%D1%80%D0%BE%D0%B2%20%D0%BF%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D0%B0%20TKSBrokerAPI&default-sum=999&button-text=13&payment-type-choice=on&successURL=https%3A%2F%2Ftim55667757.github.io%2FTKSBrokerAPI%2F&quickpay=shop&account=410015019068268)


### [1.5.* (2022-11-21)](https://github.com/Tim55667757/TKSBrokerAPI/milestone/5) — в разработке...

##### Дайджест

В очередной версии TKSBrokerAPI в отчёте о портфеле пользователя появилась новая секция с календарём платежей по облигациям. Он строится автоматически, если имеется хотя бы одна облигация в портфеле (ключ `--overview-calendar`). Был добавлен ключ `--html` для сохранения любых пользовательских отчётов в HTML формат. Кроме того, появилась возможность закрывать позицию и все ордера по ключу `--close-all` для одного инструмента, заданного через `--ticker` или `--figi`.

Торговый сценарий [./docs/examples/scenario1.py](https://github.com/Tim55667757/TKSBrokerAPI/blob/master/docs/examples/scenario1.py) был переписан в парадигме ООП: [./docs/examples/scenario1a.py](https://github.com/Tim55667757/TKSBrokerAPI/blob/master/docs/examples/scenario1a.py). Теперь это полноценный торговый шаблон на базе платформы TKSBrokerAPI. Его можно использовать за основу для разработки собственных сценариев.

Пофикшен обидный баг при торговле "по рынку" (ключ `--trade`), когда TP/SL ордеры открывались даже если основная заявка не была исполнена. Теперь при любых ошибках TP/SL ордеры не выставляются. А также, для удобства отладки теперь можно указывать ключ `--more` вместе с любой другой командой. В логах появится больше информации, например, сетевые запросы, сетевые ответы и их заголовки.

##### Новая функциональность

* [#62](https://github.com/Tim55667757/TKSBrokerAPI/issues/62) В отчёт о состоянии портфеля пользователя добавлена секция с календарём платежей по облигациям, который строится автоматически, если хотя бы одна облигация присутствует в портфеле (метод `Overview(details="calendar")`, ключ `--overview-calendar`).
* [#80](https://github.com/Tim55667757/TKSBrokerAPI/issues/80) Пример торгового сценария [./docs/examples/scenario1.py](https://github.com/Tim55667757/TKSBrokerAPI/blob/master/docs/examples/scenario1.py) дополнительно переписан в парадигме ООП: [./docs/examples/scenario1a.py](https://github.com/Tim55667757/TKSBrokerAPI/blob/master/docs/examples/scenario1a.py). Эти шаблоны можно брать за основу для разработки собственных торговых сценариев, на базе платформы TKSBrokerAPI.
* [#48](https://github.com/Tim55667757/TKSBrokerAPI/issues/48) Если ключ `--close-all` будет указан совместно с одним из ключей `--ticker` или `--figi`, тогда будут закрыты все незаблокированные объёмы открытой позиции, отложенные лимитные и стоп ордеры для выбранного инструмента. Для поддержки этой фичи были реализованы дополнительные методы: `CloseAllByTicker()` — для закрытия всех позиций и ордеров по инструменту заданному тикером, `CloseAllByFIGI()` — для закрытия всех позиций и ордеров по инструменту заданному FIGI идентификатором, `IsInLimitOrders()` — функция, которая возвращает `True` или `False`, при наличии или отсутствии открытых отложенных лимитных ордеров, `GetLimitOrderIDs()` — функция, которая возвращает список открытых отложенных лимитных ордеров, `IsInStopOrders()` — функция, которая возвращает `True` или `False`, при наличии или отсутствии открытых стоп ордеров и `GetStopOrderIDs()` — функция, которая возвращает список открытых стоп ордеров для инструмента.
* [#83](https://github.com/Tim55667757/TKSBrokerAPI/issues/83) Теперь можно указывать ключ `--html` для генерации дополнительных отчётов из Markdown-файлов в HTML формат. Рендеринг HTML и ключ `--html` были реализованы для отчётов, создаваемых командами `--list`, `--info`, `--search`, `--prices`, `--deals`, `--limits`, `--calendar`, `--account`, `--user-info`, `--overview`, `--overview-digest`, `--overview-positions`, `--overview-orders`, `--overview-analytics` и `--overview-calendar`. HTML-генератор основан на [Mako Templates library](https://www.makotemplates.org/).
* [#67](https://github.com/Tim55667757/TKSBrokerAPI/issues/67) Теперь можно указывать ключ `--more` вместе с любой командой. Он включает во всех методах TKSBrokerAPI больше отладочной информации и выводит её в логи. Например, сохраняются фактические сетевые запросы, ответы на них и заголовки.

##### Улучшения

* [#74](https://github.com/Tim55667757/TKSBrokerAPI/issues/74) Улучшен CI/CD скрипт `.travis.yml`. Теперь при запуске сборки из пулл-реквеста выполняются только шаги запуска юнит-тестов и сборки пакета. Выкладка пакета в PyPI не происходит. Публикация в PyPI теперь запускается только при сборке напрямую из ветки или после принятия пулл-реквеста.
* [#39](https://github.com/Tim55667757/TKSBrokerAPI/issues/39) Теперь все операции закрытия позиций или ордеров (наборы ключей `--close-***`) поддерживают возможность указания инструментов не только через тикеры, но и через FIGI идентификаторы.
* [#60](https://github.com/Tim55667757/TKSBrokerAPI/issues/60) Теперь ключи `--ticker` и `--figi` — регистронезависимые. Можно указывать в консоли их значения в любом регистре, а внутри платформы TKSBrokerAPI они будут автоматически приведены к верхнему регистру.
* [#75](https://github.com/Tim55667757/TKSBrokerAPI/issues/75) Если при запуске с ключом `--limits` окажется, что нет доступных для вывода лимитов денежных средств, то теперь пустая таблица отображаться не будет.
* [#68](https://github.com/Tim55667757/TKSBrokerAPI/issues/68) В отчёт по акции (метод `ShowInstrumentInfo()`, ключ `--info`) добавлена информация про тип акции: обыкновенная, привилегированная, американские депозитарные расписки, глобальные депозитарные расписки, товарищество с ограниченной ответственностью, акции из реестра Нью-Йорка, закрытый инвестиционный фонд или траст недвижимости.
* [#35](https://github.com/Tim55667757/TKSBrokerAPI/issues/35) В таблице "Summary" с отчетом по операциям (ключ `--deals`) упрощены заголовки.
* [#51](https://github.com/Tim55667757/TKSBrokerAPI/issues/51) Константа `NANO`, методы `NanoToFloat()` и `FloatToNano()` вынесены в новый модуль `TradeRoutines`. Это библиотека с набором функций для упрощения реализации торговых стратегий на базе платформы TKSBrokerAPI.
* [#52](https://github.com/Tim55667757/TKSBrokerAPI/issues/52) Метод `GetDatesAsString()` также перенесён в модуль `TradeRoutines`.

##### Баг-фиксы

* [#66](https://github.com/Tim55667757/TKSBrokerAPI/issues/66) Исправлен баг в методе `Trade()` (ключ `--trade`). Теперь, в случае если основной рыночный ордер по инструменту не был исполнен, то TP/SL ордеры также не выставляются для этого инструмента. В предыдущих версиях TP/SL ордеры открывались даже в случае ошибок при открытии рыночного ордера, к которому они привязаны, что нарушало логику торговых сценариев.
* [#84](https://github.com/Tim55667757/TKSBrokerAPI/issues/84) Исправлен баг в методе `Overview()` (ключ `--overview`), который появился после решения задачи [#17](https://github.com/Tim55667757/TKSBrokerAPI/issues/17). В секциях лимитных и стоп ордеров в отчёте о состоянии портфеля пользователя отображались только первые ордеры в списке. Сейчас снова отображаются все открытые ордеры. Кроме того, улучшена производительность: теперь для ордеров по одному и тому же инструменту цена запрашивается только один раз, что критично, в случае большого числа открытых ордеров.
* [#81](https://github.com/Tim55667757/TKSBrokerAPI/issues/81) Исправлено отображение дробных чисел при печати биржевого стакана.


### [1.4.90 (2022-11-07)](https://github.com/Tim55667757/TKSBrokerAPI/releases/tag/1.4.90) — опубликована

##### Дайджест
Expand Down
36 changes: 36 additions & 0 deletions CHANGELOG_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,42 @@
* 🎁 Support the project with a donation to our yoomoney-wallet: [410015019068268](https://yoomoney.ru/quickpay/shop-widget?writer=seller&targets=Donat%20(gift)%20for%20the%20authors%20of%20the%20TKSBrokerAPI%20project&default-sum=999&button-text=13&payment-type-choice=on&successURL=https%3A%2F%2Ftim55667757.github.io%2FTKSBrokerAPI%2F&quickpay=shop&account=410015019068268)


### [1.5.* (2022-11-21)](https://github.com/Tim55667757/TKSBrokerAPI/milestone/5) — in progress...

##### Digest

In the next version of TKSBrokerAPI, a new section with a bond payments calendar has appeared in the user's portfolio report. It is built automatically if there is at least one bond in the portfolio (key `--overview-calendar`). The `--html` key was added to save reports in HTML format. In addition, it became possible to close a position and all orders using the `--close-all` key for one instrument specified via `--ticker` or `--figi`.

The trading script [./docs/examples/scenario1.py](https://github.com/Tim55667757/TKSBrokerAPI/blob/master/docs/examples/scenario1.py) has been rewritten in the OOP paradigm: [./docs/examples /scenario1a.py](https://github.com/Tim55667757/TKSBrokerAPI/blob/master/docs/examples/scenario1a.py). Now it is a trading template based on the TKSBrokerAPI platform. It can be used as a basis for developing your own trading scenarios.

An annoying bug has been fixed when trading "on the market" (key `--trade`), when TP/SL orders were opened even if the main market order was not executed. Now, in case of any TP/SL errors, orders are not placed. And also, for the convenience of debugging, you can now specify the `--more` key along with any command. More information will appear in the logs, such as network requests, network responses and their headers.

##### New features

* [#62](https://github.com/Tim55667757/TKSBrokerAPI/issues/62) A bond payment calendar has been added to the user's portfolio status report, which is built automatically if at least one bond is present in the portfolio (method `Overview(details="calendar")`, key `--overview-calendar`).
* [#80](https://github.com/Tim55667757/TKSBrokerAPI/issues/80) Trading script example [./docs/examples/scenario1.py](https://github.com/Tim55667757/TKSBrokerAPI/blob /master/docs/examples/scenario1.py) additionally rewritten in OOP paradigm: [./docs/examples/scenario1a.py](https://github.com/Tim55667757/TKSBrokerAPI/blob/master/docs/examples/scenario1a.py). These templates can be used as a basis for developing your own trading scenarios based on the TKSBrokerAPI platform.
* [#48](https://github.com/Tim55667757/TKSBrokerAPI/issues/48) If the `--close-all` key is specified together with one of the keys `--ticker` or `--figi`, then all unblocked volumes of the open position, pending limit and stop orders for the selected instrument will be closed. To support this feature, additional methods were implemented: `CloseAllByTicker()` for closing all positions and orders for the instrument specified by the ticker, `CloseAllByFIGI()` for closing all positions and orders for the instrument specified by the FIGI identifier, `IsInLimitOrders()` is a function that returns `True` if opened pending limit orders are in the portfolio, `GetLimitOrderIDs()` is a function that returns a list of opened pending limit orders, `IsInStopOrders()` is a function that returns `True` if opened stop orders are in the portfolio, `GetStopOrderIDs()` is a function that returns a list of opened stop orders for the instrument.
* [#83](https://github.com/Tim55667757/TKSBrokerAPI/issues/83) You can now specify the `--html` key to additional generate HTML-reports from Markdown. HTML rendering and key `--html` were implemented for reports created by `--list`, `--info`, `--search`, `--prices`, `--deals`, `--limits`, `--calendar`, `--account`, `--user-info`, `--overview`, `--overview-digest`, `--overview-positions`, `--overview-orders`, `--overview-analytics` and `--overview-calendar` keys. HTML generator based on [Mako Templates library](https://www.makotemplates.org/).
* [#67](https://github.com/Tim55667757/TKSBrokerAPI/issues/67) You can now specify the `--more` key with any other command. It enables more debugging information in all TKSBrokerAPI methods and saves it in the logs. For example, network requests, their responses, and headers are saved.

##### Improvements

* [#74](https://github.com/Tim55667757/TKSBrokerAPI/issues/74) Improved CI/CD script `.travis.yml`. Now, when you run a build from a pull request, only the steps of running unit tests and building the package are performed. And the package do not upload to PyPI. Publishing to PyPI is now only triggered when building directly from a branch or after accepting a pull request.
* [#39](https://github.com/Tim55667757/TKSBrokerAPI/issues/39) Now all operations of closing positions or orders (keys `--close-***`) support the ability to specify instruments not only through tickers, but also via FIGI identifiers.
* [#60](https://github.com/Tim55667757/TKSBrokerAPI/issues/60) The `--ticker` and `--figi` keys are now case-insensitive. You can specify their values in the console in any case, and inside the TKSBrokerAPI platform they will be automatically converted to uppercase.
* [#75](https://github.com/Tim55667757/TKSBrokerAPI/issues/75) If, when launched with the `--limits` key, it turns out that there are no cash limits available for withdrawal, then now an empty table will not be displayed.
* [#68](https://github.com/Tim55667757/TKSBrokerAPI/issues/68) Added information about the stock type to the share report (`ShowInstrumentInfo()` method, `--info` key) about the type of share: Ordinary, Privileged, American Depositary Receipts (ADR), Global Depositary Receipts (GDR), Master Limited Partnership (MLP), New York registered shares, Closed investment fund and Real estate trust.
* [#35](https://github.com/Tim55667757/TKSBrokerAPI/issues/35) Headers have been simplified in the "Summary" table in the deals report (key `--deals`).
* [#51](https://github.com/Tim55667757/TKSBrokerAPI/issues/51) The `NANO` constant, the `NanoToFloat()` and `FloatToNano()` methods have been moved to the new `TradeRoutines` module. This is a library with a set of functions to simplify the implementation of trading strategies based on the TKSBrokerAPI platform.
* [#52](https://github.com/Tim55667757/TKSBrokerAPI/issues/52) The `GetDatesAsString()` method has also been moved to the `TradeRoutines` module.

##### Bug fixes

* [#66](https://github.com/Tim55667757/TKSBrokerAPI/issues/66) Fixed a bug in the `Trade()` method (key `--trade`). Now, if the main market order for an instrument has not been executed, then TP/SL orders are also not placed for this instrument. In previous versions TP/SL orders were opened even in case of errors when opening a market order to which they are linked, which violated the logic of trading scenarios.
* [#84](https://github.com/Tim55667757/TKSBrokerAPI/issues/84) Fixed a bug in the `Overview()` method (key `--overview`), which appeared after solving the task [#17]( https://github.com/Tim55667757/TKSBrokerAPI/issues/17). In the limit and stop orders section of the user's portfolio, only the first orders in the list were displayed. Now all open orders are displayed again. In addition, performance has been improved: now for orders for the same instrument, the price is requested only once, which is critical in the case of a large number of open orders.
* [#81](https://github.com/Tim55667757/TKSBrokerAPI/issues/81) Fixed display of fractional numbers when requesting the order book.


### [1.4.90 (2022-11-07)](https://github.com/Tim55667757/TKSBrokerAPI/releases/tag/1.4.90) — released

##### Digest
Expand Down
1 change: 0 additions & 1 deletion PDocBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@
pdoc.pdoc(
Path("tksbrokerapi").resolve(),
output_directory=Path("docs").resolve(),
format="html",
)
Loading

0 comments on commit 4cd78e5

Please sign in to comment.