### Install and Run Tests Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Before running tests, ensure DEGIRO_USER and DEGIRO_PWD environment variables are set. This command installs dependencies and executes the test suite. ```bash $ yarn install && yarn test yarn run v1.22.4 $ mocha -r ts-node/register tests/**/*.spec.ts ``` -------------------------------- ### Install degiro-api with npm or yarn Source: https://github.com/icastillejogomez/degiro-api/blob/master/README.md Install the degiro-api package using either npm or yarn package managers. ```sh # using npm npm install --save degiro-api # using yarn yarn add degiro-api ``` -------------------------------- ### Static create method Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/classes/_degiro_.degiro.html Creates a new DeGiro instance with the provided setup parameters. ```APIDOC ## Static create ### Description Creates a new DeGiro instance with the provided setup parameters. ### Method Static method ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **params** ([DeGiroSettupType](../modules/_types_degirosettuptype_.html#degirosettuptype)) - Required - Setup parameters for the DeGiro instance. ### Request Example ```json { "username": "your_username", "password": "your_password", "accountId": "your_account_id" } ``` ### Response #### Success Response (200) * **DeGiro** ([DeGiro](_degiro_.degiro.html)) - The newly created DeGiro instance. #### Response Example ```json { "instance": "DeGiro instance object" } ``` ``` -------------------------------- ### DeGiro Constructor Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/classes/_degiro_.degiro.html Initializes the DeGiro API client. It can optionally accept setup parameters. ```APIDOC ## constructor ### Description Initializes the DeGiro API client. It can optionally accept setup parameters. ### Signature ```typescript new DeGiro(params?: DeGiroSettupType): DeGiro ``` ### Parameters * **params** (DeGiroSettupType) - Optional - Setup parameters for the DeGiro client. ### Returns * **DeGiro** - An instance of the DeGiro client. ``` -------------------------------- ### Get JSESSIONID from DeGiro Instance Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html This example shows how to create a DeGiro instance using environment variables, log in, and retrieve the jsessionId. The jsessionId is not a promise. ```javascript import DeGiro from 'degiro-api' (async () => { const degiro = new DeGiro({}) // <-- Using ENV variables await degiro.login() // Get the jsessionId (LOOK, is not a promise) const jsessionId = degiro.getJSESSIONID() }) ``` -------------------------------- ### Get Config Dictionary Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieves a dictionary of configuration values. ```APIDOC ## Get Config Dictionary ### Description Fetches a comprehensive dictionary of configuration parameters used by the API or platform. ### Method `getConfigDictionary()` ### Parameters None ### Request Example ```javascript const configDict = await degiro.getConfigDictionary() console.log('Config Dictionary:', configDict) ``` ### Response #### Success Response (200) - **configDict** (object) - A dictionary containing various configuration values. ``` -------------------------------- ### Get Portfolio with Product Details - DeGiro API Source: https://github.com/icastillejogomez/degiro-api/blob/master/README.md Fetches portfolio data including product details for all positions. Requires login. ```javascript import DeGiro, { DeGiroEnums, DeGiroTypes } from 'degiro-api' const { PORTFOLIO_POSITIONS_TYPE_ENUM } = DeGiroEnums (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)) })() ``` -------------------------------- ### Get Account Configuration Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieves the configuration settings for the user's account. ```APIDOC ## Get Account Configuration ### Description Fetches the configuration details associated with the user's account. ### Method `getAccountConfig()` ### Parameters None ### Request Example ```javascript const config = await degiro.getAccountConfig() console.log('Account Config:', config) ``` ### Response #### Success Response (200) - **config** (object) - Account configuration details. ``` -------------------------------- ### Get Web Settings Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieves general settings for the DeGiro web interface. ```APIDOC ## Get Web Settings ### Description Fetches configuration settings specific to the DeGiro web application. ### Method `getWebSettings()` ### Parameters None ### Request Example ```javascript const settings = await degiro.getWebSettings() console.log('Web Settings:', settings) ``` ### Response #### Success Response (200) - **settings** (object) - Web application settings. ``` -------------------------------- ### Execute DeGiro Order Source: https://github.com/icastillejogomez/degiro-api/blob/master/README.md This example demonstrates how to execute a previously created order using its confirmation ID. It includes error handling for potential issues during execution. The password can be securely managed using environment variables. ```typescript import DeGiro, { DeGiroEnums, DeGiroTypes } from 'degiro-api' const { DeGiroActions, DeGiroMarketOrderTypes, DeGiroTimeTypes } = DeGiroEnums const { OrderType } = DeGiroTypes (async () => { try { const degiro: DeGiro = new DeGiro({ username: '', pwd: process.env.DEGIRO_PWD, }) await degiro.login() const order: OrderType = { buySell: DeGiroActions.BUY, orderType: DeGiroMarketOrderTypes.LIMITED, productId: '331868', // $AAPL - Apple Inc size: 1, timeType: DeGiroTimeTypes.DAY, price: 270, // limit price // stopPrice: 2, } const { confirmationId, freeSpaceNew, transactionFees } = await degiro.createOrder(order) const orderId = await degiro.executeOrder(order, confirmationId) console.log(`Order executed with id: ${orderId}`) } catch (error) { console.error(error) } })() ``` -------------------------------- ### Get Web Settings Path Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/enums/_enums_degiroenums_.degiro_api_paths.html The API path to retrieve web-based settings. ```APIDOC ## GET_WEB_SETTINGS_PATH ### Description The API path to retrieve web-based settings. ### Endpoint settings/web ``` -------------------------------- ### Execute an Order with DeGiro API Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Shows how to execute a previously created order using the DeGiro API. This example includes error handling for the API calls. Ensure you have logged in and have a valid confirmationId. ```typescript import DeGiro, { DeGiroEnums, DeGiroTypes } from 'degiro-api' const { DeGiroActions, DeGiroMarketOrderTypes, DeGiroTimeTypes } = DeGiroEnums const { OrderType } = DeGiroTypes (async () => { try { const degiro: DeGiro = new DeGiro({ username: 'nachoogoomezomg', pwd: process.env.DEGIRO_PWD, }) await degiro.login() const order: OrderType = { buySell: DeGiroActions.BUY, orderType: DeGiroMarketOrderTypes.LIMITED, productId: '331868', // $AAPL - Apple Inc size: 1, timeType: DeGiroTimeTypes.DAY, price: 270, // limit price // stopPrice: 2, } const { confirmationId, freeSpaceNew, transactionFees } = await degiro.createOrder(order) const orderId = await degiro.executeOrder(order, confirmationId) console.log(`Order executed with id: ${orderId}`) } catch (error) { console.error(error) } })() ``` -------------------------------- ### GetPorfolioConfigType Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/modules/_types_getporfolioconfigtype_.html Defines the configuration options for fetching portfolio details. It includes an optional flag to get product details and a mandatory type for portfolio positions. ```APIDOC ## Type Alias: GetPorfolioConfigType ### Description This type alias defines the structure for configuring portfolio data retrieval. It allows specifying whether to include detailed product information and requires a type for portfolio positions. ### Properties * **getProductDetails** (boolean | undefined | false | true) - Optional. If true, detailed product information will be fetched. * **type** (PORTFOLIO_POSITIONS_TYPE_ENUM) - Required. Specifies the type of portfolio positions to retrieve. Refer to the `PORTFOLIO_POSITIONS_TYPE_ENUM` for available options. ``` -------------------------------- ### Create DeGiro Instance with Previous Session Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html This example demonstrates creating a DeGiro instance by providing a previous jsessionId. It's necessary to re-hydrate the account configuration data and can serve as a session expiration checker. ```javascript import DeGiro from 'degiro-api' (async () => { // Create an instance from a previous session const degiro = new DeGiro({ username: '', pwd: '*******', jsessionId: previousJSESSIONID }) // Hydrate // Re-use sessions need to re-hydrate the account config data and could use as a session expiration checker await degiro.login() // Do your stuff here... }) ``` -------------------------------- ### Get Products by IDs Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieves detailed information for a list of products specified by their IDs. ```APIDOC ## Get Products by IDs ### Description Fetches detailed information for multiple financial products using their unique identifiers. ### Method `getProductsByIds(productIds)` ### Parameters #### Query Parameters - **productIds** (array of strings) - An array of product IDs to retrieve information for. ### Request Example ```javascript const productIds = ['id1', 'id2', 'id3'] const products = await degiro.getProductsByIds(productIds) console.log('Product Details:', products) ``` ### Response #### Success Response (200) - **products** (array) - An array of product objects, each containing detailed information. ``` -------------------------------- ### Get Account Config Path Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/enums/_enums_degiroenums_.degiro_api_paths.html The API path to retrieve account configuration settings. ```APIDOC ## GET_ACCOUNT_CONFIG_PATH ### Description The API path to retrieve account configuration settings. ### Endpoint login/secure/config ``` -------------------------------- ### Check Authentication Status (Basic) Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html This example shows how to check if the DeGiro instance is logged in using the isLogin() method. Note that this method only checks if account configuration data is set. ```javascript import DeGiro from 'degiro-api' (async () => { // Create an instance from a previous session const degiro = new DeGiro({}) // <-- Using ENV variables if (!degiro.isLogin()) { await degiro.login() if (degiro.isLogin()) { // AWESOME!! We're in } } }) ``` -------------------------------- ### Get Account Info Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieves detailed information about the user's account. ```APIDOC ## Get Account Info ### Description Retrieves comprehensive details about the user's account. ### Method `getAccountInfo()` ### Parameters None ### Request Example ```javascript const info = await degiro.getAccountInfo() console.log('Account Info:', info) ``` ### Response #### Success Response (200) - **info** (object) - Detailed account information. ``` -------------------------------- ### Authenticate and start a session with DeGiro Source: https://context7.com/icastillejogomez/degiro-api/llms.txt Log in to DeGiro using provided credentials. If a JSESSIONID was supplied during instantiation, it hydrates the existing session. This method fetches account configuration and data. ```ts import DeGiro from 'degiro-api' ;(async () => { const degiro = new DeGiro({ username: 'your_username', pwd: 'your_password', // oneTimePassword: '123456', // include if 2FA / OTP is enabled }) try { const accountData = await degiro.login() console.log('Logged in. Account data:', JSON.stringify(accountData, null, 2)) // accountData.data.intAccount => numeric internal account ID // accountData.data.username => 'your_username' } catch (err) { console.error('Login failed:', err) } })() ``` -------------------------------- ### Get Web User Settings Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieves user-specific settings for the DeGiro web interface. ```APIDOC ## Get Web User Settings ### Description Fetches settings that are personalized for the currently logged-in user within the web application. ### Method `getWebUserSettings()` ### Parameters None ### Request Example ```javascript const userSettings = await degiro.getWebUserSettings() console.log('User Web Settings:', userSettings) ``` ### Response #### Success Response (200) - **userSettings** (object) - User-specific settings for the web interface. ``` -------------------------------- ### Get Top News Path Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/enums/_enums_degiroenums_.degiro_api_paths.html The API path to fetch top news previews. ```APIDOC ## GET_TOP_NEWS_PATH ### Description The API path to fetch top news previews. ### Endpoint newsfeed/v2/top-news-preview ``` -------------------------------- ### Get Favourite Products Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieves a list of the user's favourite financial products. ```APIDOC ## Get Favourite Products ### Description Fetches the list of products that the user has marked as favourites. ### Method `getFavouriteProducts()` ### Parameters None ### Request Example ```javascript const favourites = await degiro.getFavouriteProducts() console.log('Favourite Products:', favourites) ``` ### Response #### Success Response (200) - **favourites** (array) - A list of the user's favourite products. ``` -------------------------------- ### Get Account Info Path Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/enums/_enums_degiroenums_.degiro_api_paths.html The API path to retrieve detailed account information. ```APIDOC ## GET_ACCOUNT_INFO_PATH ### Description The API path to retrieve detailed account information. ### Endpoint v5/account/info/ ``` -------------------------------- ### Get Portfolio without Product Details - DeGiro API Source: https://github.com/icastillejogomez/degiro-api/blob/master/README.md Retrieves basic portfolio data for all positions. Ensure you are logged in. ```javascript import DeGiro, { DeGiroEnums, DeGiroTypes } from 'degiro-api' const { PORTFOLIO_POSITIONS_TYPE_ENUM } = DeGiroEnums (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)) })() ``` -------------------------------- ### Get News Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieves news articles related to financial markets or specific products. ```APIDOC ## Get News ### Description Fetches relevant news articles, potentially filterable by market or product. ### Method `getNews(options)` ### Parameters #### Query Parameters - **options** (object, optional) - Filtering options for news retrieval. ### Request Example ```javascript const news = await degiro.getNews({ filter: 'market' }) console.log('Market News:', news) ``` ### Response #### Success Response (200) - **news** (array) - A list of news articles. ``` -------------------------------- ### Get Web User Settings Path Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/enums/_enums_degiroenums_.degiro_api_paths.html The API path to retrieve user-specific web settings. ```APIDOC ## GET_WEB_USER_SETTINGS_PATH ### Description The API path to retrieve user-specific web settings. ### Endpoint settings/user ``` -------------------------------- ### Get Portfolio Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieves the user's portfolio. The 'type' parameter allows filtering by ALL, ALL_POSITIONS, OPEN, or CLOSED positions. Setting 'getProductDetails' to true includes detailed product information. ```APIDOC ## Get Portfolio ### Description Retrieves the user's portfolio with optional filtering and product details. ### Method `getPortfolio(config: GetPorfolioConfigType): Promise` ### Parameters #### Options - **type** (string) - Optional. Filters the portfolio type. Possible values: ALL, ALL_POSITIONS, OPEN, CLOSED. - **getProductDetails** (boolean) - Optional. If true, includes detailed product data in the response. ### Request Example ```javascript import DeGiro, { DeGiroEnums, DeGiroTypes } from 'degiro-api' const { PORTFOLIO_POSITIONS_TYPE_ENUM } = DeGiroEnums (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)) })() ``` ``` -------------------------------- ### Get Account Configuration from Degiro API Source: https://github.com/icastillejogomez/degiro-api/blob/master/README.md Fetch the account configuration details from the Degiro API. This requires the user to be logged in, and the method returns the configuration data as a promise. ```javascript import DeGiro from 'degiro-api' const degiro = new DeGiro({}) await degiro.login() const accountConfig = await degiro.getAccountConfig() console.log(accountConfig) ``` -------------------------------- ### Get Account State Path Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/enums/_enums_degiroenums_.degiro_api_paths.html The API path to retrieve the current state of the user's account. ```APIDOC ## GET_ACCOUNT_STATE_PATH ### Description The API path to retrieve the current state of the user's account. ### Endpoint v6/accountoverview ``` -------------------------------- ### new DeGiro(params?) / DeGiro.create(params?) Source: https://context7.com/icastillejogomez/degiro-api/llms.txt Instantiates a new DeGiro client. Credentials can be provided directly or inferred from environment variables. The static `create` method offers an alternative instantiation approach. ```APIDOC ## new DeGiro(params?) / DeGiro.create(params?) ### Description Creates a new DeGiro client. Credentials can be passed directly or read from environment variables `DEGIRO_USER`, `DEGIRO_PWD`, `DEGIRO_OTP`, and `DEGIRO_JSESSIONID`. The static `create` factory method is an alternative to `new`. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```typescript import DeGiro from 'degiro-api' // From constructor with explicit credentials const degiro = new DeGiro({ username: 'your_username', pwd: 'your_password', }) // From constructor using environment variables (DEGIRO_USER / DEGIRO_PWD) const degiro = new DeGiro({}) // Using the static factory const degiro = DeGiro.create({ username: 'your_username', pwd: 'your_password' }) // Reuse an existing session by providing a JSESSIONID const degiro = new DeGiro({ username: 'your_username', pwd: 'your_password', jsessionId: 'ABC123DEF456', // from a previous degiro.getJSESSIONID() call }) ``` ### Response None explicitly documented for instantiation. ``` -------------------------------- ### Get Account Details Explicitly Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html This example demonstrates how to explicitly retrieve account data after logging in. The login method also returns accountData. ```javascript import DeGiro from 'degiro-api' (async () => { const degiro = new DeGiro({ username: 'username', pwd: '*****' }) await degiro.login() // Login also returns accountData const accountData = await degiro.getAccountData() // console.log(accountData) }) ``` -------------------------------- ### Get Orders Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieves a list of current orders. ```APIDOC ## Get Orders ### Description Fetches a list of all active or pending orders. ### Method `getOrders()` ### Parameters None ### Request Example ```javascript const orders = await degiro.getOrders() console.log('Current Orders:', orders) ``` ### Response #### Success Response (200) - **orders** (array) - A list of current orders. ``` -------------------------------- ### Create DeGiro instance and login Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Instantiate the DeGiro API client with credentials or environment variables and log in. ```javascript const DeGiro = require('degiro-api') const degiro = new DeGiro({ username: 'username', pwd: '*****' }) degiro.login() .then((accountData) => console.log('Log in success\n', accountData)) .catch(console.error) ``` ```javascript const degiro = DeGiro.create({ username: '*****', pwd: '*****' }) const accountData = await degiro.login() ``` ```javascript const degiro = new DeGiro() // <-- Use DEGIRO_USER & DEGIRO_PWD const accountData = await degiro.login() ``` -------------------------------- ### Generate API Documentation Source: https://github.com/icastillejogomez/degiro-api/blob/master/README.md Generate project documentation by running the 'doc' script via yarn or npm. The documentation will be available in the 'doc' folder as an index.html file. ```sh $ yarn doc or $ npm run doc ``` -------------------------------- ### Generate Documentation Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Generate API documentation by running the 'yarn doc' command. ```bash $ yarn doc yarn run v1.22.4 $ typedoc --out docs src Using TypeScript 3.9.2 from ....../degiro-api/node_modules/typescript/lib Rendering [========================================] 100% Documentation generated at ....../degiro-api/docs ✨ Done in 3.94s. ``` -------------------------------- ### Get Historical Orders Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieves a list of past orders. ```APIDOC ## Get Historical Orders ### Description Fetches a list of all completed or cancelled orders from the past. ### Method `getHistoricalOrders()` ### Parameters None ### Request Example ```javascript const historicalOrders = await degiro.getHistoricalOrders() console.log('Historical Orders:', historicalOrders) ``` ### Response #### Success Response (200) - **historicalOrders** (array) - A list of historical orders. ``` -------------------------------- ### Fetch platform web settings using getWebSettings() Source: https://context7.com/icastillejogomez/degiro-api/llms.txt Retrieves global web configuration settings for the DeGiro platform. ```typescript import DeGiro from 'degiro-api' ;(async () => { const degiro = new DeGiro({}) await degiro.login() const settings = await degiro.getWebSettings() console.log(JSON.stringify(settings, null, 2)) })() ``` -------------------------------- ### Get Popular Stocks Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieves a list of currently popular stocks. ```APIDOC ## Get Popular Stocks ### Description Retrieves a list of stocks that are currently trending or popular. ### Method `getPopularStocks()` ### Parameters None ### Request Example ```javascript const popularStocks = await degiro.getPopularStocks() console.log('Popular Stocks:', popularStocks) ``` ### Response #### Success Response (200) - **popularStocks** (array) - A list of popular stocks. ``` -------------------------------- ### Get JSESSIONID Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieves the current JSESSIONID, useful for reusing sessions. ```APIDOC ## Get JSESSIONID ### Description Retrieves the session identifier (JSESSIONID) for the current session. ### Method `getJSESSIONID()` ### Parameters None ### Request Example ```javascript const sessionId = await degiro.getJSESSIONID() console.log('JSESSIONID:', sessionId) ``` ### Response #### Success Response (200) - **sessionId** (string) - The current JSESSIONID. ``` -------------------------------- ### getWebSettings Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/classes/_degiro_.degiro.html Fetches the web application settings. This method does not require any parameters. ```APIDOC ## getWebSettings ### Description Fetches the web application settings. ### Method GET (assumed) ### Endpoint /api/web/settings (assumed) ### Parameters None ### Response #### Success Response (200) - Returns an object of type WebSettingsType. ### Response Example ```json { "language": "en", "theme": "dark" } ``` ``` -------------------------------- ### Create DeGiro API Instance Source: https://github.com/icastillejogomez/degiro-api/blob/master/README.md Instantiate the DeGiro API client. Credentials can be provided directly during initialization, via environment variables (DEGIRO_USER, DEGIRO_PWD), or using the static create method. ```javascript const DeGiro = require('degiro-api').default // or import DeGiro from 'degiro-api' // Basic degiro init const degiro = new DeGiro({ username: '', pwd: '*****' }) // or creating with the static create method const degiro = DeGiro.create({ username: '*****', pwd: '*****' }) // or create with env credentials const degiro = new DeGiro() // <-- Use DEGIRO_USER & DEGIRO_PWD ``` -------------------------------- ### Get Account State Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieves the current state of the user's account. ```APIDOC ## Get Account State ### Description Fetches the current operational state of the user's account. ### Method `getAccountState()` ### Parameters None ### Request Example ```javascript const state = await degiro.getAccountState() console.log('Account State:', state) ``` ### Response #### Success Response (200) - **state** (object) - The current state of the account. ``` -------------------------------- ### Instantiate DeGiro client with explicit credentials or environment variables Source: https://context7.com/icastillejogomez/degiro-api/llms.txt Create a new DeGiro client instance. Credentials can be provided directly, read from environment variables, or an existing session can be reused with a JSESSIONID. ```ts import DeGiro from 'degiro-api' // From constructor with explicit credentials const degiro = new DeGiro({ username: 'your_username', pwd: 'your_password', }) ``` ```ts // From constructor using environment variables (DEGIRO_USER / DEGIRO_PWD) const degiro = new DeGiro({}) ``` ```ts // Using the static factory const degiro = DeGiro.create({ username: 'your_username', pwd: 'your_password' }) ``` ```ts // Reuse an existing session by providing a JSESSIONID const degiro = new DeGiro({ username: 'your_username', pwd: 'your_password', jsessionId: 'ABC123DEF456', // from a previous degiro.getJSESSIONID() call }) ``` -------------------------------- ### Get Account Reports Path Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/enums/_enums_degiroenums_.degiro_api_paths.html The API path to list account reports. ```APIDOC ## GET_ACCOUNT_REPORTS_PATH ### Description The API path to list account reports. ### Endpoint document/list/report ``` -------------------------------- ### getWebSettings() Source: https://context7.com/icastillejogomez/degiro-api/llms.txt Retrieves the global web configuration settings for the DeGiro platform. This provides general settings applicable to all users. ```APIDOC ## getWebSettings() ### Description Returns global web configuration settings for the DeGiro platform. ### Method Signature `getWebSettings(): Promise` ### Parameters This endpoint does not require any parameters. ### Request Example ```typescript import DeGiro from 'degiro-api'; const degiro = new DeGiro({}); await degiro.login(); const settings = await degiro.getWebSettings(); console.log(JSON.stringify(settings, null, 2)); ``` ### Response #### Success Response (200) - **WebSettingsType** - An object containing the platform's web settings. #### Response Example ```json { "someSetting": "value", "anotherSetting": 123 // ... other settings } ``` ``` -------------------------------- ### Get Latests News Path Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/enums/_enums_degiroenums_.degiro_api_paths.html The API path to fetch the latest news. ```APIDOC ## GET_LATESTS_NEWS_PATH ### Description The API path to fetch the latest news. ### Endpoint newsfeed/v2/latest-news ``` -------------------------------- ### getWebSettings Source: https://github.com/icastillejogomez/degiro-api/blob/master/README.md Retrieves general web settings. ```APIDOC ## getWebSettings() ### Description Fetches general settings for the DeGiro web platform. ### Method Signature `getWebSettings(): Promise` ### Response #### Success Response (200) - Returns an object containing web settings. ``` -------------------------------- ### getWebSettings Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/classes/_degiro_.degiro.html Retrieves web client settings. ```APIDOC ## getWebSettings ### Description Retrieves web client settings for the DeGiro platform. ### Signature ```typescript getWebSettings(): Promise ``` ### Returns * **Promise** - A promise that resolves with the web settings. ``` -------------------------------- ### Get Web i18n Messages Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieves internationalization (i18n) messages for the web interface. ```APIDOC ## Get Web i18n Messages ### Description Fetches localized text messages used in the DeGiro web application for different languages. ### Method `getWebi18nMessages()` ### Parameters None ### Request Example ```javascript const messages = await degiro.getWebi18nMessages() console.log('i18n Messages:', messages) ``` ### Response #### Success Response (200) - **messages** (object) - An object containing localized messages. ``` -------------------------------- ### createURLQuery Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/modules/_api_searchproductrequest_.html Constructs a URL query string for product search options. ```APIDOC ## Function: createURLQuery ### Description Constructs a URL query string based on the provided search product options. ### Parameters * **options** ([SearchProductOptionsType](_types_searchproductoptionstype_.html#searchproductoptionstype)) - The search options to be converted into a URL query. ### Returns * string - The generated URL query string. ``` -------------------------------- ### getWebUserSettings Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/classes/_degiro_.degiro.html Fetches user-specific settings for the web client. ```APIDOC ## getWebUserSettings ### Description Fetches user-specific settings for the DeGiro web client. ### Signature ```typescript getWebUserSettings(): Promise ``` ### Returns * **Promise** - A promise that resolves with the user settings. ``` -------------------------------- ### Get Account Reports Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieves financial reports associated with the user's account. ```APIDOC ## Get Account Reports ### Description Fetches historical financial reports for the account. ### Method `getAccountReports()` ### Parameters None ### Request Example ```javascript const reports = await degiro.getAccountReports() console.log('Account Reports:', reports) ``` ### Response #### Success Response (200) - **reports** (object) - Financial reports data. ``` -------------------------------- ### getWebSettings Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/interfaces/_interfaces_degiroclassinterface_.degiroclassinterface.html Retrieves the web settings for the DeGiro platform. ```APIDOC ## getWebSettings ### Description Retrieves the web settings for the DeGiro platform. ### Method ``` getWebSettings(): Promise ``` ### Returns Promise ``` -------------------------------- ### Degiro CLI Usage Source: https://github.com/icastillejogomez/degiro-api/blob/master/README.md Displays the available commands and options for the Degiro Command Line Interface. Use this to understand the basic structure and available actions. ```sh $ degiro Usage: DeGiro Command Line Interface [options] [command] DeGiro CLI provide you access to DeGiro Broker across the terminal Options: -V, --version output the version number -h, --help display help for command Commands: login validate credentials with DeGiro platform search Search products in DeGiro portfolio show account portfolio in real-time help [command] display help for command ``` -------------------------------- ### Get Account Data Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieves general data associated with the user's account. ```APIDOC ## Get Account Data ### Description Retrieves various data points related to the user's account. ### Method `getAccountData()` ### Parameters None ### Request Example ```javascript const accountData = await degiro.getAccountData() console.log('Account Data:', accountData) ``` ### Response #### Success Response (200) - **accountData** (object) - General account information. ``` -------------------------------- ### Create Order Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Initiates the creation of a new order. ```APIDOC ## Create Order ### Description Prepares a new order for execution. This typically involves specifying product, quantity, and order type. ### Method `createOrder(orderData)` ### Parameters #### Request Body - **orderData** (object) - Details of the order to be created. Structure depends on specific order type. ### Request Example ```javascript const newOrder = { productId: '12345', quantity: 10, orderType: 'BUY' } const order = await degiro.createOrder(newOrder) console.log('Order created:', order) ``` ### Response #### Success Response (200) - **order** (object) - Details of the created order, possibly awaiting execution. ``` -------------------------------- ### createOrder Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/classes/_degiro_.degiro.html Creates a new order for a financial product. ```APIDOC ## createOrder ### Description Creates a new order for a financial product. This method likely prepares an order object that needs to be executed separately. ### Signature ```typescript createOrder(orderParams: any): Promise ``` ### Parameters * **orderParams** (any) - Parameters required to create the order (e.g., product ID, quantity, price, order type). ### Returns * **Promise** - A promise that resolves with the created order details. ``` -------------------------------- ### login Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/interfaces/_interfaces_degiroclassinterface_.degiroclassinterface.html Initiates the login process to the DeGiro platform. Returns account data upon successful login. ```APIDOC ## login ### Description Initiates the login process to the DeGiro platform. Returns account data upon successful login. ### Method ``` login(): Promise ``` ### Returns Promise ``` -------------------------------- ### login() Source: https://context7.com/icastillejogomez/degiro-api/llms.txt Authenticates with DeGiro and initiates a session. If a `jsessionId` is provided during client instantiation, it reuses that session; otherwise, it performs a fresh login. This method fetches account configuration and data, returning `AccountDataType` upon successful authentication. ```APIDOC ## login() ### Description Authenticates with DeGiro and starts a session. If a `jsessionId` was provided at construction, it hydrates the session from that token instead of performing a fresh login. Internally fetches account config and account data; returns `AccountDataType` on success. ### Method `login(): Promise` ### Endpoint Not applicable (SDK method) ### Parameters None ### Request Example ```typescript import DeGiro from 'degiro-api' ;(async () => { const degiro = new DeGiro({ username: 'your_username', pwd: 'your_password', // oneTimePassword: '123456', // include if 2FA / OTP is enabled }) try { const accountData = await degiro.login() console.log('Logged in. Account data:', JSON.stringify(accountData, null, 2)) // accountData.data.intAccount => numeric internal account ID // accountData.data.username => 'your_username' } catch (err) { console.error('Login failed:', err) } })() ``` ### Response #### Success Response (AccountDataType) - **data** (object) - Contains account details like `intAccount` and `username`. #### Response Example ```json { "data": { "intAccount": 12345678, "username": "your_username" } } ``` ``` -------------------------------- ### Get Account Info - DeGiro API Source: https://github.com/icastillejogomez/degiro-api/blob/master/README.md Retrieves account information. Ensure you have logged in first. ```javascript import DeGiro from 'degiro-api' const degiro = new DeGiro({}) await degiro.login() const accountInfo = await degiro.getAccountInfo() console.log(accountInfo) ``` -------------------------------- ### Get Account Reports - DeGiro API Source: https://github.com/icastillejogomez/degiro-api/blob/master/README.md Fetches account reports. Requires prior login. ```javascript import DeGiro from 'degiro-api' const degiro = new DeGiro({}) await degiro.login() const reports = await degiro.getAccountReports() console.log(reports) ``` -------------------------------- ### getWebUserSettings Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/interfaces/_interfaces_degiroclassinterface_.degiroclassinterface.html Retrieves the user-specific web settings for the DeGiro platform. ```APIDOC ## getWebUserSettings ### Description Retrieves the user-specific web settings for the DeGiro platform. ### Method ``` getWebUserSettings(): Promise ``` ### Returns Promise ``` -------------------------------- ### Get Generic Data Path Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/enums/_enums_degiroenums_.degiro_api_paths.html The API path for retrieving generic data, likely for updates. ```APIDOC ## GET_GENERIC_DATA_PATH ### Description The API path for retrieving generic data, likely for updates. ### Endpoint v5/update/ ``` -------------------------------- ### Create, Execute, and Delete an Order with DeGiro API Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html This snippet demonstrates how to create a limited buy order for Apple Inc. stock, execute it, and then schedule its deletion after a short delay to avoid rate limiting. Ensure you have your DeGiro password stored in the DEGIRO_PWD environment variable. ```typescript import DeGiro, { DeGiroEnums, DeGiroTypes } from 'degiro-api' const { DeGiroActions, DeGiroMarketOrderTypes, DeGiroTimeTypes } = DeGiroEnums const { OrderType } = DeGiroTypes (async () => { const degiro: DeGiro = new DeGiro({ username: 'nachoogoomezomg', pwd: process.env.DEGIRO_PWD, }) await degiro.login() const order: OrderType = { buySell: DeGiroActions.BUY, orderType: DeGiroMarketOrderTypes.LIMITED, productId: '331868', // $AAPL - Apple Inc size: 1, timeType: DeGiroTimeTypes.DAY, price: 272, // limit price // stopPrice: 2, } const { confirmationId, freeSpaceNew, transactionFees } = await degiro.createOrder(order) const orderId = await degiro.executeOrder(order, confirmationId) console.log(`Order executed with id: ${orderId}`) // Wait few seconds to avoid "Rate limit for the given request exceeded" error const TIMEOUT_SECONDS = 2 * 1000 const deleteOrderFunction = async () => { try { await degiro.deleteOrder(orderId) console.log('Order removed') } catch (error) { console.error(error) } } setTimeout(deleteOrderFunction, TIMEOUT_SECONDS) })() ``` -------------------------------- ### getWebSettingsRequest Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/modules/_api_getwebsettingsrequest_.html Fetches web settings for a Degiro account using provided account data and configuration. ```APIDOC ## getWebSettingsRequest ### Description Fetches web settings for a Degiro account. ### Parameters * **accountData** (AccountDataType) - Description of accountData * **accountConfig** (AccountConfigType) - Description of accountConfig ### Returns Promise - A promise that resolves with the WebSettingsType. ``` -------------------------------- ### Get account details explicitly Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieve explicit account details after logging in. The `login` method itself returns account data, but `getAccountData` can be used to fetch it separately. ```APIDOC ## Get Account Details ### Description Fetches detailed account information from the DeGiro API. This method can be called after a successful login. ### Method Signature `getAccountData(): Promise` ### Example Usage ```javascript import DeGiro from 'degiro-api' (async () => { const degiro = new DeGiro({ username: 'username', pwd: '*****' }) await degiro.login() // Login also returns accountData const accountData = await degiro.getAccountData() console.log(accountData) })() ``` ``` -------------------------------- ### getWebUserSettingsRequest Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/modules/_api_getwebusersettingsrequest_.html Fetches the user's web settings. It requires account data and configuration to retrieve the settings. ```APIDOC ## getWebUserSettingsRequest ### Description Fetches the user's web settings. It requires account data and configuration to retrieve the settings. ### Method getWebUserSettingsRequest ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **accountData**: AccountDataType - Required - The account data for the user. * **accountConfig**: AccountConfigType - Required - The account configuration for the user. ### Returns Promise - A promise that resolves to the user's web settings. ### Request Example ```typescript // Example usage (assuming accountData and accountConfig are defined) // const userSettings = await getWebUserSettingsRequest(accountData, accountConfig); ``` ### Response #### Success Response (200) * **WebUserSettingType**: The type representing the user's web settings. ``` -------------------------------- ### getConfigDictionary Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/classes/_degiro_.degiro.html Fetches the configuration dictionary, which may contain various settings and parameters for the DeGiro platform. ```APIDOC ## getConfigDictionary ### Description Fetches the configuration dictionary. ### Method `getConfigDictionary()` ### Returns `Promise` ``` -------------------------------- ### Get JSESSIONID from Degiro API Instance Source: https://github.com/icastillejogomez/degiro-api/blob/master/README.md Retrieve the JSESSIONID from a Degiro API client instance. The ID is initially undefined and becomes available as a string after a successful login. ```javascript import DeGiro from 'degiro-api' const degiro = new DeGiro({}) degiro.getJSESSIONID() // undefined await degiro.login() degiro.getJSESSIONID() // string ``` -------------------------------- ### Fetch configuration dictionary using getConfigDictionary() Source: https://context7.com/icastillejogomez/degiro-api/llms.txt Returns DeGiro's internal configuration dictionary, containing lookup tables and reference data used across the platform. ```typescript import DeGiro from 'degiro-api' ;(async () => { const degiro = new DeGiro({}) await degiro.login() const dict = await degiro.getConfigDictionary() console.log(JSON.stringify(dict, null, 2)) })() ``` -------------------------------- ### getConfigDictionary Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/interfaces/_interfaces_degiroclassinterface_.degiroclassinterface.html Retrieves a dictionary containing configuration values. ```APIDOC ## getConfigDictionary ### Description Retrieves the configuration dictionary. ### Method N/A (Method signature provided) ### Returns Promise ``` -------------------------------- ### Get Account State from Degiro API Source: https://github.com/icastillejogomez/degiro-api/blob/master/README.md Fetch the current state of the user's account from the Degiro API. This method requires the user to be logged in and returns an array of state information. ```javascript import DeGiro from 'degiro-api' const degiro = new DeGiro({}) await degiro.login() const accountState = await degiro.getAccountState() console.log(accountState) ``` -------------------------------- ### Create Order Path Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/enums/_enums_degiroenums_.degiro_api_paths.html The API path to check and potentially create an order. ```APIDOC ## CREATE_ORDER_PATH ### Description The API path to check and potentially create an order. ### Endpoint v5/checkOrder ``` -------------------------------- ### Fetch user-specific web settings using getWebUserSettings() Source: https://context7.com/icastillejogomez/degiro-api/llms.txt Retrieves the current user's personalized settings on the DeGiro web platform. ```typescript import DeGiro from 'degiro-api' ;(async () => { const degiro = new DeGiro({}) await degiro.login() const userSettings = await degiro.getWebUserSettings() console.log(JSON.stringify(userSettings, null, 2)) })() ``` -------------------------------- ### Get JSESSIONID from Degiro API Source: https://github.com/icastillejogomez/degiro-api/blob/master/README.md Instantiate the DeGiro API client and log in to retrieve the JSESSIONID. This ID can be used to reuse sessions in subsequent requests, preventing repeated login/logout cycles. ```javascript import DeGiro from 'degiro-api' (async () => { const degiro = new DeGiro({}) // <-- Using ENV variables await degiro.login() // Get the jsessionId (LOOK, is not a promise) const jsessionId = degiro.getJSESSIONID() })() ``` -------------------------------- ### Enable Debug Mode Source: https://github.com/icastillejogomez/degiro-api/blob/master/README.md Activate debug logging by setting the DEGIRO_DEBUG environment variable to a truthy value before running the application. ```sh $ export DEGIRO_DEBUG=1 $ yarn start ``` -------------------------------- ### Get JSESSIONID and reuse sessions Source: https://github.com/icastillejogomez/degiro-api/blob/master/docs/index.html Retrieve the JSessionId, which is the session browser cookie used by DeGiro for authentication. This allows you to prevent excessive login/logout requests by reusing a valid JSessionID from a previous DeGiro instance. ```APIDOC ## Get JSESSIONID ### Description Retrieves the JSessionId from an authenticated DeGiro session. ### Method Signature `getJSESSIONID(): string` ### Example Usage ```javascript import DeGiro from 'degiro-api' (async () => { const degiro = new DeGiro({}) await degiro.login() const jsessionId = degiro.getJSESSIONID() console.log(jsessionId) })() ``` ## Reuse Sessions ### Description Creates a new DeGiro instance by reusing a previous JSessionID, allowing for session persistence and avoiding repeated login procedures. ### Constructor Parameters - `username` (string) - Your DeGiro username. - `pwd` (string) - Your DeGiro password. - `jsessionId` (string) - The JSessionID obtained from a previous session. ### Example Usage ```javascript import DeGiro from 'degiro-api' (async () => { const previousJSESSIONID = 'your_previous_jsessionid' const degiro = new DeGiro({ username: '', pwd: '*******', jsessionId: previousJSESSIONID }) await degiro.login() // Re-hydrates session data // Proceed with API operations })() ``` ``` -------------------------------- ### Get Account Data from Degiro API Source: https://github.com/icastillejogomez/degiro-api/blob/master/README.md Retrieve the account data from the Degiro API. This method returns a promise that resolves with the account data. Note that the `login` method also returns account data upon successful authentication. ```javascript import DeGiro from 'degiro-api' const degiro = new DeGiro({}) await degiro.login() // Login also returns accountData const accountData = await degiro.getAccountData() console.log(accountData) ```