Code Monkey home page Code Monkey logo

degiroapi's People

Contributors

lolokraus avatar pgoslatara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

degiroapi's Issues

Login isses due to Degiro's bot detection

I have started experiencing a "Could not login" error, with the response from the server reading:

         <h2>Reference: CENSORED</h2>
         <h2>Remote IP: CENSORED</h2>
         <h2>Identifier: CENSORED=python_bot</h2>
         <h2>Date: 07/Dec/2022:11:42:43 +0100</h2>

ORder deletion issue

, line 139, in __request
raise Exception(f"{error_message} Response: {response.text}")
Exception: Could not delete order 8cd31821-1c4f-4679-a650-2661b45bfff4 Response: {"errors":[{"text":"translation.label.509"}]}

logout functionality

@lolokraus

Thanks for creating this API! Is there a way to log-out of or end the current DEGIRO user session using this API? If not, could you maybe add a function that can?

Keeping the session alive

I there a way to keep the session alive? How do you guys keep it alive without keep on loggin in ?
I tried this approach but after some login it denies any connection?
My solution is doing timed productr searches with the sole purpose to keep the endpoint alive, but maybe there's a better way to do so.
Thanks in advance.

"Internal Server Error" on buyorder

Hello,

Problem : if you try to execute your buy order whereas you are not log into to degiro since several hours, server replies "Internal Server Error"

Looks very strange because once I'm logged with my browser, python script respond correctly.

Unable to login with degiroapi

Starting from a couple of days, i am not able to login with degiroapi.
I get an html response with the header "You are not supposed to be here"

I've checked my uname and pwd and they are ok.
Does Degiro have blocked the access through APIs?

Error 400 when placing online orders

Hi,
It seems that since May 1st, the URL for placing buy or sell orders is sending back a 400 error code. Degiro may have changed/restricted their API access...

Thanks

Function egg, 2FA, bidprices

Hey Guys,

