Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

degiro

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

degiro - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

4

examples/get-portfolio.js

@@ -8,4 +8,6 @@ const DeGiro = require('..');

degiro.login().then(degiro.getPortfolio)
degiro
.login()
.then(degiro.getPortfolio)
.then(res => console.log(JSON.stringify(res, null, ' ')))
.catch(console.error);
const DeGiro = require('..');
const degiro = DeGiro.create({
// username: 'your-username',
// password: 'your-password',
});
(async () => {
const degiro = DeGiro.create({
// username: 'your-username',
// password: 'your-password',
});
degiro.login().then(() => degiro.getProductsByIds(['8066561', '331868']))
.then(console.log);
await degiro.login();
console.log(await degiro.getProductsByIds(['8066561', '331868']));
})();

@@ -11,13 +11,13 @@ const DeGiro = require('..');

const degiro = DeGiro.create({
// sessionId: 'your-session-id',
// sessionAccount: your-account-number,
// sessionId: 'your session id',
// sessionAccount: your session account number,
});
degiro.login()
.then(console.log)
.then(degiro.getCashFunds)
.then(data => {
console.log('EUR:', data.cashFunds.find(cash => cash.name === 'EUR'));
console.log('USD:', data.cashFunds.find(cash => cash.name === 'USD'));
})
.catch(console.error);
(async () => {
try {
await degiro.updateConfig(); // needed to update internal configuration
console.log(await degiro.getPortfolio());
} catch (e) {
console.error(e);
}
})();
const DeGiro = require('..');
const degiro = DeGiro.create({
// username: 'your-username',
// password: 'your-password',
});
(async () => {
const degiro = DeGiro.create({
// username: 'your-username',
// password: 'your-password',
});
degiro.login().then(() => degiro.searchProduct({
text: 'AAPL',
}))
.then(console.log);
await degiro.login();
console.log(await degiro.searchProduct({text: 'AAPL'}));
})();
{
"name": "degiro",
"version": "3.0.0",
"version": "3.0.1",
"description": "DeGiro (unnoficial) API",

@@ -14,4 +14,4 @@ "main": "src/index.js",

"cookie": "^0.3.1",
"lodash": "^4.16.4",
"node-fetch": "^1.6.3"
"lodash": "^4.17.5",
"node-fetch": "^2.0.0"
},

