Fetch Vietnam stock market data from public sources.
Core features
| Feature | Business impact |
|---|---|
| Symbol information | Research stocks and ETFs with profiles, exchanges, instrument types, indices, and industries. |
| Ticker quotes | Fetch a ticker's quote to support market monitoring and pricing views. |
| Ticker history | Fetch historical market data for trend analysis, investment research, and backtesting. |
Usage
Stock lookups are asynchronous. Tickers can be written as BID, HOSE:BID, or
BID.VN; case and surrounding whitespace are ignored.
By default, missing data and stock lookup failures return None. To receive
lookup exceptions instead, pass raise_on_error=True.
Research a company's profile
Use stocks.get_info to retrieve the company name, listing exchange, and
available industry classifications.
import asyncio
from vfinance import stocks
async def main() -> None:
info = await stocks.get_info("HOSE:BID")
if info is None:
print("Company profile is unavailable.")
else:
print(f"{info.symbol} ({info.exchange}): {info.name}")
if info.industry is not None:
print(f"Industry: {info.industry}")
asyncio.run(main())
View the latest available quote
Use stocks.get_quote to view the latest available market price, OHLC prices,
and traded volume.
import asyncio
from vfinance import stocks
async def main() -> None:
quote = await stocks.get_quote("BID")
if quote is None:
print("Quote is unavailable.")
else:
print(f"Market price: {quote.market_price:,.0f} VND")
print(f"As of: {quote.timestamp_str}")
print("OHLC:", quote.open, quote.high, quote.low, quote.close)
print(f"Volume: {quote.volume:,} traded units")
asyncio.run(main())
Prices are in VND per traded unit; volume counts traded units. A closing price can
be None if it has not been finalized.
Analyze daily price history
Use stocks.get_history to retrieve daily quotes for a calendar-day window.
import asyncio
from vfinance import stocks
async def main() -> None:
history = await stocks.get_history("BID.VN", num_days=30)
if history is None:
print("History is unavailable.")
elif not history:
print("No daily quotes in this period.")
else:
for day in history:
print(day.timestamp.date(), day.close, day.volume)
asyncio.run(main())
History is ordered oldest to newest and covers calendar days, not a fixed number
of trading sessions. The default window is 30 days, ending before today's
midnight in Asia/Ho_Chi_Minh; requests are limited to the last five years. A
successful lookup with no quotes in the selected period returns [].
Keep ticker identifiers consistent across datasets
Use utils.normalize_ticker to turn supported ticker formats into a consistent
bare symbol.
from vfinance.utils import normalize_ticker
print(normalize_ticker("BID"))
print(normalize_ticker("HOSE:BID"))
print(normalize_ticker("BID.VN"))
Each call returns BID.
Export results as JSON
Profiles and quotes can be exported as JSON, including ISO-formatted timestamps for quotes. For example, export BID's latest available quote:
import asyncio
from vfinance import stocks
async def main() -> None:
quote = await stocks.get_quote("BID")
if quote is not None:
print(quote.model_dump_json(indent=2))
asyncio.run(main())
Data Coverage, Limitations and Disclaimer
Data coverage
vfinance covers stocks traded on Vietnam's HOSE, HNX, and UPCOM
markets.
Limitations
- Data is fetched from public sources/APIs, and availability depends on those providers.
- Results are cached for a limited period to reduce repeated requests and help avoid overloading public sources/APIs.
- Quotes are not guaranteed to be real-time and may be delayed. Their freshness depends on the underlying sources and their update frequency.
Disclaimer
Data is provided "as is". vfinance and its maintainers make no guarantees
about its quality, accuracy, completeness, or timeliness, and accept no
responsibility for the quality or correctness of the data. Verify data
independently before relying on it.
License
This package is licensed under the MIT License - see the LICENSE.md file for details.
Contributing & Support
Feel free to create pull requests or issues to report bugs or suggest new features.
Metadata
Release files for vfinance 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vfinance-0.1.0.tar.gz | 94.4 kB | Without provenance | Details for vfinance-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vfinance-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for vfinance-0.1.0-py3-none-any.whl |
Total release size: 113.6 kB
Release files / vfinance-0.1.0.tar.gz
| Download URL | vfinance-0.1.0.tar.gz |
|---|---|
| Size | 94.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb54bd0228c4853489c7003868e86bdd3f70d9cf196df0fce6c4b26bb7a0e6d5
|
|
BLAKE2b-256 checksum How to use checksums |
decfc3abfb37844442c7fd5ad1d482d430020b35bc357b80b544f8fcf385dfaa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / vfinance-0.1.0-py3-none-any.whl
| Download URL | vfinance-0.1.0-py3-none-any.whl |
|---|---|
| Size | 19.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7a04eb1cbadcb1f426c952c540ec7ed12090db73b6949b307beccb02ea9a9921
|
|
BLAKE2b-256 checksum How to use checksums |
bee3b8daa0e722cd787c0e1f1fd09bf022a33646b810dce7978fcb49ffefccec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for vfinance 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.