Comments (1)
Added the ability to search for an instrument by part of the name, ticker or FIGI with--search
key (or -s
). A method for searching SearchInstruments()
has been implemented, to which a search pattern can be passed as input: part of a word or a string with a regular expression. As a result, the method returns a dictionary of dictionaries, similar to variable iList
, but containing only found instruments.
- Implemented since dev-build: https://pypi.org/project/tksbrokerapi/1.2.dev50/
- Examples: https://github.com/Tim55667757/TKSBrokerAPI/blob/develop/README_EN.md#Find-an-instrument
Find an instrument
To work with exchange instruments, receive information on them, request prices and make deals, you usually need to specify a ticker (key --ticker
) or FIGI (key --figi
). But there are hardly many people who know them by heart. Most often, there is only an assumption about a part of the ticker or the name of the company. In this case, you can use the search by pattern: part of the name, ticker or FIGI, or by specifying a regular expression. The search is performed by the standard python module re
, case-insensitive.
Starting with TKSBrokerAPI v1.2.*, the --search
key has been added, after which you need to specify the pattern. For example, you want to find all the instruments of the Russian Sber group of companies, then you can try to specify a part of the word: tksbrokerapi --search "sber"
. Or you want to know all the instruments of companies whose names contain the word "United" with "medical" or "rent". In this case, you can try to specify a regular expression: tksbrokerapi --search "(United.*).*(?:.*medical|rent)"
.
In addition to the --search
key, you can specify the --output
key and define the file name where to save the search results. By default, full search results are stored in search-results.md
. Only the first 5 found instruments of each type are shown in the console.
After the desired instrument has been found and its ticker and FIGI have become known, you can view more detailed information with the command tksbrokerapi -t TICKER --info
or tksbrokerapi -f FIGI --info
(more).
Command to search for an instrument by part of its name
$ tksbrokerapi --search "sber"
TKSBrokerAPI.py L:1067 INFO [2022-08-11 23:42:54,569] # Search results
* **Search pattern:** [sber]
* **Found instruments:** [7]
**Note:** you can view info about found instruments with key `--info`, e.g.: `tksbrokerapi -t TICKER --info` or `tksbrokerapi -f FIGI --info`.
### Shares: [3]
| Type | Ticker | Full name | FIGI |
|------------|--------------|----------------------------------------------------------------|--------------|
| Shares | SBER | Сбер Банк | BBG004730N88 |
| Shares | SBERP | Сбер Банк - привилегированные акции | BBG0047315Y7 |
| Shares | SBER@GS | Sberbank of Russia PJSC | BBG001VBZR00 |
### Bonds: [4]
| Type | Ticker | Full name | FIGI |
|------------|--------------|----------------------------------------------------------------|--------------|
| Bonds | RU000A102CU4 | Сбер Банк 001P-SBER19 | BBG00Y9B45C2 |
| Bonds | RU000A102RS6 | Сбер Банк 001P-SBER24 | BBG00ZZ927H8 |
| Bonds | RU000A101C89 | Сбер Банк 001P-SBER15 | BBG00RKBQ4D2 |
| Bonds | RU000A103G75 | Сбер Банк 001P-SBER32 | BBG0122KNFZ0 |
TKSBrokerAPI.py L:1068 INFO [2022-08-11 23:42:54,569] You can view info about found instruments with key `--info`, e.g.: `tksbrokerapi -t IBM --info` or `tksbrokerapi -f BBG000BLNNH6 --info`
TKSBrokerAPI.py L:1074 INFO [2022-08-11 23:42:54,569] Full search results were saved to file: [search-results.md]
Command to search for an instrument by regular expression
$ tksbrokerapi --search "(United.*).*(?:.*medical|rent)"
TKSBrokerAPI.py L:1067 INFO [2022-08-12 00:08:08,944] # Search results
* **Search pattern:** [(United.*).*(?:.*medical|rent)]
* **Found instruments:** [2]
**Note:** you can view info about found instruments with key `--info`, e.g.: `tksbrokerapi -t TICKER --info` or `tksbrokerapi -f FIGI --info`.
### Shares: [2]
| Type | Ticker | Full name | FIGI |
|------------|--------------|----------------------------------------------------------------|--------------|
| Shares | GEMC | United medical group | BBG011MCM288 |
| Shares | URI | United Rentals | BBG000BXMFC3 |
TKSBrokerAPI.py L:1068 INFO [2022-08-12 00:08:08,944] You can view info about found instruments with key `--info`, e.g.: `tksbrokerapi -t IBM --info` or `tksbrokerapi -f BBG000BLNNH6 --info`
TKSBrokerAPI.py L:1074 INFO [2022-08-12 00:08:08,945] Full search results were saved to file: [search-results.md]
from tksbrokerapi.
Related Issues (20)
- Implement bool filter with Rules for Opening/Closing positions by fuzzy Risk/Reach levels HOT 3
- Implement methods for calculation fuzzy Risk and fuzzy Reach levels HOT 3
- Implement new scenario example: detect anomaly volumes of Buyers/Sellers in the order book and send TG notifications HOT 15
- KeyError: 'candles' when download some histories HOT 1
- KeyError: 'convertible_bonds' when request user info HOT 1
- ModuleNotFoundError: No module named 'Templates' HOT 2
- Bug: `ValueError: Given date string *** not likely a datetime present at position ***` HOT 1
- Incorrect values in `view["stat"]["funds"]` record HOT 1
- KeyError: 'OPERATION_TYPE_OUT_STAMP_DUTY' in `TKS_OPERATION_TYPES` constant HOT 1
- Update operation type counts in Deals report HOT 1
- KeyError: 'name' occurred in `Overview()` method HOT 1
- `RUB000UTSTOM` FIGI not in dump.json HOT 1
- Add round to `History()` method when save as CSV-file
- Ошибка при запуске скрипта ТГ-бота HOT 3
- trader.Overview HOT 4
- No module named 'Templates' HOT 2
- TypeError during `--bonds-xlsx` request HOT 1
- Error
- KeyError: 'name'
- TKSBrokerAPI- 1,6 Telegram API HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tksbrokerapi.