Closed lbaligand closed 4 years ago
2 functions added: get historical transactions and get product info by ids
This should fix #10
I've tested this using the pip install from git and used the following in a clean virtual env:
$ pip install git+https://github.com/pykcel/degiro.git
Collecting git+https://github.com/pykcel/degiro.git
Cloning https://github.com/pykcel/degiro.git to /tmp/pip-req-build-89yd3dtv
Running command git clone -q https://github.com/pykcel/degiro.git /tmp/pip-req-build-89yd3dtv
Collecting requests==2.23.0
Using cached requests-2.23.0-py2.py3-none-any.whl (58 kB)
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
Downloading urllib3-1.25.9-py2.py3-none-any.whl (126 kB)
|████████████████████████████████| 126 kB 5.5 MB/s
Collecting chardet<4,>=3.0.2
Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting certifi>=2017.4.17
Downloading certifi-2020.4.5.2-py2.py3-none-any.whl (157 kB)
|████████████████████████████████| 157 kB 8.1 MB/s
Collecting idna<3,>=2.5
Using cached idna-2.9-py2.py3-none-any.whl (58 kB)
Building wheels for collected packages: degiro
Building wheel for degiro (setup.py) ... done
Created wheel for degiro: filename=degiro-0.1.0-py3-none-any.whl size=3905 sha256=bbb2f630f9d153666c5bfd01b48dfef2df3a12f78db27ffe7b7dd9170cb785a4
Stored in directory: /tmp/pip-ephem-wheel-cache-k0tctbdi/wheels/28/ee/d8/cd992efd2f5ecab798cf28249cd759bc254f5c276f47c1a879
Successfully built degiro
Installing collected packages: urllib3, chardet, certifi, idna, requests, degiro
Successfully installed certifi-2020.4.5.2 chardet-3.0.4 degiro-0.1.0 idna-2.9 requests-2.23.0 urllib3-1.25.9
$ python
Python 3.8.3 (default, May 17 2020, 18:15:42)
[GCC 10.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from degiro import degiro
>>> la = degiro()
>>> la.login('config.json', with2fa=True)
2FA Token:
Login
Status code: 200
Session id: 66F5********0EBEB.prod_a_###_#
>>> la.getConfig()
Get config
Status code: 200
Account id: #2####7
>>> pfs = la.getPortfolioSummary()
Get data
Status code: 200
Getting extra data
Status code: 200
>>> portfolio = la.getPortfolio()
Getting extra data
Status code: 200
>>>
Works like a charm!
I also played with the la.getTransactions(fromDate='01/01/2020', toDate='18/06/2020'
I would suggest returning like this: return data['data']
otherwise everyone needs to add that to their code which is not necessary.
Same story for the getProductsByIds:
>>> la.getProductByIds(ids=[11008881])
Get Products info for [11008881]
Status code: 200
{'data': {'11008881': {'id': '11008881', 'name': 'ING Groep', 'isin': 'NL0011821202', 'symbol': 'INGA',
...
>>> la.getProductByIds(ids=[11008881])['data']
Get Products info for [11008881]
Status code: 200
{'11008881': {'id': '11008881', 'name': 'ING Groep', 'isin': 'NL0011821202', 'symbol': 'INGA',
(also tested a list of multiple ids, and works as expected)
Please extract the data in the function so that others don't have to.
Awesome 👍
Add setup and requirements to enable module import #9