{"id":28443,"library":"vnstock","title":"Vnstock","description":"A beginner-friendly Python toolkit for financial analysis and automation, targeting the Vietnamese stock market. Version 4.0.2 (as of 2026-05-09) supports Python >=3.10. Released approximately every 2-4 weeks.","status":"active","version":"4.0.2","language":"python","source_language":"en","source_url":"https://github.com/thinh-vu/vnstock","tags":["vietnam","stock","finance","trading","data"],"install":[{"cmd":"pip install vnstock","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Data manipulation and DataFrame output","package":"pandas","optional":false},{"reason":"HTTP requests to data sources","package":"requests","optional":false}],"imports":[{"note":"v4 changed package structure; old import fails if Vnstock is not in submodule.","wrong":"from vnstock.vnstock import Vnstock","symbol":"Vnstock","correct":"from vnstock import Vnstock"},{"note":"v4 moved Stock to top-level.","wrong":"from vnstock.core import Stock","symbol":"Stock","correct":"from vnstock import Stock"},{"note":"v4 moved Analysis to top-level.","wrong":"from vnstock.analysis import Analysis","symbol":"Analysis","correct":"from vnstock import Analysis"},{"note":"v4 moved Trading to top-level.","wrong":"from vnstock.core import Trading","symbol":"Trading","correct":"from vnstock import Trading"}],"quickstart":{"code":"from vnstock import Vnstock\n\nstock = Vnstock()\nstock.login(os.environ.get('VNSTOCK_USERNAME', ''), os.environ.get('VNSTOCK_PASSWORD', ''))\ndf = stock.stock.historical_price(symbol='ACB', start='2025-01-01', end='2025-12-31')\nprint(df.head())","lang":"python","description":"Initialize Vnstock, login, fetch historical prices for a symbol."},"warnings":[{"fix":"Change imports from `vnstock.vnstock` to `vnstock` (e.g., `from vnstock import Vnstock`).","message":"v4.0.0 removed the `vnstock.vnstock` submodule; all major classes are now at package root.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use `stock.login(username=..., password=...)`. Remove broker argument.","message":"Login method changed from `login(u, p)` to `login(username, password)` and no longer accepts a broker parameter.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Update any code that references `df['ticker']` or `df['date']` to use `df['time']`.","message":"`Stock.historical_price()` now returns a DataFrame with columns `['time', 'open', 'high', 'low', 'close', 'volume']` instead of `['ticker', 'date', 'open', 'high', 'low', 'close', 'volume']`. Column `date` renamed to `time`.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use top-level imports: `from vnstock import Analysis`.","message":"The old `vnstock.analysis` and `vnstock.core` modules are deprecated and will be removed in v5.","severity":"deprecated","affected_versions":">=3.5.0"},{"fix":"Use `time.sleep(6)` between requests to stay under limit.","message":"Free tier of vnstock has a rate limit of 10 requests/minute. Exceeding this returns HTTP 429.","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Set credentials via `os.environ` or call `login()` before accessing protected methods.","message":"`Vnstock` class requires environment variables `VNSTOCK_USERNAME` and `VNSTOCK_PASSWORD` unless you only use public data endpoints (e.g., `Stock.historical_price` may work without login for some symbols).","severity":"gotcha","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Change import to `from vnstock import Vnstock`.","cause":"v4 removed the `vnstock.vnstock` submodule; all classes are now at `vnstock` top-level.","error":"ModuleNotFoundError: No module named 'vnstock.vnstock'"},{"fix":"Use `historical_price(symbol='ACB')` instead of `ticker='ACB'`.","cause":"v4 renamed parameter `ticker` to `symbol`.","error":"TypeError: Stock.historical_price() got unexpected keyword argument 'ticker'"},{"fix":"Import `Analysis` directly: `from vnstock import Analysis`.","cause":"v4 moved `analysis` from `Vnstock` to a standalone top-level import.","error":"AttributeError: 'Vnstock' object has no attribute 'analysis'"},{"fix":"Add a delay: `time.sleep(6)` between API calls.","cause":"Exceeded free tier rate limit (10 req/min).","error":"ConnectionError: 429 Client Error: Too Many Requests"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}