CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-vnstock

A beginner-friendly yet powerful Python toolkit for financial analysis and automation — built to make modern investing accessible to everyone

Overview
Eval results
Files

trading-analytics.mddocs/

Trading Analytics

The Trading class provides market trading statistics, order book data, foreign and proprietary trading flows, insider transactions, and various trading-related metrics for Vietnamese securities markets.

Capabilities

Trading Class

Adapter for trading data and market statistics with comprehensive analytics capabilities.

class Trading:
    """
    Trading data adapter for market statistics and trading analytics.
    
    Supported sources: VCI, TCBS
    """
    
    def __init__(self, source: str = "vci", symbol: str = "", random_agent: bool = False, show_log: bool = False):
        """
        Initialize Trading data adapter.
        
        Args:
            source (str): Data source ("vci", "tcbs"), defaults to "vci"
            symbol (str): Default symbol for operations, defaults to ""
            random_agent (bool): Use random user agent, defaults to False
            show_log (bool): Enable logging, defaults to False
        """

Trading Statistics

Market trading statistics including volume, value, and participation metrics.

def trading_stats(self, *args, **kwargs) -> pd.DataFrame:
    """
    Get comprehensive trading statistics.
    
    Returns:
        pd.DataFrame: Trading statistics including volume, value, and market metrics
    """

def side_stats(self, *args, **kwargs) -> pd.DataFrame:
    """
    Get bid/ask side trading statistics.
    
    Returns:
        pd.DataFrame: Bid/ask side trading data and imbalances
    """

def price_board(self, *args, **kwargs) -> pd.DataFrame:
    """
    Get price board (order book) for symbols list.
    
    Returns:
        pd.DataFrame: Current market prices and order book data
    """

def price_history(self, *args, **kwargs) -> pd.DataFrame:
    """
    Get price history for multiple symbols.
    
    Returns:
        pd.DataFrame: Multi-symbol price history data
    """

Trading Flows

Specialized trading flow analysis including foreign and proprietary trading.

def foreign_trade(self, *args, **kwargs) -> pd.DataFrame:
    """
    Get foreign trading flow data.
    
    Returns:
        pd.DataFrame: Foreign investor trading activity
    """

def prop_trade(self, *args, **kwargs) -> pd.DataFrame:
    """
    Get proprietary trading data.
    
    Returns:
        pd.DataFrame: Proprietary trading firm activity
    """

def insider_deal(self, *args, **kwargs) -> pd.DataFrame:
    """
    Get insider trading transactions.
    
    Returns:
        pd.DataFrame: Insider dealing activity and disclosures
    """

def order_stats(self, *args, **kwargs) -> pd.DataFrame:
    """
    Get order statistics and market microstructure data.
    
    Returns:
        pd.DataFrame: Order flow statistics and execution metrics
    """

Usage Examples

from vnstock import Trading

# Initialize trading adapter
trading = Trading(source="vci", symbol="TCB")

# Get trading statistics
stats = trading.trading_stats(symbol="TCB")

# Get foreign trading flows
foreign_flows = trading.foreign_trade(symbol="VCB")

# Get insider trading data
insider_data = trading.insider_deal(symbol="HPG")

# Get order book data
order_book = trading.price_board(symbols=["TCB", "VCB", "BID"])

Install with Tessl CLI

npx tessl i tessl/pypi-vnstock

docs

company-info.md

data-visualization.md

financial-statements.md

index.md

main-client.md

market-listings.md

mutual-funds.md

quote-data.md

stock-screening.md

trading-analytics.md

tile.json