If you’ve ever wanted to build a trading bot, stock screener, or financial dashboard for the Taiwan stock market, the Fubon Neo API (富邦新一代 API) is one of the most comprehensive options available. In this guide, I’ll walk through everything you need to get started — from authentication to querying real-time quotes, K-line data, and technical indicators.
What is Fubon Neo API?
Fubon Neo API is Fubon Securities’ official SDK for accessing Taiwan stock market data. It provides:
- Real-time market data via HTTP REST and WebSocket
- Historical OHLCV data (up to 1 year, equities back to 2010)
- Technical indicators — SMA, MACD, RSI, KDJ, Bollinger Bands
- Corporate actions — dividends, capital changes, listing applicants
- Multi-market support — TSE (上市), OTC (上櫃), ESB (興櫃), TIB (創新板), PSB (戰略新板)
The SDK (fubon-neo v2.2.8) is a Node.js/TypeScript package that works seamlessly with Bun.
Prerequisites
Before you start, you’ll need:
- A Fubon Securities account with API access enabled
- API Key — apply at https://www.fbs.com.tw/TradeAPI
- Sign the risk declaration — https://wtv.fbs.com.tw/ContractWeb/_Contract
- Download your PFX certificate for authentication
Set up your .env file:
FUBON_PERSONAL_ID= # Your ID number (身分證字號)
FUBON_API_KEY= # Your API key
FUBON_CERT_PATH= # Certificate path, e.g. .cert/fbs_XXXX.p12
FUBON_CERT_PASS= # Certificate password (usually your ID)
Quick Start
Install the SDK and initialize:
import { FubonSDK, Mode } from 'fubon-neo';
const sdk = new FubonSDK();
// Login with API key
const result = sdk.login({
personalId: process.env.FUBON_PERSONAL_ID!,
apiKey: process.env.FUBON_API_KEY!,
});
// Initialize realtime connection (required for market data)
sdk.initRealtime(Mode.Speed);
// Get the REST client
const client = sdk.marketdata.restClient.stock;
Run with Bun:
bun --env-file=.env your-script.ts
API Categories
The API is organized into six categories, all accessed via sdk.marketdata.restClient.stock:
graph TD
A[FubonSDK] --> B[marketdata.restClient.stock]
B --> C[Intraday]
B --> D[Snapshot]
B --> E[Historical]
B --> F[Technical]
B --> G[Corporate Actions]
C --> C1[tickers]
C --> C2[ticker]
C --> C3[quote]
C --> C4[candles]
C --> C5[trades]
C --> C6[volumes]
D --> D1[quotes]
D --> D2[movers]
D --> D3[actives]
E --> E1[candles]
E --> E2[stats]
F --> F1[SMA]
F --> F2[MACD]
F --> F3[RSI]
F --> F4[KDJ]
F --> F5[Bollinger Bands]
Intraday — 盤中行情
Real-time market data during trading hours (Mon-Fri 09:00–13:30 TST).
Get stock list by market:
const tickers = await client.intraday.tickers({ market: 'TSE' });
console.log(`Found ${tickers.data?.length} TSE stocks`);
// First: 2330 (台積電)
Get real-time quote with orderbook:
const quote = await client.intraday.quote({ symbol: '2330' });
console.log(`TSMC: ${quote.closePrice} (${quote.changePercent}%)`);
console.log(`Best bid: ${quote.bids[0].price} x ${quote.bids[0].size}`);
console.log(`Best ask: ${quote.asks[0].price} x ${quote.asks[0].size}`);
console.log(`Volume: ${quote.total.tradeVolume}, Value: ${quote.total.tradeValue}`);
Intraday K-line (candlestick) data:
const candles = await client.intraday.candles({
symbol: '2330',
timeframe: '5', // 1, 5, 10, 15, 30, 60 minutes
});
candles.data.forEach(bar => {
console.log(`${bar.date} O=${bar.open} H=${bar.high} L=${bar.low} C=${bar.close} V=${bar.volume}`);
});
Trade tick details:
const trades = await client.intraday.trades({ symbol: '2330' });
trades.data.forEach(t => {
console.log(`Price: ${t.price}, Size: ${t.size}, Time: ${t.time}`);
});
Price-volume distribution (分價量表):
const volumes = await client.intraday.volumes({ symbol: '2330' });
volumes.data.forEach(v => {
console.log(`Price: ${v.price}, Vol: ${v.volume}, Bid: ${v.volumeAtBid}, Ask: ${v.volumeAtAsk}`);
});
You can derive buy/sell pressure from this data:
const totalBid = volumes.data.reduce((sum, v) => sum + v.volumeAtBid, 0);
const totalAsk = volumes.data.reduce((sum, v) => sum + v.volumeAtAsk, 0);
const pressure = (totalBid - totalAsk) / (totalBid + totalAsk);
// Positive = buy pressure, Negative = sell pressure
Snapshot — 行情快照
Market-wide snapshots for ranking and screening.
// All TSE stocks snapshot
const snapQuotes = await client.snapshot.quotes({ market: 'TSE' });
// Top gainers/losers
const movers = await client.snapshot.movers({
market: 'TSE',
direction: 'up', // 'up' or 'down'
change: 'percent', // 'percent' or 'value'
});
// Most active stocks by volume/value
const actives = await client.snapshot.actives({
market: 'TSE',
trade: 'value', // 'volume' or 'value'
});
Historical — 歷史行情
Historical candle data with flexible timeframes:
// Daily candles for TSMC
const histCandles = await client.historical.candles({
symbol: '2330',
from: '2025-03-01',
to: '2025-03-10',
timeframe: 'D', // D=daily, W=weekly, M=monthly
adjusted: 'true', // Adjusted prices (v2.2.8+)
});
// 52-week statistics
const stats = await client.historical.stats({ symbol: '2330' });
console.log(`52w High: ${stats.highPrice} (${stats.highDate})`);
console.log(`52w Low: ${stats.lowPrice} (${stats.lowDate})`);
Available timeframes for historical candles:
| Timeframe | Description | Date Range |
|---|---|---|
1, 5, 10, 15, 30, 60 | Minute K-lines | Last 5 days (no from/to) |
D | Daily | Up to 1 year |
W | Weekly | Up to 1 year |
M | Monthly | Up to 1 year |
Technical Indicators — 技術指標
Built-in technical analysis, available from v2.2.6+:
// Simple Moving Average
const sma = await client.technical.sma({
symbol: '2330',
from: '2025-02-01',
to: '2025-03-10',
timeframe: 'D',
period: 20,
});
// MACD
const macd = await client.technical.macd({
symbol: '2330',
from: '2025-02-01',
to: '2025-03-10',
timeframe: 'D',
});
// RSI
const rsi = await client.technical.rsi({
symbol: '2330',
from: '2025-02-01',
to: '2025-03-10',
timeframe: 'D',
});
// KDJ
const kdj = await client.technical.kdj({
symbol: '2330',
from: '2025-02-01',
to: '2025-03-10',
timeframe: 'D',
});
// Bollinger Bands
const bbands = await client.technical.bbands({
symbol: '2330',
from: '2025-02-01',
to: '2025-03-10',
timeframe: 'D',
});
Corporate Actions — 公司資訊
Track dividends, capital changes, and listing applicants:
const dividends = await client.corporateActions.dividends();
const capitalChanges = await client.corporateActions.capitalChanges();
const listingApplicants = await client.corporateActions.listingApplicants();
Market Segments
The API covers all Taiwan market segments:
| Code | Market | Description |
|---|---|---|
TSE | 上市 | Taiwan Stock Exchange |
OTC | 上櫃 | Over-the-counter (TPEx) |
ESB | 興櫃一般板 | Emerging Stock Board |
TIB | 臺灣創新板 | Taiwan Innovation Board |
PSB | 興櫃戰略新板 | Strategic New Board |
Intraday Quote Response Fields
The intraday/quote endpoint returns the richest data. Key fields:
| Field | Description |
|---|---|
openPrice / highPrice / lowPrice / closePrice | OHLC prices |
lastPrice | Last trade price (including trial quotes) |
avgPrice | Volume-weighted average price (成交均價) |
change / changePercent | Price change / change % |
amplitude | Intraday amplitude (振幅) |
bids[] / asks[] | Best 5 bid/ask levels (price × size) |
total.tradeValue | Cumulative trade value |
total.tradeVolume | Cumulative trade volume |
total.transaction | Cumulative transaction count |
isLimitUpPrice / isLimitDownPrice | At limit up/down price |
isTrial / isContinuous | Trial quote / continuous trading |
Single Stock Detail — ticker/{symbol}
Get detailed info including regulatory flags:
const ticker = await client.intraday.ticker({ symbol: '2330' });
console.log(`Reference price: ${ticker.referencePrice}`);
console.log(`Limit up: ${ticker.limitUpPrice} / Limit down: ${ticker.limitDownPrice}`);
console.log(`Can day trade: ${ticker.canDayTrade}`);
console.log(`Short sell below flat: ${ticker.canBelowFlatMarginShortSell}`);
console.log(`Status: ${ticker.securityStatus}`); // NORMAL, TERMINATED, SUSPENDED
console.log(`Board lot: ${ticker.boardLot}`); // 1000=regular, 1=oddlot
Odd Lot Support (盤中零股)
Most intraday endpoints support odd lot queries via the type parameter:
const oddQuote = await client.intraday.quote({ symbol: '2330', type: 'oddlot' });
const oddCandles = await client.intraday.candles({ symbol: '2330', type: 'oddlot' });
const oddTicker = await client.intraday.ticker({ symbol: '2330', type: 'oddlot' });
Ticker Filtering
The intraday/tickers endpoint supports rich filtering:
// Filter by industry (e.g. 24 = 半導體/Semiconductor)
const semicon = await client.intraday.tickers({
exchange: 'TWSE',
industry: '24',
isNormal: true,
});
// Attention stocks (注意股)
const attention = await client.intraday.tickers({ isAttention: true });
// Disposition stocks (處置股)
const disposition = await client.intraday.tickers({ isDisposition: true });
Rate Limiting
The API returns HTTP 429 when rate limits are exceeded. Build retry logic into your application:
async function fetchWithRetry(fn: () => Promise<any>, retries = 3) {
for (let i = 0; i < retries; i++) {
try {
return await fn();
} catch (e: any) {
if (e.message?.includes('429') && i < retries - 1) {
await new Promise(r => setTimeout(r, 1000 * (i + 1)));
continue;
}
throw e;
}
}
}
Complete API Reference
| Category | Endpoint | Description |
|---|---|---|
| Intraday | intraday/tickers | Stock list by filters |
| Intraday | intraday/ticker/{symbol} | Single stock detail |
| Intraday | intraday/quote/{symbol} | Real-time quote + orderbook |
| Intraday | intraday/candles/{symbol} | Intraday K-line (1-60 min) |
| Intraday | intraday/trades/{symbol} | Trade tick details |
| Intraday | intraday/volumes/{symbol} | Price-volume distribution |
| Snapshot | snapshot/quotes/{market} | Market-wide snapshots |
| Snapshot | snapshot/movers/{market} | Gainers/losers ranking |
| Snapshot | snapshot/actives/{market} | Volume/value ranking |
| Historical | historical/candles/{symbol} | Historical OHLCV |
| Historical | historical/stats/{symbol} | 52-week statistics |
| Technical | technical/sma/{symbol} | Simple Moving Average |
| Technical | technical/macd/{symbol} | MACD indicator |
| Technical | technical/rsi/{symbol} | RSI indicator |
| Technical | technical/kdj/{symbol} | KDJ indicator |
| Technical | technical/bbands/{symbol} | Bollinger Bands |
| Corp Actions | corporate-actions/dividends | Dividend info |
| Corp Actions | corporate-actions/capital-changes | Capital changes |
| Corp Actions | corporate-actions/listing-applicants | Listing applicants |
Resources
- Official docs: https://www.fbs.com.tw/TradeAPI/docs
- LLM-friendly docs: https://www.fbs.com.tw/TradeAPI/llms-full.txt
- Build with LLM guide: https://www.fbs.com.tw/TradeAPI/docs/welcome/build-with-llm
- SDK on npm:
fubon-neo(v2.2.8)
Featured image generated by Nano Banana (Gemini 2.5 Flash Image) via Google AI Studio.