DeGiro API
This is an unnoficial 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.
Install
npm install --save degiro
yarn add degiro
Examples
create
const DeGiro = require('degiro');
const degiro = DeGiro.create({username: 'johndoe', password: '1234'});
You can also provide your user and pass via environment variables:
const DeGiro = require('degiro');
const degiro = DeGiro.create();
login
Performs the login to DeGiro using the username and password and
gets a new session id and the account number.
degiro.login().then(session => console.log(session));
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.
const degiro = DeGiro.create({sessionId: '', account: 123456})
degiro.session.id = 'your-session-id' ;
degiro.session.account = 'your-account-number';
getCashFunds
degiro.getCashFunds().then(console.log);
getPortfolio
degiro.getPortfolio().then(console.log);
buy
This example sets a permanent buy order 10 Apple shares at a fixed price of $110
degiro.buy({
orderType: DeGiro.OrderTypes.limited,
productSymbol: 'AAPL',
productType: DeGiro.ProductTypes.shares,
timeType: DeGiro.TimeTypes.permanent,
size: 10,
price: 110,
}).then(console.log);
Options
orderType
: number
- DeGiro.OrderTypes.limited
- DeGiro.OrderTypes.marketOrder
- DeGiro.OrderTypes.stopLoss
- DeGiro.OrderTypes.stopLimited
productSymbol
: stringproductType
: number
- DeGiro.ProductTypes.shares
- DeGiro.ProductTypes.bonds
- DeGiro.ProductTypes.futures
- DeGiro.ProductTypes.options
- DeGiro.ProductTypes.investmendFunds
- DeGiro.ProductTypes.leveragedProducts
- DeGiro.ProductTypes.etfs
- DeGiro.ProductTypes.cfds
- DeGiro.ProductTypes.warrants
timeType
: number
- DeGiro.TimeTypes.day
- DeGiro.TimeTypes.permanent
price
: number - Required for limited
and stopLimited
ordersstopPrice
: number - Required for stopLoss
and stopLimited
orders
sell
This example sets a sell order of 15 Apple shares at market price
degiro.sell({
orderType: DeGiro.OrderTypes.marketOrder,
productSymbol: 'AAPL',
productType: DeGiro.ProductTypes.shares,
size: 15,
}).then(console.log);
Options
Same options as buy
.
searchProduct
degiro.searchProduct({text: 'GOOG'})).then(console.log);
Options
text
string - Search term. For example: "Netflix" or "NFLX"productType
number - See DeGiro.ProductTypes
. Defaults to all
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.getAskBidPrice('350009261').then(console.log);
getProductsById
degiro.getProductsByIds(['8066561', '350009261'])).then(console.log);
getClientInfo
Requests client info (name, email, address, role, etc) to the server and updates the session information
degiro.getClientInfo().then(console.log);
You can also access this information in degiro.session.clientInfo
after a successful login
Examples
See examples
Contributors
License
MIT