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

Product ID: where can I find this? #42

Open
Hobbes0011 opened this issue Sep 6, 2021 · 3 comments
Open

Product ID: where can I find this? #42

Hobbes0011 opened this issue Sep 6, 2021 · 3 comments

Comments

@Hobbes0011
Copy link

I'm using search_products to look up a list of stocks. I tried to use the ISIN as the search key, but it seems that's not a unique number (the lookup yields the same stock on multiple stock exchanges). So if I want a specific exchange, I need to search via the product ID instead. I don't see this ID listed on the product page. Is it part of the URL?

example:
https://trader.degiro.nl/trader/#/products/14625503/overview -> product ID=14625503?
this seems to check out for the examples I've tried, but I'd like to make sure.

@Hobbes0011
Copy link
Author

I tried searching for a product ID:

test = degiro.search_products(1133191)      
print(Product(test[0]).id)

but that returns an error:

test = degiro.search_products(1133191)
  File "/Users/***/Library/Python/3.8/lib/python/site-packages/degiroapi/__init__.py", line 105, in search_products
    return self.__request(DeGiro.__PRODUCT_SEARCH_URL, None, product_search_payload,
KeyError: 'products'

Is there a way to search for a product by ID?

@Hobbes0011
Copy link
Author

As a workaround, I'm doing a search by ISIN. Then I check all of the results to find the product ID I want:

products = degiro.search_products('Autodesk',10)
            for prod in products:    
                if prod['id'] == uid:

@jholdorff
Copy link

I wonder what you are trying to do?
I would say the "Search Products" function is mainly to find the product ID.
If you are looking for the product ID of a stock with a specific exchange, the exchange ID can be used.

For example, in my case, I want to buy German stock from Tradegate.
I know that Tradegate has the stock exchange number 196.
So if I want to buy a German stock, I do the following:

products = degiro.search_products('DE000BASF111',5)
for product in products:
if product['exchangeId'] == '196':
uid = product['id']

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