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. Basic

Hướng dẫn sử dụng hàm cơ bản

Các hàm cơ bản của vnstock-js

import { stock, commodity } from 'vnstock-js';

Dữ liệu chỉ số VNINDEX

const indexPrices = await stock.index({ index: 'VNINDEX', start: '2024-01-01' });
// → [{ date: "2024-01-02", open: 1.18, high: 1.19, low: 1.17, close: 1.185, volume: 500000000 }, ...]

Dữ liệu giá cổ phiếu VCI

const tickerPrices = await stock.quote({ ticker: 'VCI', start: '2024-01-01' });
// → [{ date: "2024-01-02", open: 25.5, high: 26.0, low: 25.0, close: 25.8, volume: 1000000 }, ...]

Bảng giá

const priceBoard = await stock.priceBoard({ ticker: 'VCI' });
// → [{ symbol: "VCI", price: 25.8, totalVolume: 500000, ceilingPrice: 27.5, ... }]

Top tăng/giảm

const gainers = await stock.topGainers();
const losers = await stock.topLosers();
// → [{ symbol: "FPT", exchange: "HOSE", marketCap: 95000, ... }]

Thông tin công ty VCI

const company = stock.company({ ticker: 'VCI' });
const profile = await company.profile();
// → { industry: "Chứng khoán", issuedShares: 500000000, ... }

const shareholders = await company.shareholders();
// → [{ name: "...", percentage: 0.15, ... }]

Báo cáo tài chính

const financials = await stock.financials({ ticker: 'VCI', period: 'quarter' });
// → { data: { symbol: "VCI", year: 2024, quarter: 4, roe: 0.22, ... }, mapping: { ... } }

Sàng lọc cổ phiếu

const screened = await stock.screening({
  exchange: 'HOSE',
  filters: [{ field: 'pe', operator: '<', value: 15 }],
  sortBy: 'roe',
  order: 'desc',
  limit: 10,
});
// → [{ symbol: "FPT", pe: 12, roe: 0.22, marketCap: 95000, ... }]

Dữ liệu vàng

const goldSJC = await commodity.gold.priceSJC();
// → [{ type: "SJC 1L", buyPrice: 92000000, sellPrice: 94000000, ... }]

const goldBTMC = await commodity.gold.priceBTMC();
const goldGVN = await commodity.gold.priceGiaVangNet();

Tỷ giá ngoại tệ

const rates = await commodity.exchange();
// → [{ currencyCode: "USD", currencyName: "US Dollar", buyCash: "25100", sell: "25450" }]
PreviousCâu Hỏi Thường Gặp
NextNâng Cao

Nội Dung

Dữ liệu chỉ số VNINDEXDữ liệu giá cổ phiếu VCIBảng giáTop tăng/giảmThông tin công ty VCIBáo cáo tài chínhSàng lọc cổ phiếuDữ liệu vàngTỷ giá ngoại tệ