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

degiro-api

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

degiro-api

Unofficial DeGiro API for Javascript. Buy and sell in the stock market. See your portfolio and much more

  • 0.1.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17
decreased by-26.09%
Maintainers
1
Weekly downloads
 
Created
Source

Unofficial DeGiro API

DeGiro Logo

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-api

# using yarn
yarn add degiro-api

Basic examples

Create an instance of DeGiro

Basic log in DeGiro Platform. All endpoint needs a session key before those can be call.

const DeGiro = require('degiro-api')

const degiro = new DeGiro({
  username: 'username',
  pwd: '*****'
})

degiro.login()
  .then(() => console.log('Log in success'))
  .catch(console.error)

Get account details

Get account info using await:

import DeGiro from 'degiro-api'

(async () => {
  const degiro = new DeGiro({
    username: 'username',
    pwd: '*****'
  })

  await degiro.login()

  const accountData = await degiro.getAccountData()
  // console.log(accountData)
})()

Get portfolio

getPortfolioparams are:

  • type: set the types or positions you want to fetch. Could be:

    • ALL: Gets the response without filter it
    • ALL_POSITIONS: Gets only positions in products. Exclude positions like 'CASH', etc.
    • OPEN: Gets only opened positions.
    • CLOSED: Gets only the closed positions in your portfolio.
  • getProductDetails: if is set to true the positions results will have a productData field with all the product details.

Get all open positions:

import DeGiro from 'degiro-api'
import { PORTFOLIO_POSITIONS_TYPE_ENUM } from 'degiro-api/enums'

(async () => {

  const degiro: DeGiro = new DeGiro({
    username: 'your_username_here',
    pwd: '**********',
  })

  await degiro.login()

  const portfolio = await degiro.getPortfolio({ 
    type: PORTFOLIO_POSITIONS_TYPE_ENUM.ALL, 
    getProductDetails: true,
  })
  console.log(JSON.stringify(portfolio, null, 2))
})()

Also you can fetch your portfolio data this way:

import DeGiro from 'degiro-api'
import { PORTFOLIO_POSITIONS_TYPE_ENUM } from 'degiro-api/enums'

(async () => {

  const degiro: DeGiro = new DeGiro({
    username: 'your_username_here',
    pwd: '**********',
  })

  await degiro.login()

  const portfolio = await degiro.getPortfolio({ type: PORTFOLIO_POSITIONS_TYPE_ENUM.ALL })
  console.log(JSON.stringify(portfolio, null, 2))
})()

And getting product details too

import DeGiro from 'degiro-api'
import { PORTFOLIO_POSITIONS_TYPE_ENUM } from 'degiro-api/enums'

(async () => {

  const degiro: DeGiro = new DeGiro({
    username: 'your_username_here',
    pwd: '**********',
  })

  await degiro.login()

  const portfolio = await degiro.getPortfolio({ 
    type: PORTFOLIO_POSITIONS_TYPE_ENUM.ALL, 
    getProductDetails: true,
  })
  console.log(JSON.stringify(portfolio, null, 2))
})()

Search product, stock and much more in broker

degiro.searchProduct(options): Promise<SearchProductResultType[]>

  • options:
    • text: required string,
    • type: optional DeGiroProducTypes
    • limit: optional number default=10,
    • offset: optional number default=0,

DeGiroProducTypes

  • shares: 1
  • bonds: 2
  • futures: 7
  • options: 8
  • investmendFunds: 13
  • leveragedProducts: 14
  • etfs: 131
  • cfds: 535
  • warrants: 536

Search the text "AAPL" without any limitation

import DeGiro from './../main'

(async () => {

  const degiro: DeGiro = new DeGiro({
    username: 'your_username_here',
    pwd: '***********',
  })

  await degiro.login()

  const result = await degiro.searchProduct({ text: 'AAPL' })
  console.log(JSON.stringify(result, null, 2))
})()

Search TSLA stock

import DeGiro from './../main'
import { DeGiroProducTypes } from 'degiro-api/enums'

(async () => {

  const degiro: DeGiro = new DeGiro({
    username: 'your_username_here',
    pwd: '***********',
  })

  await degiro.login()

  const result = await degiro.searchProduct({
    text: 'TSLA',
    type: DeGiroProducTypes.shares,
    limit: 1,
  })
  console.log(JSON.stringify(result, null, 2))
})()

TO DO List

  1. Two factor
  2. Set orders
  3. Get prices

License

MIT

Keywords

FAQs

Package last updated on 16 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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