I have logreturns calculated but for all 15 assets If you already have logreturns…
- User
I have log_returns calculated but for all 15 assets If you already have log_returns calculated for all 15 assets but need to apply optimizations for subsets defined by strategy1_selection and strategy2_selection, your task is now to filter log_returns to match these subsets and then proceed with the optimization processes for each.
Step 1: Filter Log Returns for Each Strategy
Assuming log_returns is a data frame (or a matrix) where rows represent dates/time periods, and columns represent assets, and you have a column naming convention that matches the tickers used in your strategy selections, you can do the following:
Assuming ‘log_returns’ is your data frame and ‘strategy1_selectionTicker' and 'strategy2_selection
Ticker’
contain the asset tickers for each strategy’s selected assets
Filter log_returns for strategy1 assets
log_returns_strategy1 <- log_returns[, colnames(log_returns) %in% strategy1_selection$Ticker]
Filter log_returns for strategy2 assets
log_returns_strategy2 <- log_returns[, colnames(log_returns) %in% strategy2_selection.................Can you continue this
- Assistant
- User
Error in optimize_portfolio(log_returns_strategy1) : could not find function "optimize_portfolio"
- Assistant
- User
log_returns_strategy1 not found
- Assistant
- User
I have log_returns calculated but for all 15 assets If you already have log_returns calculated for all 15 assets but need to apply optimizations for subsets defined by strategy1_selection and strategy2_selection, your task is now to filter log_returns to match these subsets and then proceed with the optimization processes for each.
Step 1: Filter Log Returns for Each Strategy
Assuming log_returns is a data frame (or a matrix) where rows represent dates/time periods, and columns represent assets, and you have a column naming convention that matches the tickers used in your strategy selections, you can do the following:
Assuming ‘log_returns’ is your data frame and ‘strategy1_selectionTicker’ and 'strategy2_selection
Ticker’
contain the asset tickers for each strategy’s selected assets
Filter log_returns for strategy1 assets
log_returns_strategy1 <- log_returns[, colnames(log_returns) %in% strategy1_selection$Ticker]
Filter log_returns for strategy2 assets
log_returns_strategy2 <- log_returns[, colnames(log_returns) %in% strategy2_selection…Can you continue this
- Assistant