Compute market sentiment scores based on return patterns, volatility, and optional news data integration.

calculate_market_sentiment(
  returns,
  volatility,
  news_data = NULL,
  method = "technical"
)

Arguments

returns

Matrix of asset returns

volatility

Vector of volatility measures

news_data

Optional data frame with news sentiment (default: NULL)

method

Character string for sentiment calculation method ("technical", "news", "hybrid")

Value

Numeric vector of sentiment scores -1, 1

Examples

if (FALSE) { # \dontrun{
data <- load_market_data(c("AAPL", "MSFT"))
sentiment <- calculate_market_sentiment(data$returns, data$volatility)
plot(sentiment, type = "l", main = "Market Sentiment Over Time")
} # }