Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search products #55

Open
AureliusMarcusHu opened this issue Nov 30, 2022 · 1 comment
Open

Search products #55

AureliusMarcusHu opened this issue Nov 30, 2022 · 1 comment

Comments

@AureliusMarcusHu
Copy link

AureliusMarcusHu commented Nov 30, 2022

The code below works, that's not the problem. My problem is: there is always only one element in the list of dicts.
While some the isin code will be traded on different exchanges, you will expect that there are more elements in the list.
But it is not. How i search a product by isin on a specific exchange. For example: below a copy from deGiro.
As You can see: name, isin and symbol are the same, the only difference is the exchange. How I search the product traded on the Milan exchange ?

example

`
def login():
global dgr
dgr = degiroapi.DeGiro()
dgr.login("nnnnn", "xxxxxx")

prdcts = dgr.search_products(isin)
for prd in prdcts:
print(prd)
`

@Jakub-CZ
Copy link

When you examine the products returned by search_products, you'll notice different value of exchangeId in each of them.

The meaning of those IDs can be found here: https://trader.degiro.nl/product_search/config/dictionary. With that, you can simply loop through the products until you find the one whose exchangeId matches the exchange that you want.

For myself and others, I've added this functionality to my fork of this abandoned project: Jakub-CZ@2f89f91

My latest version can be installed like this:

pip install -U git+https://github.com/Jakub-CZ/DegiroAPI.git

A little demo:

dgr = degiroapi.DeGiro()
...
print(dgr.id_dictionary["exchanges"]['196'])
prods = dgr.search_products("DE0005785604", limit=10)
print(tabulate([(p["id"], p["name"], dgr.id_dictionary["exchanges"][p["exchangeId"]]["name"]) for p in prods],
               tablefmt="fancy_grid"))
{'id': 196, 'code': 'XGAT', 'hiqAbbr': 'TDG', 'country': 'DE', 'city': 'Frankfurt', 'micCode': 'XGAT',
 'name': 'Tradegate AG'}
╒══════════╤════════════════════════╤═══════════════════════╕
│ 19747326 │ Fresenius SE & Co KGaA │ Tradegate AG          │
├──────────┼────────────────────────┼───────────────────────┤
│     3959 │ Fresenius SE & Co KGaA │ Xetra                 │
├──────────┼────────────────────────┼───────────────────────┤
│  8368522 │ Fresenius SE & Co KGaA │ Borse Frankfurt       │
├──────────┼────────────────────────┼───────────────────────┤
│ 10902626 │ Fresenius SE & Co KGaA │ Borsa Italiana S.p.A. │
╘══════════╧════════════════════════╧═══════════════════════╛

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants