### Install vnstock from GitHub Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Installs the experimental release of vnstock directly from its GitHub repository. This is useful for testing the latest development features. ```bash pip install git+https://github.com/thinh-vu/vnstock.git ``` -------------------------------- ### Install Package from Source Source: https://github.com/thinh-vu/vnstock/blob/main/tests/plan.md Installs the vnstock package using pip, typically from a local source directory, ensuring all dependencies are met. ```bash python3.10 -m pip install . ``` -------------------------------- ### Install vnstock via pip Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Installs or upgrades the vnstock library to the latest version from PyPI. This is the standard method for obtaining the package. ```bash pip install -U vnstock ``` -------------------------------- ### Install vnstock Library Source: https://github.com/thinh-vu/vnstock/blob/main/docs/3_commodities_vnstock3.ipynb Installs or upgrades the vnstock library using pip. This command is essential for setting up the library in your Python environment. ```python !pip install -U vnstock ``` -------------------------------- ### Install vnstock Library Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Installs the latest version of the vnstock library using pip. This command ensures you have the necessary tools to access Vietnamese stock market data. ```python !pip install -U vnstock ``` -------------------------------- ### Install vnstock Library Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Installs or upgrades the vnstock library using pip. This command ensures you have the latest version of the library available for use. ```python !pip install -U vnstock ``` -------------------------------- ### Install vnstock Library Source: https://github.com/thinh-vu/vnstock/blob/main/docs/2_international_market.ipynb Installs or upgrades the vnstock Python library using pip. This command ensures you have the latest version of the library available for use. ```python !pip install -U vnstock ``` -------------------------------- ### Get Company Overview Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Retrieves the general overview and profile information for a company. This includes basic details about the business and its operations. ```python company.overview() ``` -------------------------------- ### Get Company Overview (Python) Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Retrieves detailed company information, including an overview. This can be accessed either by instantiating the Vnstock class and then the stock object, or by directly instantiating the Company class. ```python from vnstock import Vnstock company = Vnstock().stock(symbol='ACB', source='VCI').company company.overview() ``` ```python from vnstock import Company company = Company(symbol='ACB', source='VCI') company.overview() ``` -------------------------------- ### Get Cash Flow Statement Data Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Fetches the cash flow statement for a company. This example shows how to get yearly data and display the first few rows. The `dropna` parameter is used to clean the data. ```python fin.cash_flow(period='year', dropna=True).head() ``` -------------------------------- ### Fetch Quarterly Income Statement (English) - Duplicate Example Source: https://github.com/thinh-vu/vnstock/blob/main/docs/wrapper/1_vietnam_stock_vnstock3.ipynb Retrieves the quarterly income statement data for a company, dropping rows with missing values. Uses English language for data and displays the first few rows. This appears to be a duplicate example from the income statement section. ```python finance.income_statement(period='quarter', lang='en', dropna=True).head() ``` -------------------------------- ### Get historical prices (Vnstock interface) Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Fetches historical price data for a given stock symbol using the unified Vnstock interface. Allows specifying start and end dates and the data interval. ```python from vnstock import Vnstock stock = Vnstock().stock(symbol='ACB', source='VCI') stock.quote.history(start='2024-01-01', end='2025-03-19', interval='1D') ``` -------------------------------- ### Import Main Vnstock Wrapper Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Imports the primary Vnstock wrapper class, which serves as the main interface for most library functionalities. This is the recommended way to start using the library. ```python from vnstock import Vnstock ``` -------------------------------- ### Get Company Financial Ratios Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Retrieves a summary of key financial ratios for a company. This is essential for fundamental analysis and performance evaluation. ```python company.ratio_summary() ``` -------------------------------- ### Get Historical Warrant Prices Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Retrieves historical price data for warrants (CW) within a specified date range and interval. An example symbol 'CFPT2314' is provided. ```python stock.quote.history(symbol='CFPT2314', start='2024-01-02', end='2025-03-19', interval='1D') ``` -------------------------------- ### Fetch FX Historical Data (Python) Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Retrieves historical price data for foreign exchange (FX) pairs. The example demonstrates fetching daily data for JPYVND from the MSN source. ```python from vnstock import Vnstock fx = Vnstock().fx(symbol='JPYVND', source='MSN') df = fx.quote.history(start='2025-01-02', end='2025-03-20', interval='1D') df ``` -------------------------------- ### Get Historical Listed Bond Prices Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Retrieves historical price data for listed bonds within a specified date range and interval. An example symbol 'CII424002' is provided. ```python stock.quote.history(symbol='CII424002', start='2024-01-02', end='2025-03-19', interval='1D') ``` -------------------------------- ### Get Financial Ratios (Quarterly) Source: https://github.com/thinh-vu/vnstock/blob/main/docs/tcbs/1_vietnam_stock_vnstock3_tcbs.ipynb Retrieves quarterly financial ratios for a stock. The `.head()` method is used to display the first few rows; remove it to see the full dataset. Requires the stock object to be initialized. ```python # Bỏ .head() để hiển thị toàn bộ dữ liệu stock.finance.ratio(period='quarter').head() ``` -------------------------------- ### Stock Screener (Python) Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Utilizes the stock screener functionality to filter stocks based on specified parameters. The example shows screening stocks from HOSE, HNX, and UPCOM exchanges with a limit. ```python from vnstock import Screener stock.screener.stock(params={"exchangeName": "HOSE,HNX,UPCOM"}, limit=1700) ``` -------------------------------- ### Get Price Depth Information Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Retrieves real-time price depth information, showing bid and ask orders. This provides insight into market liquidity and order flow. ```python quote.price_depth() ``` -------------------------------- ### Get market price board Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Fetches real-time quotes for multiple stock tickers simultaneously. This is useful for displaying a market price board or monitoring several stocks at once. ```python from vnstock import Trading Trading(source='VCI').price_board(['VCB','ACB','TCB','BID']) ``` -------------------------------- ### Get Balance Sheet (Quarterly) Source: https://github.com/thinh-vu/vnstock/blob/main/docs/tcbs/1_vietnam_stock_vnstock3_tcbs.ipynb Retrieves the quarterly balance sheet for a stock. The `.head()` method is used to display the first few rows; remove it to see the full dataset. Requires the stock object to be initialized. ```python # Bỏ .head() để hiển thị toàn bộ dữ liệu stock.finance.balance_sheet(period='quarter').head() ``` -------------------------------- ### Get Company Subsidiaries Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Retrieves a list of a company's subsidiaries. This information is crucial for understanding the group structure and business diversification. ```python company.subsidiaries() ``` -------------------------------- ### Get Company Shareholders Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Retrieves information about the major shareholders of a company. This data helps in understanding the ownership structure. ```python company.shareholders() ``` -------------------------------- ### Get SJC Gold Price Snapshot Source: https://github.com/thinh-vu/vnstock/blob/main/docs/3_commodities_vnstock3.ipynb Retrieves a snapshot of SJC gold prices. This function is used to get the current SJC gold prices without specifying a date. ```python from vnstock.explorer.misc import * sjc_gold_price() ``` -------------------------------- ### Get Company Affiliates Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Retrieves information about a company's affiliated companies. Note that this method might not be available for all data sources. ```python company.affiliate() ``` -------------------------------- ### Get intraday tick data Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Retrieves granular intraday trade data per tick for a specified stock. This function allows controlling the page size and logging output. ```python stock.quote.intraday(symbol='ACB', page_size=10_000, show_log=False) ``` -------------------------------- ### Get Company News Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Retrieves recent news articles related to a company. This helps in staying updated with company-specific announcements and market sentiment. ```python company.news().head(3) ``` -------------------------------- ### Get Price Board Data Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Retrieves real-time price board data for a list of specified stock symbols. It can also flatten columns and transpose the output for easier viewing. ```python trading.price_board(['ACB', 'GB05F2506']) ``` ```python trading.price_board(['VCB','ACB','TCB','BID'], flatten_columns=True, drop_levels=[0]).T ``` -------------------------------- ### Get Income Statement (Quarterly) Source: https://github.com/thinh-vu/vnstock/blob/main/docs/tcbs/1_vietnam_stock_vnstock3_tcbs.ipynb Retrieves the quarterly income statement for a stock. The `.head()` method is used to display the first few rows; remove it to see the full dataset. Requires the stock object to be initialized. ```python # Bỏ .head() để hiển thị toàn bộ dữ liệu stock.finance.income_statement(period='quarter').head() ``` -------------------------------- ### Get Balance Sheet (Annual) Source: https://github.com/thinh-vu/vnstock/blob/main/docs/tcbs/1_vietnam_stock_vnstock3_tcbs.ipynb Retrieves the annual balance sheet for a stock. The `.head()` method is used to display the first few rows; remove it to see the full dataset. Requires the stock object to be initialized. ```python # Bỏ .head() để hiển thị toàn bộ dữ liệu stock.finance.balance_sheet(period='year').head() ``` -------------------------------- ### Get Symbols by Exchange Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Retrieves a comprehensive list of all stock symbols, including those that are not currently listed, categorized by their respective exchanges. This provides a complete dataset of securities. ```python stock.listing.symbols_by_exchange() ``` -------------------------------- ### Get Company Officers Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Retrieves information about a company's officers, with options to filter by their current working status ('working', 'all', 'resigned'). ```python company.officers(filter_by='working').head() ``` -------------------------------- ### Get VCB Exchange Rates Source: https://github.com/thinh-vu/vnstock/blob/main/docs/3_commodities_vnstock3.ipynb Fetches foreign exchange rates from Vietcombank (VCB) for a specified date. Requires importing necessary modules from vnstock.explorer.misc. ```python from vnstock.explorer.misc import * vcb_exchange_rate(date='2024-05-25') ``` -------------------------------- ### Get Company Trading Statistics Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Retrieves statistical data related to a company's trading activity, such as trading volume and turnover. This offers insights into market participation. ```python company.trading_stats() ``` -------------------------------- ### Get Income Statement (Annual) Source: https://github.com/thinh-vu/vnstock/blob/main/docs/tcbs/1_vietnam_stock_vnstock3_tcbs.ipynb Retrieves the annual income statement for a stock. The `.head()` method is used to display the first few rows; remove it to see the full dataset. Requires the stock object to be initialized. ```python # Bỏ .head() để hiển thị toàn bộ dữ liệu stock.finance.income_statement(period='year').head() ``` -------------------------------- ### Get Company Events Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Retrieves a list of upcoming and past corporate events for a company, such as earnings calls or shareholder meetings. This provides insights into corporate activities. ```python company.events().head(3) ``` -------------------------------- ### Get Symbols by Industries Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Retrieves a list of stock symbols categorized by their industry classifications (ICB). This helps in analyzing companies within specific sectors. ```python stock.listing.symbols_by_industries() ``` -------------------------------- ### Get Historical Futures Prices Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Retrieves historical price data for futures contracts, such as VN30F1M or VN30F2411, within a specified date range and interval. ```python stock.quote.history(symbol='VN30F1M', start='2024-01-02', end='2025-03-19', interval='1D') ``` ```python stock.quote.history(symbol='VN30F2411', start='2024-01-02', end='2025-03-19', interval='1D') ``` -------------------------------- ### Get Intraday Trading Data Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Retrieves intraday trading data, specifically order book information, for the current or most recent trading day. It allows specifying page size and logging. ```python quote.intraday(page_size=10_000, show_log=False) ``` -------------------------------- ### Get Real-time Price Depth Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Retrieves real-time price depth information for a stock symbol, showing bid and ask prices along with their corresponding volumes. This provides insight into market liquidity. ```python stock.quote.price_depth('ACB') ``` -------------------------------- ### Get Financial Ratio Data Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Calculates and retrieves financial ratios for a company. Supports specifying the period (year or quarter) and language. Options like `flatten_columns` and `drop_levels` are used for data structuring. ```python fin.ratio(period='year', lang='vi', flatten_columns=True, drop_levels=[0], dropna=True).head() ``` ```python fin.ratio(period='quarter', lang='en', flatten_columns=True, drop_levels=[0], dropna=True).head() ``` -------------------------------- ### Get historical prices (Quote class) Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Fetches historical price data for a given stock symbol using the dedicated Quote class. This method also allows specifying date ranges and intervals. ```python from vnstock import Quote quote = Quote(symbol='ACB', source='VCI') quote.history(start='2024-01-01', end='2025-03-19', interval='1D') ``` -------------------------------- ### Get Financial Ratios (Annual) Source: https://github.com/thinh-vu/vnstock/blob/main/docs/tcbs/1_vietnam_stock_vnstock3_tcbs.ipynb Retrieves annual financial ratios for a stock. The `dropna=True` parameter removes rows with missing values. The `.head()` method displays the first few rows; remove it for the full dataset. Requires the stock object to be initialized. ```python # Bỏ .head() để hiển thị toàn bộ dữ liệu stock.finance.ratio(period='year', dropna=True).head() ``` -------------------------------- ### Get Intraday Trading Data Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Retrieves intraday trading data (order book) for a given stock symbol. Parameters like page_size and show_log can be adjusted for data retrieval and logging. ```python stock.quote.intraday(symbol='ACB', page_size=10_000, show_log=False) ``` -------------------------------- ### Stock Screener Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Filters stocks based on specified parameters. This example demonstrates fetching a list of stocks from HOSE, HNX, and UPCOM exchanges with a limit of 1700 results. This functionality is available with the TCBS data source. ```python # from vnstock import Screener screener_df = stock.screener.stock(params={"exchangeName": "HOSE,HNX,UPCOM"}, limit=1700) screener_df ``` -------------------------------- ### Get Balance Sheet Data Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Fetches the balance sheet data for a company. Supports specifying the reporting period (year or quarter) and language. The `dropna` parameter removes rows with all NaN values. ```python fin.balance_sheet(period='year', lang='vi', dropna=True) ``` ```python fin.balance_sheet(period='quarter', lang='en', dropna=True).head() ``` -------------------------------- ### Get All Listed Symbols Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Retrieves a list of all ticker symbols currently listed on the stock exchange using the VCI data source. This function provides a simple overview of available securities. ```python stock.listing.all_symbols() ``` -------------------------------- ### Load vnstock Library Modules Source: https://github.com/thinh-vu/vnstock/blob/main/docs/2_international_market.ipynb Demonstrates how to import modules from the vnstock library. You can import all modules or specific ones like the main Vnstock wrapper for immediate use. ```python ## Load all library modules # from vnstock import * ## Load the main working Wrapper (main UI of the library) from vnstock import Vnstock ``` -------------------------------- ### Get Price Board Data Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Fetches the price board data for specified stock symbols. The `.T` attribute can be used to transpose the resulting DataFrame for a different display format. ```python stock.trading.price_board(['ACB']) ``` ```python # stock.trading.price_board(['VCB','ACB','TCB','BID']).T # Bỏ .T để xoay trở lại đúng kiểu hiển thị bảng giá ``` -------------------------------- ### Initialize Vnstock for Stock Data Source: https://github.com/thinh-vu/vnstock/blob/main/docs/tcbs/1_vietnam_stock_vnstock3_tcbs.ipynb Initializes the Vnstock library to fetch stock data. Requires a stock symbol and a data source. This is the first step before accessing financial reports. ```python from vnstock import Vnstock stock = Vnstock().stock(symbol='VCI', source='TCBS') ``` -------------------------------- ### Get Cash Flow Statement (Annual) Source: https://github.com/thinh-vu/vnstock/blob/main/docs/tcbs/1_vietnam_stock_vnstock3_tcbs.ipynb Retrieves the annual cash flow statement for a stock. The `.head()` method is used to display the first few rows; remove it to see the full dataset. Requires the stock object to be initialized. ```python # Bỏ .head() để hiển thị toàn bộ dữ liệu stock.finance.cash_flow(period='year').head() ``` -------------------------------- ### Get Industries by ICB Code Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Retrieves a list of industry classifications based on their ICB (Industry Classification Benchmark) codes. This allows for mapping ICB codes to their corresponding industry names. ```python stock.listing.industries_icb() ``` -------------------------------- ### Get Historical Index Prices Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Retrieves historical price data for major stock market indices like VNINDEX, HNXINDEX, and UPCOMINDEX within a specified date range and interval. ```python stock.quote.history(symbol='VNINDEX', start='2024-01-02', end='2025-03-19', interval='1D') ``` ```python stock.quote.history(symbol='HNXINDEX', start='2024-01-02', end='2025-03-19', interval='1D') ``` ```python stock.quote.history(symbol='UPCOMINDEX', start='2024-01-02', end='2025-03-19', interval='1D') ``` -------------------------------- ### Initialize Finance Data Fetcher Source: https://github.com/thinh-vu/vnstock/blob/main/docs/wrapper/1_vietnam_stock_vnstock3.ipynb Initializes the Finance class to fetch financial statements and ratios for a specific stock symbol and data source. ```python from vnstock import Finance finance = Finance(symbol='ACB', source='vci') ``` -------------------------------- ### Get Income Statement Data Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Retrieves the income statement (profit and loss) for a company. Users can specify the reporting period (year or quarter) and language. The `.head()` method displays the first few rows of the resulting DataFrame. ```python fin.income_statement(period='year', lang='vi', dropna=True).head() ``` ```python fin.income_statement(period='quarter', lang='en', dropna=True).head() ``` -------------------------------- ### Get Symbols by Group Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Retrieves a list of stock symbols belonging to specific market groups or indices, such as VN30, VNMidCap, or ETFs. This is useful for analyzing performance within defined market segments. ```python stock.listing.symbols_by_group('VN30') ``` -------------------------------- ### Import vnstock Modules Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Imports core modules from the vnstock library, including Listing, Quote, Company, Finance, and Trading, for data retrieval and analysis. ```python from vnstock.explorer.vci import Listing, Quote, Company, Finance, Trading ``` -------------------------------- ### Get Bao Tin Minh Chau Gold Price Source: https://github.com/thinh-vu/vnstock/blob/main/docs/3_commodities_vnstock3.ipynb Fetches gold prices from Bao Tin Minh Chau (BTMC). This function is used to obtain the latest gold prices from this provider. ```python btmc_goldprice() ``` -------------------------------- ### Open Fund Data Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Retrieves listing information for open-end funds. ```python from vnstock.explorer.fmarket.fund import Fund fund = Fund() fund.listing() ``` -------------------------------- ### Get Historical Price Data Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Retrieves historical price data for a given stock symbol within a specified date range and interval. The returned DataFrame includes metadata like the symbol name and asset category. ```python quote = Quote(symbol='FPT') df = quote.history(start='2024-01-01', end='2025-03-19', interval='1D') print(df) ``` -------------------------------- ### Initialize Trading Object Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Initializes the Trading object from the vnstock library, which is used for accessing real-time market data like price boards. ```python from vnstock.explorer.vci import Trading trading = Trading() ``` -------------------------------- ### Get Historical Stock Prices Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Retrieves historical price data for a given stock symbol within a specified date range and interval. The returned DataFrame includes metadata like the stock's name and category. ```python df = stock.quote.history(start='2024-01-01', end='2025-03-19', interval='1D') ``` ```python print(f'Mã chứng khoán: {df.name}') print(f'Loại tài sản: {df.category}') ``` -------------------------------- ### Run All Pytest Tests Source: https://github.com/thinh-vu/vnstock/blob/main/tests/plan.md Executes all tests within the project using pytest, stopping on the first failure and suppressing warnings. The '-q' flag ensures quiet output. ```bash pytest --maxfail=1 --disable-warnings -q ``` -------------------------------- ### Execute Functional Tests Source: https://github.com/thinh-vu/vnstock/blob/main/tests/plan.md Runs the functional tests located in the specified directory, configured to stop on the first failure and use quiet output. ```bash python3.10 -m pytest tests/test_explorer/2_functional --maxfail=1 -q ``` -------------------------------- ### Generate Coverage Reports Source: https://github.com/thinh-vu/vnstock/blob/main/tests/plan.md Executes tests and generates code coverage reports in both HTML and XML formats for the vnstock.explorer module. ```bash pytest --cov=vnstock/explorer \ --cov-report=html:tests/report/coverage_html \ --cov-report=xml:tests/report/coverage.xml ``` -------------------------------- ### Company Overview Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Retrieves the general overview information for a specific company, identified by its stock symbol. Supports different data sources. ```python from vnstock import Vnstock stock = Vnstock().stock(symbol='ACB', source='VCI').company company.overview() ``` ```python from vnstock import Company company = Company(symbol='ACB', source='VCI') company.overview() ``` -------------------------------- ### Trading Price Board Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Fetches real-time trading prices for a list of stock symbols from a specified source. ```python from vnstock import Trading Trading(source='VCI').price_board(['VCB','ACB','TCB','BID']) ``` -------------------------------- ### List All Symbols (Simple) Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Retrieves a simple list of all currently listed stock symbols from the VCI data source. This is a basic overview of available securities. ```python listing = Listing() listing.all_symbols() ``` -------------------------------- ### Initialize Quote Object (Index) Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Initializes a Quote object to retrieve data for market indices, such as VNINDEX. This enables tracking of benchmark index performance. ```python quote = Quote(symbol='VNINDEX') ``` -------------------------------- ### Initialize Vnstock with Symbol and Source Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Initializes the Vnstock object, specifying the stock symbol and the data source (e.g., 'VCI' for Vietcap). This object is then used for all subsequent data retrieval operations. ```python stock = Vnstock().stock(symbol='ACB', source='VCI') ``` -------------------------------- ### Import Main vnstock Functional Classes Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Imports core functional classes from the vnstock library. This approach supports dynamic switching between different data providers for various financial data operations. ```python from vnstock import Listing, Quote, Company, Finance, Trading, Screener ``` -------------------------------- ### Import vnstock Unified Interface Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Imports the main Vnstock class for a unified interface. This method allows defining the data source once and reusing it across functions, ideal for analyzing a single stock. ```python from vnstock import Vnstock stock = Vnstock().stock(symbol='VCI', source='VCI') stock.quote.history(start='2020-01-01', end='2024-05-25') ``` -------------------------------- ### Export DataFrames to Files (Python) Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Demonstrates how to export data, typically retrieved as Pandas DataFrames, to common file formats like Excel and CSV. This is useful for further analysis or integration with other tools. ```python # Save ratio data to memory ratio_df = stock.finance.ratio(period='year', lang='vi', dropna=True) # Export to Excel ratio_df.to_excel('/your_save_path/ratio_df.xlsx', index=False) # Export to CSV ratio_df.to_csv('/your_save_path/ratio_df.csv', index=False) ``` -------------------------------- ### Financial Reports Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Fetches various financial reports for a stock, including balance sheets, income statements, cash flow, and financial ratios. Supports different periods (year/quarter) and languages. ```python from vnstock import Vnstock stock = Vnstock().stock(symbol='VCI', source='VCI') # Bảng cân đối kế toán - năm stock.finance.balance_sheet(period='year', lang='vi', dropna=True) # Bảng cân đối kế toán - quý stock.finance.balance_sheet(period='quarter', lang='en', dropna=True) # Kết quả hoạt động kinh doanh stock.finance.income_statement(period='year', lang='vi', dropna=True) # Lưu chuyển tiền tệ stock.finance.cash_flow(period='year', dropna=True) # Chỉ số tài chính stock.finance.ratio(period='year', lang='vi', dropna=True) ``` -------------------------------- ### List all available symbols Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Retrieves a list of all available stock symbols. This is a fundamental step for performing batch operations or identifying tickers for analysis. ```python from vnstock import Listing listing = Listing() listing.all_symbols() ``` -------------------------------- ### Exchange Rate and Gold Price Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Fetches daily exchange rates from specific banks (e.g., VCB) and gold prices (e.g., SJC). ```python from vnstock.explorer.misc import * # Tỷ giá ngoại tệ VCB vcb_exchange_rate(date='2024-03-21') # Giá vàng SJC sjc_gold_price() ``` -------------------------------- ### Mutual Fund Listing (Python) Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Fetches a list of available mutual funds. This function is part of the `Fund` class within the `vnstock.explorer.fmarket.fund` module. ```python from vnstock.explorer.fmarket.fund import Fund fund = Fund() fund.listing() ``` -------------------------------- ### Fetch Company Overview Source: https://github.com/thinh-vu/vnstock/blob/main/docs/wrapper/1_vietnam_stock_vnstock3.ipynb Retrieves a general overview of a company. This function is part of the company data fetching capabilities. ```python company.overview() ``` -------------------------------- ### List All Symbols Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Retrieves a list of all stock symbols available in the Vietnamese market. This list is fundamental for fetching data for individual stocks from other functions. ```python from vnstock import Listing listing = Listing() listing.all_symbols() ``` -------------------------------- ### Initialize Quote Object (Bond) Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Initializes a Quote object to retrieve data for listed bonds, such as CII424002. This facilitates access to fixed-income security data. ```python quote = Quote(symbol='CII424002') ``` -------------------------------- ### International Market Data (FX, Index) Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Fetches historical quote data for international markets, such as FX pairs, from specified sources. ```python from vnstock import Vnstock fx = Vnstock().fx(symbol='JPYVND', source='MSN') df = fx.quote.history(start='2025-01-02', end='2025-03-20', interval='1D') df ``` -------------------------------- ### Initialize Quote Object (Futures) Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Initializes a Quote object to retrieve data for futures contracts, such as VN30F1M or VN30F2506. This allows access to derivative market data. ```python quote = Quote(symbol='VN30F1M') ``` -------------------------------- ### Execute Smoke Tests Source: https://github.com/thinh-vu/vnstock/blob/main/tests/plan.md Runs only the smoke tests located in the specified directory, configured to stop on the first failure and use quiet output. ```bash python3.10 -m pytest tests/test_explorer/1_smoke --maxfail=1 -q ``` -------------------------------- ### Initialize Finance Object Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Initializes a Finance object for a specific stock symbol, like VCI, to access detailed financial statements and reports. ```python from vnstock.explorer.vci import Finance fin = Finance(symbol='VCI') ``` -------------------------------- ### Stock Screener Initialization and Usage Source: https://github.com/thinh-vu/vnstock/blob/main/docs/wrapper/1_vietnam_stock_vnstock3.ipynb Initializes the Screener class with the TCBS data source and fetches stock data based on specified parameters, including exchange names and a limit. This function is for filtering stocks. ```python from vnstock import Screener screener = Screener(source="tcbs") screener_df = screener.stock(params={"exchangeName": "HOSE,HNX,UPCOM"}, limit=1700) screener_df ``` -------------------------------- ### Generate JUnit Test Report Source: https://github.com/thinh-vu/vnstock/blob/main/tests/plan.md Runs pytest and generates a JUnit XML report, which is commonly used by CI/CD systems for test result aggregation and visualization. ```bash pytest --junitxml=tests/report/junit-results.xml ``` -------------------------------- ### Initialize Company Object Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Initializes a Company object for a specific stock symbol, such as ACB, to access detailed company-specific information. ```python from vnstock.explorer.vci import Company company = Company('ACB') ``` -------------------------------- ### Export Data to File Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Demonstrates how to export Pandas DataFrames, obtained from Vnstock functions, to common file formats like Excel and CSV. ```python # Biến ratio_df lưu giá trị của phép tính vào bộ nhớ ratio_df = stock.finance.ratio(period='year', lang='vi', dropna=True) # Xuất dữ liệu ra Excel ratio_df.to_excel('/nơi_lưu_file_của_bạn/tên_file-ratio_df.xlsx`, index=False') # Xuất dữ liệu ra CSV ratio_df.to_csv('/nơi_lưu_file_của_bạn/tên_file-ratio_df.csv`, index=False') ``` -------------------------------- ### Company Information (VCI Source) Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Retrieves comprehensive company information using the VCI data source. This includes overview, shareholders, subsidiaries, affiliates, officers, news, events, reports, financial ratios, and trading statistics. Note that the `.head()` method is often used to limit output, and can be removed to view all data. ```python # Khởi tạo đối tượng # from vnstock import Vnstock # company = Vnstock().stock(symbol='ACB', source='VCI').company # hoặc from vnstock.explorer.vci import Company company = Company('ACB') ``` ```python company.overview() ``` ```python company.shareholders() ``` ```python company.subsidiaries() ``` ```python # Phương thức này không có trong nguồn TCBS company.affiliate() ``` ```python # filter_by='all' hoặc 'working' hoặc 'resigned' company.officers(filter_by='working').head() ``` ```python company.news().head(3) ``` ```python company.events().head(3) ``` ```python company.reports() ``` ```python company.ratio_summary() ``` ```python company.trading_stats() ``` -------------------------------- ### Intraday Trading Data Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Retrieves intraday trading data, specifically matching order data, for a given stock symbol. Allows specifying page size and logging. ```python stock.quote.intraday(symbol='ACB', page_size=10_000, show_log=False) ``` -------------------------------- ### Search Symbols using MSN Explorer Source: https://github.com/thinh-vu/vnstock/blob/main/docs/2_international_market.ipynb Searches for supported stock symbols and their corresponding IDs using the MSN explorer module within vnstock. This is useful for finding identifiers needed for data retrieval. ```python from vnstock.explorer.msn import Listing Listing(api_version='20250317').search_symbol_id('USDEUR') ``` -------------------------------- ### List Symbols by Exchange Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Retrieves a comprehensive list of stock symbols categorized by their respective exchanges. This includes all symbols, regardless of their current listing status. ```python listing = Listing() listing.symbols_by_exchange() ``` -------------------------------- ### Initialize Quote Object (Stock) Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Initializes a Quote object to retrieve data for a specific stock symbol, such as FPT. This object is used for fetching historical and real-time price data. ```python quote = Quote(symbol='FPT') ``` -------------------------------- ### Fetch Quarterly Financial Ratios (English) Source: https://github.com/thinh-vu/vnstock/blob/main/docs/wrapper/1_vietnam_stock_vnstock3.ipynb Retrieves quarterly financial ratios for a company, dropping rows with missing values. Uses English language for data and displays the first few rows. ```python finance.ratio(period='quarter', lang='en', dropna=True).head() ``` -------------------------------- ### Initialize Quote Object (CW) Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Initializes a Quote object to retrieve data for Covered Warrants (CW), such as CFPT2314. This allows access to data for these specific financial instruments. ```python quote = Quote(symbol='CFPT2314') ``` -------------------------------- ### Import vnstock from VCI Explorer Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Imports specific classes from the VCI data provider module within vnstock. This is for users who require a fixed data source from VCI. ```python from vnstock.explorer.vci import Listing, Quote, Company, Finance, Trading ``` -------------------------------- ### Fetch Financial Reports (Python) Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Accesses various financial reports for a given stock symbol. Supports fetching data yearly or quarterly, with options for language and handling missing values. Reports include Balance Sheet, Income Statement, Cash Flow, and Financial Ratios. ```python from vnstock import Vnstock stock = Vnstock().stock(symbol='VCI', source='VCI') # Balance Sheet - yearly stock.finance.balance_sheet(period='year', lang='vi', dropna=True) # Balance Sheet - quarterly stock.finance.balance_sheet(period='quarter', lang='en', dropna=True) # Income Statement stock.finance.income_statement(period='year', lang='vi', dropna=True) # Cash Flow stock.finance.cash_flow(period='year', dropna=True) # Financial Ratios stock.finance.ratio(period='year', lang='vi', dropna=True) ``` -------------------------------- ### Fetch Quarterly Balance Sheet (English) Source: https://github.com/thinh-vu/vnstock/blob/main/docs/wrapper/1_vietnam_stock_vnstock3.ipynb Retrieves the quarterly balance sheet data for a company, dropping rows with missing values. Uses English language for data and displays the first few rows. ```python finance.balance_sheet(period='quarter', lang='en', dropna=True).head() ``` -------------------------------- ### Fetch Annual Financial Ratios (Vietnamese) Source: https://github.com/thinh-vu/vnstock/blob/main/docs/wrapper/1_vietnam_stock_vnstock3.ipynb Retrieves annual financial ratios for a company, dropping rows with missing values. Uses Vietnamese language for data and displays the first few rows. ```python finance.ratio(period='year', lang='vi', dropna=True).head() ``` -------------------------------- ### Fetch Company Profile Source: https://github.com/thinh-vu/vnstock/blob/main/docs/wrapper/1_vietnam_stock_vnstock3.ipynb Retrieves the detailed profile of a company. This function is part of the company data fetching capabilities. ```python company.profile() ``` -------------------------------- ### Exchange Rates and Gold Prices (Python) Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Fetches specific financial data points like bank exchange rates and gold prices. The `vcb_exchange_rate` function retrieves rates for a given date, and `sjc_gold_price` fetches current SJC gold prices. ```python from vnstock.explorer.misc import * # VCB exchange rate vcb_exchange_rate(date='2024-03-21') # SJC gold price sjc_gold_price() ``` -------------------------------- ### Import Classes from Data Source Paths Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Imports specific classes by referencing their detailed path within the library's data source structure. This allows for accessing data from different providers like VCI or TCBS. ```python from vnstock.explorer.vci import Listing, Quote, Company, Finance, Trading ``` ```python from vnstock.explorer.tcbs import Quote, Company, Finance, Trading, Screener ``` -------------------------------- ### List Symbols by Industries Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Retrieves a list of stock symbols organized by their Industry Classification Benchmark (ICB) codes. This helps in analyzing sector-specific performance. ```python listing = Listing() listing.symbols_by_industries() ``` -------------------------------- ### Retrieve Crypto Historical Data by Symbol Source: https://github.com/thinh-vu/vnstock/blob/main/docs/2_international_market.ipynb Fetches historical price data for a specified cryptocurrency symbol (e.g., BTC) from the MSN source. It allows specifying the date range and data interval. ```python crypto = Vnstock().crypto(symbol='BTC', source='MSN') df = crypto.quote.history(start='2023-01-01', end='2024-12-31', interval='1D') df.head() ``` -------------------------------- ### Stock Screener Source: https://github.com/thinh-vu/vnstock/blob/main/README.md Filters stocks based on specified parameters, such as exchange names. Allows setting a limit for the number of results. ```python from vnstock import Screener stock.screener.stock(params={"exchangeName": "HOSE,HNX,UPCOM"}, limit=1700) ``` -------------------------------- ### Fetch Quarterly Income Statement (English) Source: https://github.com/thinh-vu/vnstock/blob/main/docs/wrapper/1_vietnam_stock_vnstock3.ipynb Retrieves the quarterly income statement data for a company, dropping rows with missing values. Uses English language for data and displays the first few rows. ```python finance.income_statement(period='quarter', lang='en', dropna=True).head() ``` -------------------------------- ### List Industries by ICB Code Source: https://github.com/thinh-vu/vnstock/blob/main/docs/vci/vci_functions_demo.ipynb Retrieves a list of industry classifications based on their Industry Classification Benchmark (ICB) codes. This provides a mapping from ICB codes to industry names. ```python listing = Listing() listing.industries_icb() ``` -------------------------------- ### Import Specific Vnstock Classes Source: https://github.com/thinh-vu/vnstock/blob/main/docs/1_vietnam_stock_vnstock3.ipynb Imports individual classes from the vnstock library, allowing for more granular control and specific module usage. This approach is useful when you know exactly which functionalities you need. ```python from vnstock import Listing, Quote, Company, Finance, Trading, Screener ```