DeGiro API
This is an unofficial Node.js API client for DeGiro's trading platform. Using this module you can easily automate your orders (buy and sell) and get information about orders, funds or products.
DeGiro is Europe's fastest growing online stockbroker. DeGiro distinguishes itself by offering institutional fees to retail investors.
⚠️ DeGiro could change their API at any moment, if something is not working, please open an issue.
Install
# using npm npm install --save degiro # using yarn yarn add degiro
Examples
create
const DeGiro = ;const degiro = DeGiro;
You can also provide your user and pass via environment variables:
// run as:// DEGIRO_USER=johndoe DEGIRO_PASS=1234 node app.js const DeGiro = ;// now you don't need to provide your credentialsconst degiro = DeGiro;
login
Performs the login to DeGiro using the username and password and gets a new session id and the account number.
degiro;// prints session info (session id and account number)
Two factor authentication is also supported. Pass the 2fa token through javascript or as an environment variable.
const DeGiro = ;// alternatively run as:// DEGIRO_USER=johndoe DEGIRO_PASS=1234 DEGIRO_ONE_TIME_PASS=123456 node app.jsconst degiro = DeGiro;
You can reuse your sessions if you provide the id and account number via environment variables (DEGIRO_SID
and DEGIRO_ACCOUNT
), direct assignment or constructor parameters.
// set session info via constructorconst degiro = DeGiro; // set session assigning session variablesdegirosessionid = 'your-session-id';degirosessionaccount = 'your-account-number';
getCashFunds
degiro;// {// cashFunds: [// {id: '2', name: 'EUR', value: 1935.8, valueBaseCurr: 1935.8, rate: 1},// {id: '9885', name: 'USD', value: 0, valueBaseCurr: 0, rate: 0.9102},// ...// ]// }
getPortfolio
degiro;// {// "portfolio": [// {// "name": "positionrow",// "id": 1156604,// "value": [// {// "name": "id",// "value": "1156604",// "isAdded": true// },// {// "name": "product",// "value": "DEUTSCHE BANK AG COMMO",// "isAdded": true// },// ...
setOrder (buy/sell)
This example sets a permanent buy order 10 Google shares at a fixed price of $900
degiro ; // prints the order id
This example sets a sell order of 5 Google shares at market price
degiro ; // prints the order id
Order options
orderType
: number- DeGiro.OrderTypes.limited
- DeGiro.OrderTypes.marketOrder
- DeGiro.OrderTypes.stopLoss
- DeGiro.OrderTypes.stopLimited
productId
: stringtimeType
: number- DeGiro.TimeTypes.day
- DeGiro.TimeTypes.permanent
price
: number - Required forlimited
andstopLimited
orderssize
: number - Order sizestopPrice
: number - Required forstopLoss
andstopLimited
orders
searchProduct
degiro);/*{ offset: 0, products: [ { vwdIdentifierType: 'issueid', productTypeId: 1, symbol: 'GOOGL', tradable: true, marketAllowed: true, sellAmountAllowed: true, orderBookDepth: 0, joinOrderAllowed: false, vwdId: '350009261', contractSize: 1, isFund: false, stopLimitOrderAllowed: true, putCall: '0', currency: 'USD', id: '8066561', category: 'A', limitHitOrderAllowed: false, feedQuality: 'D15', stoplossAllowed: true, name: 'ALPHABET INC. - CLASS', gtcAllowed: true, exchangeId: '663', isin: 'US02079K3059' }, ...*/
Search options
text
string - Search term. For example: "Netflix" or "NFLX"productType
number - SeeDeGiro.ProductTypes
. Defaults toall
sortColumn
number - Column to sory by. For example:'name'
.sortType
number- DeGiro.SortTypes.asc
- DeGiro.SortTypes.desc
limit
number - Results limit. Defaults to 7offset
number - Results offset. Defaults to 0
askBidPrice
degiro;
getProductsById
degiro);// displays product details
getClientInfo
Requests client info (name, email, address, role, etc) to the server and updates the session information
degiro;// displays client information
You can also access this information in degiro.session.clientInfo
after a successful login
Examples
See examples
Contributors
License
MIT