# leo4815162342/dukascopy-node architecture

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

- Interactive diagram: https://gitdiagram.com/leo4815162342/dukascopy-node
- Repository: https://github.com/leo4815162342/dukascopy-node

## Overview

dukascopy-node is a Node.js library and CLI for downloading historical and real-time market-price data across many instrument classes. Its documented workflow accepts an instrument, date range, timeframe and output options, then retrieves and processes tick or candle data for return or file output. The tree identifies distinct validation, date, URL, fetch, normalization, aggregation and formatting stages. Sampled source confirms URL construction, fetching/cache behavior, normalization, aggregation and output responsibilities; orchestration links not evident in the excerpts are left out.

Main entry points: [`src/buffer-fetcher/index.ts`](https://github.com/leo4815162342/dukascopy-node/blob/master/src/buffer-fetcher/index.ts) (Batched buffer fetch), [`src/url-generator/index.ts`](https://github.com/leo4815162342/dukascopy-node/blob/master/src/url-generator/index.ts) (Data URL generation), [`src/getHistoricalRates.ts`](https://github.com/leo4815162342/dukascopy-node/blob/master/src/getHistoricalRates.ts) (Historical rates API), [`src/getRealTimeRates.ts`](https://github.com/leo4815162342/dukascopy-node/blob/master/src/getRealTimeRates.ts) (Real-time rates API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_historical["Historical rates API"]
  node_realtime["Real-time rates API"]
  node_cli["CLI interface<br/>[index.ts]"]
end

subgraph group_request["Request planning"]
  node_config["Request configuration<br/>[index.ts]"]
  node_validator["Config validation<br/>[index.ts]"]
  node_dates["Date normalization<br/>[index.ts]"]
  node_urls["Data URL generation<br/>[index.ts]"]
  node_metadata["Instrument metadata"]
end

subgraph group_retrieval["Data retrieval"]
  node_fetcher["Batched buffer fetch<br/>[index.ts]"]
  node_cache[("Response cache<br/>[index.ts]")]
end

subgraph group_transform["Data processing"]
  node_processor["Data processing<br/>[index.ts]"]
  node_normaliser["Response normalization<br/>[index.ts]"]
  node_aggregator["Timeframe aggregation<br/>[index.ts]"]
end

subgraph group_delivery["Output delivery"]
  node_formatter["Result formatting<br/>[index.ts]"]
  node_writer["Streaming file output<br/>[index.ts]"]
  node_printer["CLI display<br/>[printer.ts]"]
end

node_user(("Library or CLI user"))
node_dukascopy{{"Dukascopy data API"}}

node_user -->|"requests history"| node_historical
node_user -->|"requests live data"| node_realtime
node_user -->|"runs command"| node_cli
node_urls -->|"reads instrument data"| node_metadata
node_fetcher -->|"fetches URLs"| node_dukascopy
node_fetcher -->|"reads and writes"| node_cache

click node_historical "https://github.com/leo4815162342/dukascopy-node/blob/master/src/getHistoricalRates.ts"
click node_realtime "https://github.com/leo4815162342/dukascopy-node/blob/master/src/getRealTimeRates.ts"
click node_cli "https://github.com/leo4815162342/dukascopy-node/blob/master/src/cli/index.ts"
click node_config "https://github.com/leo4815162342/dukascopy-node/blob/master/src/config/index.ts"
click node_validator "https://github.com/leo4815162342/dukascopy-node/blob/master/src/config-validator/index.ts"
click node_dates "https://github.com/leo4815162342/dukascopy-node/blob/master/src/dates-normaliser/index.ts"
click node_urls "https://github.com/leo4815162342/dukascopy-node/blob/master/src/url-generator/index.ts"
click node_metadata "https://github.com/leo4815162342/dukascopy-node/blob/master/src/config/instruments-metadata.ts"
click node_fetcher "https://github.com/leo4815162342/dukascopy-node/blob/master/src/buffer-fetcher/index.ts"
click node_cache "https://github.com/leo4815162342/dukascopy-node/blob/master/src/cache-manager/index.ts"
click node_processor "https://github.com/leo4815162342/dukascopy-node/blob/master/src/processor/index.ts"
click node_normaliser "https://github.com/leo4815162342/dukascopy-node/blob/master/src/data-normaliser/index.ts"
click node_aggregator "https://github.com/leo4815162342/dukascopy-node/blob/master/src/aggregator/index.ts"
click node_formatter "https://github.com/leo4815162342/dukascopy-node/blob/master/src/output-formatter/index.ts"
click node_writer "https://github.com/leo4815162342/dukascopy-node/blob/master/src/stream-writer/index.ts"
click node_printer "https://github.com/leo4815162342/dukascopy-node/blob/master/src/cli/printer.ts"

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_historical,node_realtime,node_cli,node_user toneBlue
class node_config,node_validator,node_dates,node_urls,node_metadata toneAmber
class node_fetcher,node_cache,node_dukascopy toneMint
class node_processor,node_normaliser,node_aggregator toneRose
class node_formatter,node_writer,node_printer toneIndigo
```

## Components

### User interfaces

- [Historical rates API](https://github.com/leo4815162342/dukascopy-node/blob/master/src/getHistoricalRates.ts): `src/getHistoricalRates.ts`
- [Real-time rates API](https://github.com/leo4815162342/dukascopy-node/blob/master/src/getRealTimeRates.ts): `src/getRealTimeRates.ts`
- [CLI interface](https://github.com/leo4815162342/dukascopy-node/blob/master/src/cli/index.ts): `src/cli/index.ts`

### Request planning

- [Request configuration](https://github.com/leo4815162342/dukascopy-node/blob/master/src/config/index.ts): `src/config/index.ts`
- [Config validation](https://github.com/leo4815162342/dukascopy-node/blob/master/src/config-validator/index.ts): `src/config-validator/index.ts`
- [Date normalization](https://github.com/leo4815162342/dukascopy-node/blob/master/src/dates-normaliser/index.ts): `src/dates-normaliser/index.ts`
- [Data URL generation](https://github.com/leo4815162342/dukascopy-node/blob/master/src/url-generator/index.ts): `src/url-generator/index.ts`
- [Instrument metadata](https://github.com/leo4815162342/dukascopy-node/blob/master/src/config/instruments-metadata.ts): `src/config/instruments-metadata.ts`

### Data retrieval

- [Batched buffer fetch](https://github.com/leo4815162342/dukascopy-node/blob/master/src/buffer-fetcher/index.ts): `src/buffer-fetcher/index.ts`
- [Response cache](https://github.com/leo4815162342/dukascopy-node/blob/master/src/cache-manager/index.ts): `src/cache-manager/index.ts`

### Data processing

- [Data processing](https://github.com/leo4815162342/dukascopy-node/blob/master/src/processor/index.ts): `src/processor/index.ts`
- [Response normalization](https://github.com/leo4815162342/dukascopy-node/blob/master/src/data-normaliser/index.ts): `src/data-normaliser/index.ts`
- [Timeframe aggregation](https://github.com/leo4815162342/dukascopy-node/blob/master/src/aggregator/index.ts): `src/aggregator/index.ts`

### Output delivery

- [Result formatting](https://github.com/leo4815162342/dukascopy-node/blob/master/src/output-formatter/index.ts): `src/output-formatter/index.ts`
- [Streaming file output](https://github.com/leo4815162342/dukascopy-node/blob/master/src/stream-writer/index.ts): `src/stream-writer/index.ts`
- [CLI display](https://github.com/leo4815162342/dukascopy-node/blob/master/src/cli/printer.ts): `src/cli/printer.ts`

### Other components

- **Library or CLI user**
- **Dukascopy data API**

## Connections

- Library or CLI user → Historical rates API: requests history
- Library or CLI user → Real-time rates API: requests live data
- Library or CLI user → CLI interface: runs command
- Data URL generation → Instrument metadata: reads instrument data
- Batched buffer fetch → Dukascopy data API: fetches URLs
- Batched buffer fetch → Response cache: reads and writes
