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
26 stars 9 forks source link

Add to the `ShowInstrumentInfo()` method ability to output information to the file define by key `--output` #37

Closed Tim55667757 closed 2 years ago

Tim55667757 commented 2 years ago

Add to the ShowInstrumentInfo() method ability to output information to the file define by key --output.

Also, change the example for --info key in READMEs.

Tim55667757 commented 2 years ago

Implemented in #9. Now you can use the --output key and define the file name where to save the received information. By default, the results are stored in info.md.

Example:

$ tksbrokerapi -v 10 --ticker IBM --info --output IBM-info.md

TKSBrokerAPI.py     L:3992 DEBUG   [2022-10-28 01:47:52,384] >>> TKSBrokerAPI module started at: [2022-10-27 22:47:52] UTC, it is [2022-10-28 01:47:52] local time
TKSBrokerAPI.py     L:4006 DEBUG   [2022-10-28 01:47:52,385] TKSBrokerAPI major.minor.build version used: [1.3.dev77]
TKSBrokerAPI.py     L:4007 DEBUG   [2022-10-28 01:47:52,385] Host CPU count: [8]
TKSBrokerAPI.py     L:210  DEBUG   [2022-10-28 01:47:52,385] Bearer token for Tinkoff OpenAPI set up from environment variable `TKS_API_TOKEN`. See https://tinkoff.github.io/investAPI/token/
TKSBrokerAPI.py     L:223  DEBUG   [2022-10-28 01:47:52,385] Main account ID [**********] set up from environment variable `TKS_ACCOUNT_ID`
TKSBrokerAPI.py     L:272  DEBUG   [2022-10-28 01:47:52,385] Broker API server: https://invest-public-api.tinkoff.ru/rest
TKSBrokerAPI.py     L:408  DEBUG   [2022-10-28 01:47:52,407] Local cache with raw instruments data is used: [/Users/tim/projects/TKSBrokerAPI/tksbrokerapi/dump.json]
TKSBrokerAPI.py     L:409  DEBUG   [2022-10-28 01:47:52,407] Dump file was last modified [2022-10-27 20:31:18] UTC
TKSBrokerAPI.py     L:1047 DEBUG   [2022-10-28 01:47:52,407] Requesting current prices for instrument with ticker [IBM] and FIGI [BBG000BLNNH6]. Wait, please...
TKSBrokerAPI.py     L:1366 DEBUG   [2022-10-28 01:47:52,533] Requesting current trading status, FIGI: [BBG000BLNNH6]. Wait, please...
TKSBrokerAPI.py     L:1372 DEBUG   [2022-10-28 01:47:52,628] Records about current trading status successfully received
TKSBrokerAPI.py     L:843  INFO    [2022-10-28 01:47:52,628] # Main information: ticker [IBM], FIGI [BBG000BLNNH6]

* Actual at: [2022-10-27 22:47] (UTC)

| Parameters                                              | Values                                                  |
|---------------------------------------------------------|---------------------------------------------------------|
| Ticker:                                                 | IBM                                                     |
| Full name:                                              | IBM                                                     |
| Sector:                                                 | it                                                      |
| Country of instrument:                                  | (US) Соединенные Штаты Америки                          |
|                                                         |                                                         |
| FIGI (Financial Instrument Global Identifier):          | BBG000BLNNH6                                            |
| Exchange:                                               | SPB_MORNING                                             |
| ISIN (International Securities Identification Number):  | US4592001014                                            |
| Class Code:                                             | SPBXM                                                   |
|                                                         |                                                         |
| Current broker security trading status:                 | Normal trading                                          |
|                                                         |                                                         |
| Buy operations allowed:                                 | Yes                                                     |
| Sale operations allowed:                                | Yes                                                     |
| Short positions allowed:                                | No                                                      |
|                                                         |                                                         |
| Limit orders allowed:                                   | No                                                      |
| Market orders allowed:                                  | No                                                      |
| API trade allowed:                                      | Yes                                                     |
|                                                         |                                                         |
| Type of the instrument:                                 | Shares                                                  |
| IPO date:                                               | 1915-11-11 00:00:00                                     |
| Payment currency:                                       | usd                                                     |
|                                                         |                                                         |
| Previous close price of the instrument:                 | 134.77 usd                                              |
| Last deal price of the instrument:                      | 134.5 usd                                               |
| Changes between last deal price and last close  %       | -0.20                                                   |
| Current limit price, min / max:                         | 132.87 usd / 136.13 usd                                 |
| Actual price, sell / buy:                               | N/A usd / N/A usd                                       |
| Minimum lot to buy:                                     | 1                                                       |
| Minimum price increment (step):                         | 0.01                                                    |

TKSBrokerAPI.py     L:852  INFO    [2022-10-28 01:47:52,629] Info about instrument with ticker [IBM] and FIGI [BBG000BLNNH6] was saved to file: [IBM-info.md]
TKSBrokerAPI.py     L:4329 DEBUG   [2022-10-28 01:47:52,629] All operations were finished success (summary code is 0).
TKSBrokerAPI.py     L:4336 DEBUG   [2022-10-28 01:47:52,629] >>> TKSBrokerAPI module work duration: [0:00:00.245039]
TKSBrokerAPI.py     L:4337 DEBUG   [2022-10-28 01:47:52,629] >>> TKSBrokerAPI module finished: [2022-10-27 22:47:52 UTC], it is [2022-10-28 01:47:52] local time