Tham chiếu
Mục lục
Trang này viết cho vnstock v6.0.0rc2, bản thử nghiệm. Tên hàm, tham số và cột dữ liệu có thể còn đổi trước ngày phát hành; khi cài, ghi rõ số phiên bản như ở trang Cài đặt. Bản đang phát hành chính thức là v5.0.1, xem tài liệu bản đó.
Chọn nguồn bạn có khoá, mã trên trang sẽ điền theo. Chưa chọn thì mã giữ chỗ trống <nguồn>. Nguồn xếp theo bảng chữ cái, không phải khuyến nghị.
Reference dùng để truy xuất dữ liệu tham chiếu: danh sách mã theo sàn và loại tài sản, thành phần rổ
chỉ số, ngành, lịch sự kiện, thông tin doanh nghiệp, quỹ mở, phiên và ngày giao dịch.
Cách gọi
from vnstock import Reference
Reference("<nguồn>").equity.list(exchange="HOSE")Các hàm dưới đây mỗi hàm chỉ có ở một nguồn, nên ví dụ ghi thẳng tên nguồn đó:
from vnstock import Reference
Reference("ssi").index("VN30").members()
Reference("fhsc").company("FPT").info()
Reference("dnse").market.trading_days(start="2026-11-01", end="2026-12-31")
Reference("fmp").search.symbol("AAPL")
Reference().index.groups() # bảng có sẵn trong thư viện, không cần nguồnNhóm cần mã thì gọi kèm mã: company("FPT"), index("VN30"). Không nêu nguồn thì vnstock dùng quy
tắc đặt bằng vnstock.sources (Chọn nguồn).
Reference(...).etf.list(), .bond.list(), .warrant.list() và .futures.list() cùng đọc danh sách
mã, sau đó lọc theo loại tài sản trong cột type.
Các tham số chung source, compat, columns dùng như ở Thị trường.
Hàm theo nhóm
Bảng sinh từ thư viện bản 6.0.0.dev0, hồ sơ v5 (mặc định). "Tên khác" là tên của thế hệ 5 cho cùng dữ liệu.
Danh sách đầy đủ trên máy bạn: vnstock tools, hoặc show_api() trong Python.
Cổ phiếu (equity)
| Hàm | Tên khác | Tham số | Nguồn (source=) |
|---|---|---|---|
by_group() | list_by_group | ssi | |
list() | by_exchange, list_by_exchange, list_by_industry | exchange, type, group | dnse, ssi |
price_limits() | date, exchange, board | dnse, ssi | |
status() | board | dnse |
Cột trả về (hồ sơ v5, mặc định)
| Hàm | Cột |
|---|---|
by_group() | symbol, index_symbol |
list() | symbol, exchange, type, organ_name, organ_short_name, icb_code, icb_name, name_en, listing_date, listed_shares, lot_size |
price_limits() | trading_date, symbol, exchange, board, reference_price, ceiling_price, floor_price |
status() | symbol, board, time, trading_status, admin_status, trading_method_status, sanction_status |
Chứng chỉ quỹ ETF (etf)
| Hàm | Tên khác | Tham số | Nguồn (source=) |
|---|---|---|---|
list() | exchange, type, group | dnse, ssi |
Cột trả về (hồ sơ v5, mặc định)
| Hàm | Cột |
|---|---|
list() | symbol, exchange, type, organ_name, organ_short_name, icb_code, icb_name, name_en, listing_date, listed_shares, lot_size |
Trái phiếu (bond)
| Hàm | Tên khác | Tham số | Nguồn (source=) |
|---|---|---|---|
list() | exchange, type, group | dnse, ssi |
Cột trả về (hồ sơ v5, mặc định)
| Hàm | Cột |
|---|---|
list() | symbol, exchange, type, organ_name, organ_short_name, icb_code, icb_name, name_en, listing_date, listed_shares, lot_size |
Chỉ số (index)
| Hàm | Tên khác | Tham số | Nguồn (source=) |
|---|---|---|---|
groups() | có sẵn, không cần nguồn | ||
info() | description | ssi | |
list() | exchange | fhsc, ssi | |
members() | by_group, list_by_group | ssi |
Cột trả về (hồ sơ v5, mặc định)
| Hàm | Cột |
|---|---|
groups() | group_name, group_code, category, description |
info() | symbol, name, exchange |
list() | symbol, name, description, full_name, group, index_id, sector_id, exchange |
members() | symbol, index_symbol |
Hợp đồng tương lai (futures)
| Hàm | Tên khác | Tham số | Nguồn (source=) |
|---|---|---|---|
info() | tcbs | ||
list() | exchange, type, group | dnse, ssi |
Cột trả về (hồ sơ v5, mặc định)
| Hàm | Cột |
|---|---|
info() | symbol, underlying_symbol, last_trading_date, continuous_symbol, name, listing_date |
list() | symbol, exchange, type, organ_name, organ_short_name, icb_code, icb_name, name_en, listing_date, listed_shares, lot_size |
Chứng quyền (warrant)
| Hàm | Tên khác | Tham số | Nguồn (source=) |
|---|---|---|---|
info() | ssi | ||
list() | exchange, type, group | dnse, ssi |
Cột trả về (hồ sơ v5, mặc định)
| Hàm | Cột |
|---|---|
info() | symbol, name, isin, issuer, underlying_symbol, exercise_price, exercise_ratio, first_trading_date, last_trading_date, maturity_date, listed_share, exchange, warrant_type |
list() | symbol, exchange, type, organ_name, organ_short_name, icb_code, icb_name, name_en, listing_date, listed_shares, lot_size |
Quỹ mở (fund)
| Hàm | Tên khác | Tham số | Nguồn (source=) |
|---|---|---|---|
list() | fhsc | ||
nav_report() | start, end | fhsc | |
profile() | fhsc |
Cột trả về (hồ sơ v5, mặc định)
| Hàm | Cột |
|---|---|
list() | ticker, organ_name, fund_type, name, valuation_frequency |
nav_report() | time, nav |
profile() | ticker, total_assets, nav, nav_update_at, name |
Doanh nghiệp (company)
| Hàm | Tên khác | Tham số | Nguồn (source=) |
|---|---|---|---|
events() | start, end | fhsc, ssi | |
info() | overview | fhsc | |
insider_trading() | start, end | fhsc | |
ownership() | fhsc | ||
shareholders() | fhsc | ||
trading_stats() | start, end, length, limit | ssi |
Cột trả về (hồ sơ v5, mặc định)
| Hàm | Cột |
|---|---|
events() | symbol, event_title, ex_right_date, record_date, payout_date, value, ratio, issue_date, event_type, ratio_text, dividend_percent, exercise_price |
info() | symbol, name, sector, profile, name_en |
insider_trading() | id, symbol, person_name, position, transaction_type, registered_volume, traded_volume, start_date, end_date, status, shares_before, shares_after, ownership_percent_before, ownership_percent_after, relation_type, related_person_name |
ownership() | symbol, owner_type, ownership_percentage, shares_owned |
shareholders() | symbol, name, shareholder_type, total_shares, rate, date |
trading_stats() | symbol, time, average_match_volume, average_match_value, average_deal_volume, average_deal_value, average_volume, average_value, total_match_volume, total_match_value, total_deal_volume, total_deal_value, total_volume, total_value, fr_buy_volume_total, fr_buy_value_total, fr_sell_volume_total, fr_sell_value_total, fr_net_volume_total, fr_net_value_total, fr_buy_volume_total_avg, fr_buy_value_total_avg, fr_sell_volume_total_avg, fr_sell_value_total_avg, fr_net_volume_total_avg, fr_net_value_total_avg, total_buy_trade_volume, total_sell_trade_volume, total_buy_trade_volume_avg, total_sell_trade_volume_avg, total_buy_trade, total_sell_trade, total_buy_trade_avg, total_sell_trade_avg, total_net_trade_volume, total_net_trade_volume_avg, average_buy_volume_per_trade, average_sell_volume_per_trade, close_price, reference_price |
Sự kiện doanh nghiệp (events)
| Hàm | Tên khác | Tham số | Nguồn (source=) |
|---|---|---|---|
calendar() | start, end | fhsc, ssi | |
market() | exchange | fmp |
Cột trả về (hồ sơ v5, mặc định)
| Hàm | Cột |
|---|---|
calendar() | symbol, event_title, ex_right_date, record_date, payout_date, value, ratio, issue_date, event_type, ratio_text, dividend_percent, exercise_price |
market() | date, event_name, venue, is_closed |
Ngành (industry)
| Hàm | Tên khác | Tham số | Nguồn (source=) |
|---|---|---|---|
list() | ssi | ||
sectors() | exchange, type, group | dnse, ssi |
Cột trả về (hồ sơ v5, mặc định)
| Hàm | Cột |
|---|---|
list() | icb_code, icb_name, icb_level |
sectors() | symbol, exchange, type, organ_name, organ_short_name, icb_code, icb_name, name_en, listing_date, listed_shares, lot_size |
Phiên và ngày giao dịch (market)
| Hàm | Tên khác | Tham số | Nguồn (source=) |
|---|---|---|---|
sessions() | exchange, board | dnse | |
status() | fhsc | ||
trading_days() | start, end | dnse |
Cột trả về (hồ sơ v5, mặc định)
| Hàm | Cột |
|---|---|
sessions() | exchange, board, product_group, session_id, event, time |
status() | exchange, status, timestamp, last_trading_date |
trading_days() | trading_date |
Tìm mã (search)
| Hàm | Tên khác | Tham số | Nguồn (source=) |
|---|---|---|---|
symbol() | info | limit | fmp |
Cột trả về (hồ sơ v5, mặc định)
| Hàm | Cột |
|---|---|
symbol() | symbol, name, exchange, currency |
Chưa hỗ trợ
Hàm thế hệ 5 chưa có nguồn đọc được ở thế hệ 6 báo CompatibilityWarning rồi UnsupportedError mã
VNSTOCK_ROUTE_UNSUPPORTED. Hàm đã ngừng từ thế hệ 5 báo VNSTOCK_ROUTE_REMOVED.
Reference("<nguồn>").equity.list(group="VN30") lọc danh sách theo rổ ngay ở nguồn, với nguồn hỗ trợ lọc theo rổ
(dnse không lọc được theo rổ và báo lỗi). Các hàm nhóm nhận mã theo vị trí như thế hệ 5 (Reference().fund.profile("DCDS")), theo tên
(symbol="DCDS"), hoặc gọi kèm mã: Reference().index("VN30").members().
