Git Product home page Git Product logo

degiro's Introduction

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

# using npm
npm install --save degiro

# using yarn
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:

// run as:
// DEGIRO_USER=johndow DEGIRO_PASS=1234 node app.js 

const DeGiro = require('degiro');
// now you don't need to provide your credentials
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)); 
// prints session info (session id and account number)

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 constructor
const degiro = DeGiro.create({sessionId: '', account: 123456})

// set session assigning session variables 
degiro.session.id = 'your-session-id' ;
degiro.session.account = 'your-account-number';

getCashFunds

degiro.getCashFunds().then(cash => console.log(cash));
// {
//   cashFunds: [ 
//     {id: '2', name: 'EUR', value: 1935.8, valueBaseCurr: 1935.8, rate: 1},
//     {id: '9885', name: 'USD', value: 0, valueBaseCurr: 0, rate: 0.9102},
//     ...
//   ]
// }

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(r => console.log(r)); // prints the order id

Options

  • orderType: number
    • DeGiro.OrderTypes.limited
    • DeGiro.OrderTypes.marketOrder
    • DeGiro.OrderTypes.stopLoss
    • DeGiro.OrderTypes.stopLimited
  • productSymbol: string
  • productType: 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 orders
  • stopPrice: 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(r => console.log(r)); // prints the order id

Options

Same options as buy.

searchProduct

degiro.searchProduct({text: 'GOOG'})).then(r => console.log(r));
/*
{ offset: 0,
  data: 
   [ { 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' },
     ...
*/

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 7
  • offset number - Results offset. Defaults to 0

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.