Skip to main content
Glama

generate_price_series

Generate synthetic stock price data using Geometric Brownian Motion for portfolio analysis and simulation. Create customizable price series with adjustable returns, volatilities, and correlations between assets.

Instructions

Generate synthetic price series using Geometric Brownian Motion.

Creates realistic-looking stock price data with customizable parameters for each asset. Supports correlated assets via a correlation matrix.

Large results are cached and returned as a reference with preview. Use get_cached_result to paginate through the full price series.

Args: symbols: List of asset symbols (e.g., ['GOOG', 'AMZN', 'AAPL']). days: Number of trading days to generate (default: 252, one year). initial_prices: Optional initial price per symbol. Defaults to 100.0 for all symbols. annual_returns: Optional expected annual return per symbol. Defaults to 0.08 (8%) for all symbols. annual_volatilities: Optional annual volatility per symbol. Defaults to 0.20 (20%) for all symbols. correlation_matrix: Optional correlation matrix for the assets. Should be a symmetric positive semi-definite matrix. Defaults to identity matrix (uncorrelated). seed: Random seed for reproducibility.

Returns: Dictionary containing: - ref_id: Reference ID for accessing full cached data - symbols: List of symbols - preview: Sample of the price data - total_items: Total number of data points (days) - parameters: Generation parameters used - message: Instructions for pagination

Example: ``` # Generate 1 year of data for 3 tech stocks result = generate_price_series( symbols=["GOOG", "AMZN", "AAPL"], days=252, annual_returns={"GOOG": 0.12, "AMZN": 0.15, "AAPL": 0.10}, annual_volatilities={"GOOG": 0.25, "AMZN": 0.30, "AAPL": 0.22}, seed=42 )

# Use ref_id to paginate page2 = get_cached_result(ref_id=result["ref_id"], page=2) ```

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolsYes
daysNo
initial_pricesNo
annual_returnsNo
annual_volatilitiesNo
correlation_matrixNo
seedNo

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/l4b4r4b4b4/portfolio-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server