icastillejogomez / degiro-api Goto Github PK
View Code? Open in Web Editor NEWUnofficial DeGiro stock broker API. See your portfolio and set up orders in the market like wall street
License: MIT License
Unofficial DeGiro stock broker API. See your portfolio and set up orders in the market like wall street
License: MIT License
Of course delete + create would do the trick. But would it be possible to update an existing order ?
Also, what means execute vs create order in your main readme examples ?
Hi, do you have some ETA for that feature?
Hey hey,
This isn't an issue but a question.
First of all thanks for the great api!
I was wondering if there are any plans to include the real time price updates in this api.
I want to get realtime updates for my positions, including options on the Amsterdam exchange, which a lot of data providers don't have.
I was looking to implement this myself, but I don't even see a websocket or anything the degiro app is fetching data from.
There is no open websocket, no service worker data, nothing.
Do you have any idea how to reverse engineer this?
When searching for "searchProduct" I get undefined instead of an empty array. Working around it with searchProduct(...) || []
for now.
Hi,
I love this project!
Can you elaborate a bit more about the sessionID? Is it just a token that I should store in nodejs memory or whatever for every person that wants to authenticate? So:
Questions about OTP:
I need to be able to get prices, so I figured I'd make an issue with my findings. I'm hoping to be able to submit a PR in a couple days, but if not I'll have all the information I've found documented here.
The URL DEGIRO requests it's data from (on page load) is https://charting.vwdservices.com/hchart/v1/deGiro/data.js?requestid=1&resolution=PT1M&culture=nl-NL&period=P1D&series=issueid%3A198401&series=price%3Aissueid%3A198401&format=json&callback=vwd.hchart.seriesRequestManager.sync_response&userToken=${usertoken}&tz=Europe%2FAmsterdam.
I redacted the user token for now, as I'm not sure if this one is personal or if it's the "user token" for DEGIO at vwdservices. It's a 7-digit number, ending with 821. If someone else runs into this issue, could you let me know if it's the same for you? Then we know it's common to everyone and not variable.
This is a get-request, so all required information is in this URL. I'm assuming there is no cookies involved, as the data is loaded from a 3rd party service.
The two "series" arguments are issueid:${product.vwdId}
and price:issueid:${product.vwdId}
. Although I'm not certain both are required for our (initial) use-case, I'd recommend leaving both in to make the request indistinguishable from what DEGIRO does.
What's interesting though, is that for this request, it doesn't seem like you have to be logged in. This means easier unit testing, also in CI.
To-Do:
My suggestions for implementing this:
Notes:
Callback should be omitted, as that will wrap the result in a function call (to be used with eval). Omitting it returns the raw JSON response.
Hello everyone,
I need to know if is still there any interest in this library in order to refactor it from the base and be able all of use to use it over the years. When I started this a few years ago, I didn't do the base as I should have making the code difficult to maintain. Now, we have the opportunity to refactor the library to provide a better development experience.
If you are open to help me with it please let me know in this issue to coordinate the short-term and mid-term roadmap.
I tried this but i'm stumbled with this error
`$ node get-portfolio.js
C:\Garage\Scripting\node\degiro-api_module\get-portfolio.js:1
import DeGiro, { DeGiroEnums, DeGiroTypes } from 'degiro-api'
^^^^^^
SyntaxError: Cannot use import statement outside a module
?[90m at wrapSafe (internal/modules/cjs/loader.js:1072:16)?[39m
`
I installed it as described in your page and i see that it is installed in my setup
$ npm -g ls C:\Users\arso271062\AppData\Roaming\npm
-- [email protected]
+-- [email protected]
-- [email protected]
my get-portfolio.js contains the source from your site:
`import DeGiro, { DeGiroEnums, DeGiroTypes } from 'degiro-api'
const { PORTFOLIO_POSITIONS_TYPE_ENUM } = DeGiroEnums
(async () => {
const degiro: DeGiro = new DeGiro({
username: 'my username',
pwd: 'password',
})
await degiro.login()
const portfolio = await degiro.getPortfolio({ type: PORTFOLIO_POSITIONS_TYPE_ENUM.ALL })
console.log(JSON.stringify(portfolio, null, 2))
})()`
Please help me what i'm wrong. I'm from Perl bash background and the node enviroment is quite new for me. perhaps I'm using it wrong. I have the git bash for windows environment.
even your example code dont work.
TypeError: DeGiro is not a constructor
For some securities there is a maximum order size allowed by degiro, it returns an error via check checkOrder
like so:
The maximum quantity for market orders on this product is 68. To place an order with a higher quantity, please use the limit order.
Of course I could use a limit order but this is quite annoying, is there a way to figure out the maximum order size somehow?
Hi,
I just got started with DeGiro and this package... and I'm having some problems when using import:
If I try this code:
import DeGiro from "degiro-api";
const username = 'myUsername';
const password = 'myPassword';
const degiro = new DeGiro({ username, password });
I just got the following error:
TypeError: DeGiro is not a constructor
If I opt to use the create
function, like this:
const degiro = DeGiro.create({username, password});
I got this error:
TypeError: DeGiro.create is not a function
I've tried the same code using Node 16.x and 18.x, any idea of what can be the problem?
Thanks for your work!
I am trying to find a way to retrieve all the transactions of an account, not only the orders but also the fees, dividends, ...
Not sure if this is current possible?
https://trader.degiro.nl/reporting/secure/v6/accountoverview
Hello,
If I want to close one of my orders (and so take profit), what should I do in the order param ?
Should I make a Sell Order with "Stop Loss" without indicate the order id ?
And, if I want to sell 50% of my position ?
I don't want a "short order"....
Thanks
First of all: Thanks @icastillejogomez for the API, very useful!
--
Hi all
when retrieving the CASH account data as rows in the PORTFOLIO dataframe like
request_list.values.extend(
[
Update.Request(option=Update.Option.PORTFOLIO, last_updated=0),
]
)
the API seems to return the Cash Account Data from the last cash transfer to the FLATEX account, not the actual value of the Cash Account (i.e. US Dollar, "size" parameter), neither in the baseCurrency nor in the FXCurrency (i.e. EUR, "value" parameter).
The Cash Account (size) could have changed in the meantime because of buy/sell activities, the baseCurrency Value (value) because of changes in the exchange rate. Now, i was wondering if there is a way to retrieve the actual values for both, size and value, or at least the changes since the last transfer to the FLATEX account - i was searching the API doc but was not able to find related information. Maybe someone could give me a hint?
Thanks a lot!
I'm trying to use the api (thank you) and I'm always getting an uncaught exception.
const degiro = new DeGiro.default.create({
username: args[0],
pwd: args[1],
oneTimePassword: args[2]
})
const accountData = await degiro.login()
I've verified the arguments multiple times. Is there something I'm doing wrong?
Output with debug on:
node:internal/process/esm_loader:34 internalBinding('errors').triggerUncaughtException( ^ badCredentials (Use
node --trace-uncaught ...` to show where the exception was thrown)
Node.js v21.2.0
Making request to https://trader.degiro.nl/login/secure/login with options:
{
"method": "POST",
"body": "{"isPassCodeReset":false,"isRedirectToMobile":false,"password":"XXXXX","username":"XXXXX","oneTimePassword":"XXXXX","queryParams":{"reason":"session_expired"}}",
"headers": {
"Content-Type": "application/json"
},
"credentials": "include",
"referer": "https://trader.degiro.nl/trader/"
}
Sending OTP`
After working smoothly for a long time, it stopped working...
some Cloudflare-like protection blocking my requests
https://trader.degiro.nl/myracloud-blocked/?
Ill get a VM24392:1 GET https://trader.degiro.nl/login/secure/config 401 error on login().
`const degiro = new DeGiro({
username: this.username,
pwd: this.pwd,
oneTimePassword: this.oneTimePassword,
});
try {
await degiro.login();
const jsessionId = degiro.getJSESSIONID();
console.log(jsessionId);
} catch (error) {
console.log(error);
}`
I'd like to not prompt my users for username/password if there's still a jsessionid available. However, there's currently an explicit check to verify that an username and password are given.
Is there a reason this check exists (as I'm assuming degiro would check this server-side too), or is it double?
Should the check be removed, stay in place (for a reason unknown to me) and have documentation added, or can the check be wrapped in a if (!this.jsessionId)
?
Hi,
Everything always used to work fine, but for some reason all of a sudden whenever i try to sell a asset (ADYEN) in this case., i always get the error: order.error.default as a return when creating the order.
I currently have 1 position open on adyen (size=1), and try to do SELL 1.
const order = {
buySell: DeGiroActions.SELL,
orderType: DeGiroMarketOrderTypes.MARKET, // LIMITED, MARKET, STOP_LOSS_LIMIT, STOP_LOSS
productId: symbolId,
size: 1,
timeType: DeGiroTimeTypes.PERMANENT,
};
Hi, I've been messing with the API and everything works except creating orders, heres the code I have
try {
let order = {
buySell: DeGiroActions.BUY,
orderType: DeGiroMarketOrderTypes.LIMITED,
productId: productId,
size: quantity,
timeType: DeGiroTimeTypes.DAY,
};
let { confirmationId, freeSpaceNew, transactionFees } = await this.degiro.createOrder(order);
console.log(confirmationId, freeSpaceNew, transactionFees);
// DEBUG: DONT EXECUTE FOR NOW
//await this.degiro.executeOrder(order, confirmationId);
return [true, null];
} catch (err: any) {
return [false, err.message];
}
I verified and each of the members of order
is correct. Most of the time I don't get any errors but nothing happens, sometimes I get 500: Internal Server Error
. If I missed anything please do tell, thanks in advance.
Hi,
I just installed your package and am trying to figure out how it works. I've just started with the basic, trying to login but I'm already stuck there :)
import DeGiro from 'degiro-api'
const degiro = new DeGiro({
username: 'username',
pwd: 'xxxxx'
})
degiro.login()
.then((accountData) => console.log('Log in success\n', accountData))
.catch(console.error)
gives me the following error in chrome console
TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
at Object.default (<anonymous>:1:876)
at eval (login.js?0ff3:36)
at new Promise (<anonymous>)
at Object.loginRequest (login.js?0ff3:15)
at eval (DeGiro.js?1701:59)
at new Promise (<anonymous>)
at DeGiro.login (DeGiro.js?1701:58)
at VueComponent.created (App.vue?234e:19)
at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854)
at callHook (vue.runtime.esm.js?2b0e:4219)
Any idea what I could be doing wrong here?
Kind regards
Hey there, thanks for your work. Could you please publish a version covering the latest state. The current version does not include getTransactions for instance.
Hi icastillejogomez (and soltex1),
Please see the closed issue: "Values from Account Summary" from soltex1
I have the same question as asked in this closed issue.
Can you share the answer or solution to this question?
Or can you indicate where the answer can be found?
I have no idea where to look.
Thank you in advance.
Hi,
I tried to make this code work:
const DeGiro = require('degiro-api').default
const username = 'myUsername';
const password = 'myPassword';
const degiro = new DeGiro({ username, password });
(async() => {
console.log(`Logging in as ${process.env.DEGIRO_USER}...`);
const data = await degiro.login();
const jsessionId = degiro.getJSESSIONID();
console.log(`Logged. Session ID: ${jsessionId}`);
console.log(data);
})()
and got and error telling me that login needed credentials:
Error: DeGiro api needs an password to access
I got the same error when using the create
function.
The only way I've made it work is by using env vars DEGIRO_USER and DEGIRO_PWD.
Any idea about how to make it work with constructor params?
Thanks!
Seems like the library has not been complying to it's own lint rules for a while now. All the errors outputted by the linter are valid.
Non-compliant files are:
These files should be fixed, so the linter can help us decide if PRs are up to code standard more easily.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.