Thanks a lot for developing this API, it really is a gift from above. You are an angel!
To further improve the security, I was thinking to implement 2FA (à la: https://github.com/pladaria/degiro) and some way of pulling bid prices (ideas?). However the egg thingy prevents me from doing so...
Relatively new to python, but why did you use an egg structure in this context?

Search products

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)
`

Product ID: where can I find this?

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.

search_products doesn't work for finding a symbol

I'm using: degiro.search_products('ACWI')

And the result is:

[{
	'id': '1523265',
	'name': 'SPDR MSCI ACWI ETF',
	'isin': 'IE00B44Z5B48',
	'symbol': 'SPYY',
	'contractSize': 1.0,
	'productType': 'ETF',
	'productTypeId': 131,
	'tradable': True,
	'category': 'G',
	'currency': 'EUR',
	'exchangeId': '194',
	'orderTimeTypes': ['DAY', 'GTC'],
	'gtcAllowed': True,
	'buyOrderTypes': ['LIMIT', 'MARKET', 'STOPLOSS', 'STOPLIMIT', 'TRAILINGSTOP'],
	'sellOrderTypes': ['LIMIT', 'MARKET', 'STOPLOSS', 'STOPLIMIT', 'TRAILINGSTOP'],
	'productBitTypes': [],
	'marketAllowed': True,
	'limitHitOrderAllowed': False,
	'stoplossAllowed': True,
	'stopLimitOrderAllowed': True,
	'joinOrderAllowed': False,
	'trailingStopOrderAllowed': True,
	'combinedOrderAllowed': False,
	'sellAmountAllowed': False,
	'isFund': False,
	'closePrice': 123.42,
	'closePriceDate': '2020-06-23',
	'feedQuality': 'D15',
	'orderBookDepth': 0,
	'vwdIdentifierType': 'issueid',
	'vwdId': '480012585',
	'qualitySwitchable': False,
	'qualitySwitchFree': False,
	'vwdModuleId': 25
}]

I would expect to also find LYXOR MSCI ALL COUNTRY which has the symbol ACWI

Exception: Could not login.

Hi folks!

The Login doesn't work, I get the Exception Could not login and a HTML Response.

Can you fix it?

delete order is not working properly

I would like to delete any open orders without indicating the order ID.
The code is shown in the picture.

Deleting with order ID is working just fine.

But I want to delete all open orders that are made within 24 hours, regardless the order ID.
I think the written code should serve this purpose. But it doesnt work.

Please help!

Screenshot 2021-07-01 193652

Close Position function

Hello.

There isn't any function for closing a position. I am trying to improvise a function which gets the position size and direction of the ticker requested to put a marketorder of the oposite direction (if you where long then a short order) with the same size. But in your portfolio function there is no way to get the direction of the position, so I get the long or short bias by the sign of price minus break even price. If the sign is negative it is long, if positive it is short.
If you could do a specific function for this it would be really helpfull.

Thank you for all the work.

not able to login anymore

I noticed today that I'm not able to login anymore. I get the error "You are not supposed to be here".
I tried login in on the website manually with the same login/password, working without a problem.

Is this something on my side or did DeGiro change something in the API?

CAN'T LOGIN ANYMORE

Exception: Could not login. Response: <title>Blocked</title> <style> body { font: 16px/18px Helvetica, Arial, sans-serif; margin: 0 } div.logo { width: 100%; height: 140px } .heading { background-color: #ECECEC } .logo img { display: block; width: 160px; margin: 0 auto; padding-top: 30px } h1 { margin: 0; padding: 95px 0; text-align: center; color: #5E5D5D; font-weight: lighter; font-size: 40px; letter-spacing: .03em; line-height: 40px } h2 { margin: 0; padding: 25px 0; text-align: center; color: #6B6D6D; font-weight: lighter; font-size: 20px } </style> <style> @font-face { font-family: myracloud; src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SAzMAAAC8AAAAYGNtYXAaVcxgAAABHAAAAExnYXNwAAAAEAAAAWgAAAAIZ2x5Zj5lif4AAAFwAAAFNGhlYWQFw12RAAAGpAAAADZoaGVhB8MDpAAABtwAAAAkaG10eCoDAP0AAAcAAAAAOGxvY2EJSggGAAAHOAAAAB5tYXhwABIAUAAAB1gAAAAgbmFtZd2kOzUAAAd4AAABV3Bvc3QAAwAAAAAI0AAAACAAAwQAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADmCQPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAACAAAAAwAAABQAAwABAAAAFAAEADgAAAAKAAgAAgACAAEAIOYJ//3//wAAAAAAIOYA//3//wAB/+MaBAADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAv/VAI0EKwQ3AEEARgAAAxE0NzYzITIXFhURFAcGIyEiFxQXFhcWFxYXFhcWMzIzNzIVFCMhIicmNzYzFzIzMjc2NzY3Njc2NzY9ASEiJyY1NyERIRErExMaA9YaExMSExv+lQEBBAUGBwoKCQkLCwcHBwgJCf4jBgICAgIGCAgGBwsLCAkKCgcGBQT+lRsTElYDqvxWAUcCsBsTEhITG/1QGxAPKw8MDQcIBQYCAwEBAQcGAwMDBAEBAQMCBgUIBw0MDysPEBubAgD+AAAAAAL/9QCCBAsEmAAgAE0AAAM0NzY3Njc2MzIXFhcWFxYVFAcGBwYHBiMiJyYnJicmNQUUHwEWMzI/ARcWMzI/ATY1NC8BNzY1N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NCcBJiIHBhQfASEiBhUUFjMhBw4BFRQWFxYyNwJtAUATE/7AEjYSExPS/ZsbJSUbAmXSCgkJChI2ElMBQBI2EgFAExMSNhLTJRsbJdMJGAwMGAkTEwAAAAEAUwBTA8ADLQAeAAAlASY0NwE2MhcWFA8BITIWFRQGIyEXHgEVFAYHBiInAZP+wBMTAUASNhITE9ICZRslJRv9m9IKCQkKEjYSUwFAEjYSAUATExI2EtMlGxsl0wkYDAwYCRMTAAAAAQAAAAEAADGB+rhfDzz1AAsEAAAAAADRUov+AAAAANFSi/7/1QAABCsEmAAAAAgAAgAAAAAAAAABAAADwP/AAAAEAP/V/9UEKwABAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAIAAAAEAP/VBAD/9QQA//UEAABWBAAAVQQAAAAEAAAABAAAAAQAAEAEAABTAAAAAAAKABQAHgCGAPgBWAGGAbQB2AH6AjICZgKaAAAAAQAAAA4ATgADAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABABIAAAABAAAAAAACAA4AVQABAAAAAAADABIAKAABAAAAAAAEABIAYwABAAAAAAAFABYAEgABAAAAAAAGAAkAOgABAAAAAAAKADQAdQADAAEECQABABIAAAADAAEECQACAA4AVQADAAEECQADABIAKAADAAEECQAEABIAYwADAAEECQAFABYAEgADAAEECQAGABIAQwADAAEECQAKADQAdQBtAHkAcgBhAGMAbABvAHUAZABWAGUAcgBzAGkAbwBuACAAMQAuADAAbQB5AHIAYQBjAGwAbwB1AGRteXJhY2xvdWQAbQB5AHIAYQBjAGwAbwB1AGQAUgBlAGcAdQBsAGEAcgBtAHkAcgBhAGMAbABvAHUAZABGAG8AbgB0ACAAZwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABJAGMAbwBNAG8AbwBuAC4AAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=) format('truetype'); font-weight: 400; font-style: normal } </style>

DEGIRO logo

You are not supposed to be here

Reference: 289372ae483854c2d262b633acdbfd22

Remote IP: 88.xxx.xxx.xxx

Identifier: 69f25a1512df4531acb32e9e6e22f3cd=python_bot

Date: 10/Dec/2022:22:23:37 +0100

Product without closePrice

Hello,

Some products don't have "closePrise" so it triggers "KeyError".
Fix in product.py (self.__close_price, self.__close_price_date)

Test isin : DE000KB32F85

Thanks

Migrated work over to new repository.

Hello all,

I think most of you have seen that the number of issues and pull requests have been growing since a year without any action being taken by the original author.
Its a shame as it is the best API out on pypi currently.
Therefore, I forked this repo and made some refactoring and introduced some functionality for ones working on the project.
Furthermore, I also tried to add as many of the pull requests open here as well as you can see here:
https://github.com/Jorricks/python-degiro/releases/tag/v0.0.1

Please let me know if I missed one and you think I should still add it.
The new repository can be found here:
https://github.com/Jorricks/python-degiro

It can be found on pypi here:
https://pypi.org/project/python-degiro/

error: 'builtin_function_or_method' object has no attribute 'account_id'

Full error report:


AttributeError                            Traceback (most recent call last)
<ipython-input-5-a7fa621863e8> in <module>
     10 startdate = datetime(2020,10,26)
     11 enddate = datetime.now()
---> 12 df_transactions = degiro.transactions(startdate, enddate)
     13 
     14 degiro.logout() # log uit from degiro

~\Anaconda3\lib\site-packages\degiroapi\__init__.py in transactions(self, from_date, to_date, group_transactions)
    122             'toDate': to_date.strftime('%d/%m/%Y'),
    123             'group_transactions_by_order': group_transactions,
--> 124             'intAccount': self.client_info.account_id,
    125             'sessionId': self.session_id
    126         }

AttributeError: 'builtin_function_or_method' object has no attribute 'account_id'

Deleting order

When the API delete an order, will the order sell? Will the profit be put in my account?

degiro.get_stock_list

Hello!
degiro.get_stock_list(14, 846)

I am a beginner and would like to know, how i could to find out what parameter corresponds to numbers?.
eg. if i want list all usa nasdaq companies.

Real time price

Hi folks, can you tell me how can i get the real time price of one product, for example APPLE?

I only can see the closing price.

Thank you

DegiroApi - Could not login.

Hello Houston,
It seems that we have a problem connecting.
Since today connections fail to DEGIRO using DegiroAPI.
I receive an exception message:

login_response = self.__request(DeGiro.__LOGIN_URL, None, login_payload, request_type=DeGiro.__POST_REQUEST,
45 error_message='Could not login.')
46 self.session_id = login_response['sessionId']
47 client_info_payload = {'sessionId': self.session_id}

You are not supposed to be here

I would except to be not alone with this error message.
Br,

How to get product ID from ISIN?

I'm trading most of the time only turbos, so it doesnt have a name only ISIN.

How to get product ID from an ISIN?

for example what is the product ID of DE000KE04K89 ?

Now I just create fake order and get the order list with python then I can see the product ID. But there should be a smarter way.

Please help, it means a lot to me.

Get Total P/L, Portfolio, etc...

Hi, is there a possibility to get all the "header info", not just EUR (Data.Type.CASHFUNDS)

I would like to log the Positive/Negative outcome of my investing which is in "Total P/L". Or the actual size of my portfolio.
Right now I have to download all Data.Type.PORTFOLIO, iterate over everything and sum it up.

Error installing degiroapi

Hi!
I recive that error while trying to install degiroapi....

ERROR: Could not find a version that satisfies the requirement degiroapi (from versions: none)
ERROR: No matching distribution found for degiroapi

Can you help me please.

Thanks !

degiro.orders - 404 error

A piece of code that used to work seems to have broken. Maybe it´s just a tempoary issue with the API though.

python orders = degiro.orders(datetime.now() - timedelta(days=10), datetime.now())

Gets the following:

Could not get orders. Response:
html <!doctype html><html lang="en"><head><title>HTTP Status 404 – Not Found</title><style type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}</style></head><body><h1>HTTP Status 404 – Not Found</h1></body></html>

Does anyone else get that, too?

Unrelated: After sending off orders, I´m trying to confirm when orders are executed, but find it quite cumbersome, polling the transactions. Has anyone a good solution?

how to find indexId, stockCountryId ?

for example for s&p 500 stock list

sp5symbols = []
products = degiro.get_stock_list(14, 846)# get s&p 500 stock list

def get_stock_list(self, indexId, stockCountryId):

stock_list_params = {

'indexId': indexId,

'stockCountryId': stockCountryId,

'offset': 0,

'limit': None,

'requireTotal': "true",

'sortColumns': "name",

'sortTypes': "asc",

'intAccount': self.client_info.account_id,

'sessionId': self.session_id

New header error

I've been using this script for months and now I get this:

Header part (111028490) from {'intAccount': 111xxxxxxx} must be of type str or bytes, not <class 'int'>

in the buyorder function

Average purchase price

Great API, kudo's.

Via the website of Degiro, when browsing to Portfolio, I can see the average purchase price of each asset. Can I get this information as well using your API? Couldn't find the correct query.

KeyError: 'vwdId' with the response

This seems to be a new issue only started over the weekend and only effects some shares.

It works if I check Tesla and other shares

degiro = degiroapi.DeGiro()
degiro.login(USERNAME, PASSWORD)

products = degiro.search_products('TSLA')
realprice = degiro.real_time_price(Product(products[0]).id, degiroapi.Interval.Type.One_Day)

print(realprice[0])

Now this is probably a change on Degiros part but if I check this share Glanbia

degiro = degiroapi.DeGiro()
degiro.login(USERNAME, PASSWORD)

products = degiro.search_products('GL9')
realprice = degiro.real_time_price(Product(products[0]).id, degiroapi.Interval.Type.One_Day)

print(realprice[0])
Traceback (most recent call last):

  File "send_mail.py", line 4, in <module>
    import share_details
  File "/home/myacc/projects/degiroholdings/share_details.py", line 99, in <module>
    sh.main()
  File "/home/myacc/projects/degiroholdings/share_details.py", line 23, in main
    self.get_shares()
  File "/home/myacc/projects/degiroholdings/share_details.py", line 44, in get_shares
    realprice = self.degiro.real_time_price(Product(products[0]).id, degiroapi.Interval.Type.One_Day)
  File "/usr/local/lib/python3.7/dist-packages/degiroapi/__init__.py", line 221, in real_time_price
    vw_id = self.product_info(product_id)['vwdId']
KeyError: 'vwdId'

The response doesn't seem to have a key 'vwdId'

Share Details:
SHARES
IRL | GL9 | IE0000669501 | EUR | ED
GLANBIA PLC

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.