# apolofx/iol-api-node-wrapper architecture

> Architecture diagram of the GitHub repository apolofx/iol-api-node-wrapper, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/apolofx/iol-api-node-wrapper
- Repository: https://github.com/apolofx/iol-api-node-wrapper

## Overview

IOL API NodeJS Wrapper is a TypeScript client for Invertir Online. A consumer creates an authenticated IolClient and calls account, operation, trading, or market-data methods; those methods make requests to IOL and return typed results. Authentication obtains or refreshes tokens, while the shared HTTP layer handles response data and errors. The README documents the capabilities represented here; unsampled type declarations and endpoint coverage are grouped at their source directories, and edges are limited to relationships shown in excerpts or README statements.

Main entry points: [`src/api/api-main.ts`](https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts) (IolClient), [`src/api/auth.ts`](https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/auth.ts) (Token authentication), [`src/api/http-client.ts`](https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/http-client.ts) (HTTP client), [`src/config/constants.ts`](https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/config/constants.ts) (Endpoint configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client and transport"]
  node_iol_client["IolClient<br/>[api-main.ts]"]
  node_authentication["Token authentication<br/>[auth.ts]"]
  node_http_client["HTTP client<br/>[http-client.ts]"]
  node_endpoint_config["Endpoint configuration<br/>[constants.ts]"]
end

subgraph group_account["Account and operations"]
  node_account_status["Account status<br/>[api-main.ts]"]
  node_portfolio["Portfolio<br/>[api-main.ts]"]
  node_operations["Operations queries<br/>[api-main.ts]"]
  node_operation_cancel["Operation cancellation<br/>[api-main.ts]"]
end

subgraph group_trading["Trading"]
  node_order_trading["Buy and sell<br/>[api-main.ts]"]
  node_fci_trading["FCI subscription and rescue<br/>[api-main.ts]"]
end

subgraph group_market["Securities and market data"]
  node_fci_catalog["FCI catalog<br/>[api-main.ts]"]
  node_price_options["Prices and options<br/>[api-main.ts]"]
  node_quotes["Market quotes<br/>[api-main.ts]"]
end

subgraph group_contracts["API contracts"]
  node_response_types["Response and request types"]
end

node_consumer(("Library consumer"))
node_iol_api{{"Invertir Online API"}}

node_consumer -->|"calls"| node_iol_client
node_iol_client -->|"gets tokens"| node_authentication
node_iol_client -->|"extends"| node_http_client
node_authentication -->|"extends"| node_http_client
node_iol_client -->|"uses routes"| node_endpoint_config
node_authentication -->|"requests tokens"| node_iol_api
node_account_status -->|"requests status"| node_iol_api
node_portfolio -->|"requests portfolio"| node_iol_api
node_operations -->|"queries operations"| node_iol_api
node_operation_cancel -->|"cancels operation"| node_iol_api
node_order_trading -->|"submits orders"| node_iol_api
node_fci_trading -->|"submits FCI actions"| node_iol_api
node_fci_catalog -->|"requests funds"| node_iol_api
node_price_options -->|"requests prices"| node_iol_api
node_quotes -->|"requests quotes"| node_iol_api

click node_iol_client "https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts"
click node_authentication "https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/auth.ts"
click node_http_client "https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/http-client.ts"
click node_endpoint_config "https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/config/constants.ts"
click node_account_status "https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts"
click node_portfolio "https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts"
click node_operations "https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts"
click node_operation_cancel "https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts"
click node_order_trading "https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts"
click node_fci_trading "https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts"
click node_fci_catalog "https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts"
click node_price_options "https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts"
click node_quotes "https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts"
click node_response_types "https://github.com/apolofx/iol-api-node-wrapper/tree/main/src/types"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_iol_client,node_authentication,node_http_client,node_endpoint_config toneBlue
class node_account_status,node_portfolio,node_operations,node_operation_cancel toneAmber
class node_order_trading,node_fci_trading,node_iol_api toneMint
class node_fci_catalog,node_price_options,node_quotes toneRose
class node_response_types,node_consumer toneIndigo
```

## Components

### Client and transport

- [IolClient](https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts): `src/api/api-main.ts`
- [Token authentication](https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/auth.ts): `src/api/auth.ts`
- [HTTP client](https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/http-client.ts): `src/api/http-client.ts`
- [Endpoint configuration](https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/config/constants.ts): `src/config/constants.ts`

### Account and operations

- [Account status](https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts): `src/api/api-main.ts`
- [Portfolio](https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts): `src/api/api-main.ts`
- [Operations queries](https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts): `src/api/api-main.ts`
- [Operation cancellation](https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts): `src/api/api-main.ts`

### Trading

- [Buy and sell](https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts): `src/api/api-main.ts`
- [FCI subscription and rescue](https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts): `src/api/api-main.ts`

### Securities and market data

- [FCI catalog](https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts): `src/api/api-main.ts`
- [Prices and options](https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts): `src/api/api-main.ts`
- [Market quotes](https://github.com/apolofx/iol-api-node-wrapper/blob/main/src/api/api-main.ts): `src/api/api-main.ts`

### API contracts

- [Response and request types](https://github.com/apolofx/iol-api-node-wrapper/tree/main/src/types): `src/types`

### Other components

- **Library consumer**
- **Invertir Online API**

## Connections

- Library consumer → IolClient: calls (evidence: `README.md`)
- IolClient → Token authentication: gets tokens (evidence: `src/api/api-main.ts`)
- IolClient → HTTP client: extends (evidence: `src/api/api-main.ts`)
- Token authentication → HTTP client: extends (evidence: `src/api/auth.ts`)
- IolClient → Endpoint configuration: uses routes (evidence: `src/api/api-main.ts`)
- Token authentication → Invertir Online API: requests tokens (evidence: `src/api/auth.ts`)
- Account status → Invertir Online API: requests status (evidence: `src/api/api-main.ts`)
- Portfolio → Invertir Online API: requests portfolio (evidence: `src/api/api-main.ts`)
- Operations queries → Invertir Online API: queries operations (evidence: `src/api/api-main.ts`)
- Operation cancellation → Invertir Online API: cancels operation (evidence: `README.md`)
- Buy and sell → Invertir Online API: submits orders (evidence: `src/api/api-main.ts`)
- FCI subscription and rescue → Invertir Online API: submits FCI actions (evidence: `src/api/api-main.ts`)
- FCI catalog → Invertir Online API: requests funds (evidence: `src/api/api-main.ts`)
- Prices and options → Invertir Online API: requests prices (evidence: `src/api/api-main.ts`)
- Market quotes → Invertir Online API: requests quotes (evidence: `src/api/api-main.ts`)
