vnstock-js

vnstock-js

Tài LiệuVí DụBài ViếtTài Chính
k

© Copyright 2026

Giới Thiệu
Danh Sách Hàm
Cài Đặt
Kiến Trúc
Hướng Dẫn Sử Dụng Nhanh
CLI
Lịch Sử Phiên Bản
Câu Hỏi Thường Gặp
Cơ Bản
QuoteHistory
PriceBoardItem
TopStock
CompanyProfile
ScreenResult
RealtimeQuote
ExchangeRate
  1. Tài Liệu
  2. Key Features
  3. Advanced
  4. Indicators

Chỉ Báo Kỹ Thuật - Indicators

SMA, EMA, RSI

Các chỉ báo kỹ thuật là pure functions, nhận QuoteHistory[] và trả kết quả.

import { sma, ema, rsi } from 'vnstock-js';

SMA - Simple Moving Average

const history = await vnstock.stock.quote.history({
  symbols: ['FPT'], start: '2024-01-01', timeFrame: '1D'
});

const sma20 = sma(history, { period: 20 });
// → [{ date: "2024-01-15", sma: null }, ..., { date: "2024-02-15", sma: 25.6 }, ...]

// SMA theo volume
const volumeSma = sma(history, { period: 10, field: 'volume' });

EMA - Exponential Moving Average

const ema12 = ema(history, { period: 12 });
// → [{ date: "...", ema: null }, ..., { date: "...", ema: 25.8 }, ...]

RSI - Relative Strength Index

const rsi14 = rsi(history); // period mặc định = 14
// → [{ date: "...", rsi: null }, ..., { date: "...", rsi: 65.3 }, ...]

const rsi7 = rsi(history, { period: 7 });

Note:

Giá trị null ở đầu mảng là do chưa đủ dữ liệu để tính. Ví dụ SMA(20) cần tối thiểu 20 điểm dữ liệu.

PreviousTài Chính - Financials
NextSàng Lọc - Screening

Nội Dung

SMA - Simple Moving AverageEMA - Exponential Moving AverageRSI - Relative Strength Index