@@ -18,0 +18,0 @@ "devDependencies": {

# DeGiro API
This is an **unofficial** Node.js API client for [DeGiro](https://www.degiro.co.uk)'s trading platform. Using this module you can easily automate your orders (buy and sell) and get information about orders, funds or products.
This is an **unofficial** Node.js API client for [DeGiro](https://www.degiro.co.uk)'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 is Europe's fastest growing online stockbroker. DeGiro distinguishes itself by offering institutional
fees to retail investors.

@@ -41,4 +44,3 @@ :warning: DeGiro could change their API at any moment, if something is not working, please open an issue.

Performs the login to DeGiro using the username and password and
gets a new session id and the account number.
Performs the login to DeGiro using the username and password and gets a new session id and the account number.

@@ -50,12 +52,11 @@ ```javascript

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.
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.
```javascript
// set session info via constructor
const degiro = DeGiro.create({sessionId: '', account: 123456})
const degiro = DeGiro.create({sessionId: '', account: 123456});
// set session assigning session variables
degiro.session.id = 'your-session-id' ;
degiro.session.id = 'your-session-id';
degiro.session.account = 'your-account-number';

@@ -105,10 +106,12 @@ ```

```javascript
degiro.setOrder({
buySell: DeGiro.Actions.buy,
orderType: DeGiro.OrderTypes.limited,
productId: '8066561',
timeType: DeGiro.TimeTypes.permanent,
size: 10,
price: 900,
}).then(console.log); // prints the order id
degiro
.setOrder({
buySell: DeGiro.Actions.buy,
orderType: DeGiro.OrderTypes.limited,
productId: '8066561',
timeType: DeGiro.TimeTypes.permanent,
size: 10,
price: 900,
})
.then(console.log); // prints the order id
```

@@ -119,8 +122,10 @@

```javascript
degiro.setOrder({
buySell: DeGiro.Actions.sell,
orderType: DeGiro.OrderTypes.marketOrder,
productId: '8066561',
size: 15,
}).then(console.log); // prints the order id
degiro
.setOrder({
buySell: DeGiro.Actions.sell,
orderType: DeGiro.OrderTypes.marketOrder,
productId: '8066561',
size: 15,
})
.then(console.log); // prints the order id
```

@@ -130,14 +135,14 @@

- `orderType`: _number_
- DeGiro.OrderTypes.**limited**
- DeGiro.OrderTypes.**marketOrder**
- DeGiro.OrderTypes.**stopLoss**
- DeGiro.OrderTypes.**stopLimited**
- `productId`: _string_
- `timeType`: _number_
- DeGiro.TimeTypes.**day**
- DeGiro.TimeTypes.**permanent**
- `price`: _number_ - Required for `limited` and `stopLimited` orders
- `size`: _number_ - Order size
- `stopPrice`: _number_ - Required for `stopLoss` and `stopLimited` orders
* `orderType`: _number_
* DeGiro.OrderTypes.**limited**
* DeGiro.OrderTypes.**marketOrder**
* DeGiro.OrderTypes.**stopLoss**
* DeGiro.OrderTypes.**stopLimited**
* `productId`: _string_
* `timeType`: _number_
* DeGiro.TimeTypes.**day**
* DeGiro.TimeTypes.**permanent**
* `price`: _number_ - Required for `limited` and `stopLimited` orders
* `size`: _number_ - Order size
* `stopPrice`: _number_ - Required for `stopLoss` and `stopLimited` orders

@@ -150,3 +155,3 @@ ### searchProduct

{ offset: 0,
data:
products:
[ { vwdIdentifierType: 'issueid',

@@ -181,10 +186,10 @@ productTypeId: 1,

- `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 7
- `offset` _number_ - Results offset. Defaults to 0
* `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 7
* `offset` _number_ - Results offset. Defaults to 0

@@ -221,5 +226,5 @@ ### askBidPrice

- [martijndierckx](https://github.com/martijndierckx)
- [Drag0s](https://github.com/Drag0s)
- [d99kris](https://github.com/d99kris)
* [martijndierckx](https://github.com/martijndierckx)
* [Drag0s](https://github.com/Drag0s)
* [d99kris](https://github.com/d99kris)

@@ -226,0 +231,0 @@ ## License

@@ -13,11 +13,9 @@ const fetch = require('node-fetch');

const create = (
{
username = process.env.DEGIRO_USER,
password = process.env.DEGIRO_PASS,
sessionId = process.env.DEGIRO_SID,
account = process.env.DEGIRO_ACCOUNT,
debug = !!process.env.DEGIRO_DEBUG,
} = {}
) => {
const create = ({
username = process.env.DEGIRO_USER,
password = process.env.DEGIRO_PASS,
sessionId = process.env.DEGIRO_SID,
account = +process.env.DEGIRO_ACCOUNT,
debug = !!process.env.DEGIRO_DEBUG,
} = {}) => {
const log = debug ? (...s) => console.log(...s) : () => {};

@@ -39,3 +37,3 @@

vwdQuotecastServiceUrl: null,
}
};

@@ -72,3 +70,6 @@ const checkSuccess = res => {

cashFunds: data.cashFunds.value.map(({value}) =>
omit(fromPairs(value.map(({name, value}) => [name, value])), ['handling', 'currencyCode'])
omit(fromPairs(value.map(({name, value}) => [name, value])), [
'handling',
'currencyCode',
])
),

@@ -88,3 +89,5 @@ };

return fetch(
`https://degiro.quotecast.vwdservices.com/CORS/request_session?version=1.0.20170315&userToken=${session.userToken}`,
`https://degiro.quotecast.vwdservices.com/CORS/request_session?version=1.0.20170315&userToken=${
session.userToken
}`,
{

@@ -119,3 +122,5 @@ method: 'POST',

} else {
throw Error('Tried 3 times to get data, but nothing was returned: ' + JSON.stringify(res));
throw Error(
'Tried 3 times to get data, but nothing was returned: ' + JSON.stringify(res)
);
}

@@ -258,3 +263,2 @@ }

/**

@@ -265,5 +269,5 @@ * Get config

*/
const getConfig = () =>
const updateConfig = () =>
fetch(`${BASE_TRADER_URL}/login/secure/config`, {
headers: { 'Cookie': `JSESSIONID=${session.id};` }
headers: {Cookie: `JSESSIONID=${session.id};`},
})

@@ -306,3 +310,3 @@ .then(res => res.json())

})
.then(getConfig)
.then(updateConfig)
.then(getClientInfo)

@@ -342,3 +346,5 @@ .then(() => session);

return fetch(
`${urls.productSearchUrl}v5/products/lookup?intAccount=${session.account}&sessionId=${session.id}&${params}`
`${urls.productSearchUrl}v5/products/lookup?intAccount=${session.account}&sessionId=${
session.id
}&${params}`
).then(res => res.json());

@@ -355,7 +361,8 @@ };

return fetch(
`${urls.tradingUrl}v5/order/${orderId};jsessionid=${session.id}?intAccount=${session.account}&sessionId=${session.id}`,
`${urls.tradingUrl}v5/order/${orderId};jsessionid=${session.id}?intAccount=${
session.account
}&sessionId=${session.id}`,
{
method: 'DELETE',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify(order),
}

@@ -385,3 +392,3 @@ )

*/
const checkOrder = (order) => {
const checkOrder = order => {
const {buySell, orderType, productId, size, timeType, price, stopPrice} = order;

@@ -399,3 +406,5 @@ log('checkOrder', {

return fetch(
`${urls.tradingUrl}v5/checkOrder;jsessionid=${session.id}?intAccount=${session.account}&sessionId=${session.id}`,
`${urls.tradingUrl}v5/checkOrder;jsessionid=${session.id}?intAccount=${
session.account
}&sessionId=${session.id}`,
{

@@ -422,3 +431,5 @@ method: 'POST',

return fetch(
`${urls.tradingUrl}v5/order/${confirmationId};jsessionid=${session.id}?intAccount=${session.account}&sessionId=${session.id}`,
`${urls.tradingUrl}v5/order/${confirmationId};jsessionid=${session.id}?intAccount=${
session.account
}&sessionId=${session.id}`,
{

@@ -447,4 +458,3 @@ method: 'POST',

const setOrder = ({buySell, orderType, productId, size, timeType = TimeTypes.day, price, stopPrice}) =>
checkOrder({buySell, orderType, productId, size, timeType, price, stopPrice})
.then(confirmOrder);
checkOrder({buySell, orderType, productId, size, timeType, price, stopPrice}).then(confirmOrder);

@@ -483,2 +493,3 @@ /**

getClientInfo,
updateConfig,
// properties

@@ -485,0 +496,0 @@ session,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc