Indonesian Stock Exchange API wrapper for trading data integration.
Indonesian Stock Exchange API Wrapper
A data pipeline for the Indonesian Stock Exchange (IDX). Built with Deno and Drizzle ORM to sync official market data into a structured SQLite database. It includes automated retries for network stability and provides modules for company info, indices, and trading data.
Features
- Automated Sync - Scheduled data synchronization with retry logic
- Official IDX Data - Direct integration with Indonesian Stock Exchange APIs
- Structured Storage - SQLite database with Drizzle ORM for type-safe queries
Installation
[!NOTE]
Prerequisites: For Deno (install from deno.com).
[!TIP]
Want to see the data in action? Check out IDX-UI - the interactive dashboard for your market data!
Clone Repository:
# Clone the repository
git clone https://github.com/NeaByteLab/IDX-API.git
Enter the project directory
cd IDX-API/
Initialize the database (Drizzle generate & push)
deno task db:sync
Requirements:
- Deno (v2.5.0 or higher recommended)
- Git (for cloning the repository)
Technology Stack
- Runtime: Deno (Modern, Secure, High-Performance)
- Database: SQLite via LibSQL Client
- ORM: Drizzle ORM (Type-Safe SQL ORM)
Architecture Overview
flowchart TD
%% Define Nodes
A[(Local SQLite DB)]:::db
B(Drizzle Schema Sync):::process
C[IDX API Endpoints]:::api
D(BaseClient Fetcher):::process
E{Data Valid?}:::decision
F(Data Processing):::process
G(Drizzle Upsert):::process
H[Your Application / CLI]:::app
%% Define Flow B -->|Setup Tables| A C -.->|HTTP Res| D D -->|Raw JSON| E E -->|No: Retry| D E -->|Yes: Parse| F F -->|Clean Data| G G -->|Store| A A -->|Query| H
%% Styling classDef db fill:#e0f7fa,stroke:#006064,stroke-width:2px,color:#000000; classDef process fill:#f5f5f5,stroke:#9e9e9e,color:#000000; classDef api fill:#fff3e0,stroke:#e65100,stroke-dasharray: 5 5,color:#000000; classDef decision fill:#e8f5e9,stroke:#2e7d32,color:#000000,shape:rhombus; classDef app fill:#ede7f6,stroke:#4527a0,stroke-width:2px,color:#000000;
Quick Start
import * as sync from '@app/Backend/Sync/index.ts'
import IDXClient from '@app/index.ts'
// Initialize database (run once) await sync.dbInitialize()
// Sync company profiles await sync.syncCompanyProfile()
// Get current market data const client = new IDXClient() const indices = await client.market.getIndexList() const stockSummary = await client.trading.getStockSummary('20240220')
For detailed usage examples, see USAGE.md.
Module Overview
Corporate Modules:
syncCompanyProfile()- Company metadata and profilessyncCompanyAnnouncement()- Corporate news and announcementssyncFinancialRatio()- Financial indicators (PER, PBV, ROE, DER)syncFinancialReport()- Detailed financial reportssyncCompanyDividend()- Dividend payment datasyncStockSplit()- Stock split eventssyncNewListing()- IPO and new listingssyncCompanyDelisting()- Delisted companies
syncDailyIndex()- Daily index performancesyncIndexList()- Current index pricessyncIndexSummary()- Daily index snapshotssyncForeignTrading()- Foreign investor flowssyncTopGainer()- Top gaining stockssyncTopLoser()- Top losing stocks
syncStockSummary()- Daily OHLC and volume datasyncTradeSummary()- Market aggregate datasyncBrokerSummary()- Broker trading activitysyncTradingDaily()- Real-time price snapshotssyncTradingSS()- Historical trading data
syncBrokerParticipant()- Exchange member brokerssyncDealerParticipant()- Primary dealerssyncProfileParticipant()- Participant profiles
syncMarketCalendar()- Trading holidays and eventssyncSecurityStock()- Master security list
Project Structure
.
├── src/ # Core modules and backend implementation
│ ├── Backend/ # Task automation, schemas, and sync logic
│ ├── Company/ # Corporate information endpoints
│ ├── Market/ # Market and index endpoints
│ ├── Participants/ # Broker and dealer endpoints
│ ├── Statistics/ # Stock activity endpoints
│ ├── Trading/ # Trading summary endpoints
│ └── Client.ts # Main API client wrapper
├── tests/ # Deno unit test suites
├── sample/ # Generator for sample documentation
└── data/ # SQLite database storage
License
This project is licensed under the MIT license. See the LICENSE file for more info.