Improve the following prompt without writing code: """ Write code that iterates on the…
- User
Improve the following prompt without writing code:
""" Write code that iterates on the tickers dictionary:
- Focus on high quality Data Collection/Data Sources: Price Data: Obtain historical price (open, high, low, close) and volume data these tickers:
- check if the ticker data exists and log the tickers that don't, avoiding errors in the process.
- Data Cleaning:Handling Missing Values: Impute or remove missing data points to ensure dataset integrity. Adjustments: Account for stock splits, dividends, and corporate actions, especially crucial for leveraged ETFs which can be highly sensitive to such events.
- Returns Calculation: Compute both simple and log returns for all assets to analyze performance.
- Normalization: Normalize returns to facilitate comparison across different assets and sectors.
- Technical Indicators: Generate indicators such as moving averages (e.g., 50-day, 200-day), Relative Strength Index (RSI), Moving Average Convergence Divergence (MACD) for each ETF.
- Volatility Metrics: Calculate historical volatility, Bollinger Bands, and Average True Range (ATR) for volatility instruments and sector ETFs.
- Time-Based Features: Incorporate features like month, quarter, and day of the week to detect seasonal patterns.
data should be fetched from beginning to current data and any forecasts should visualize a projection from today, till next week and next month. Data should be stored in csv Directory Structure: Organize data into directories by ticker and timeframe:
'raw_data/in_sample/1d': In-sample daily data. 'raw_data/in_sample/1wk': In-sample weekly data. 'raw_data/in_sample/1mo': In-sample monthly data. 'raw_data/out_sample/1d': Out-sample daily data. 'raw_data/out_sample/1wk': Out-sample weekly data.
There should also be a similar process for csv for processed technical fundemental, macro data and technical features.
The following dictionary contains ticker symbols categorized by their market type and sector.
Each ticker represents a specific financial instrument that we are studying to analyze market trends and investment opportunities.
tickers = { "broad_market": [ # UPRO: A leveraged ETF that aims to provide 3x the daily return of the S&P 500 Index. "UPRO",
# TQQQ: A leveraged ETF that seeks to deliver 3x the daily return of the NASDAQ-100 Index. "TQQQ" ], "volatility": [ # VIX: The CBOE Volatility Index, which measures market expectations of near-term volatility. "VIX",
# UVXY: A leveraged ETF that aims to provide 1.5x the daily return of the VIX short-term futures index. "UVXY" ], "sectors": { "Technology": [ # XLK: An ETF that tracks the performance of the Technology Select Sector Index. "XLK",
# SOXL: A leveraged ETF that seeks to deliver 3x the daily return of the PHLX Semiconductor Sector Index. "SOXL", # SOXS: A leveraged ETF that aims to provide -3x the daily return of the PHLX Semiconductor Sector Index. "SOXS" ], "Healthcare": [ # XLV: An ETF that tracks the performance of the Health Care Select Sector Index. "XLV", # CURE: A leveraged ETF that aims to provide 2x the daily return of the Health Care Select Sector Index. "CURE", # SICK: A leveraged ETF that seeks to deliver -2x the daily return of the Health Care Select Sector Index. "SICK" ], "Financials": [ # XLF: An ETF that tracks the performance of the Financial Select Sector Index. "XLF", # FAS: A leveraged ETF that aims to provide 3x the daily return of the Financial Select Sector Index. "FAS", # FAZ: A leveraged ETF that seeks to deliver -3x the daily return of the Financial Select Sector Index. "FAZ" ], "Consumer Discretionary": [ # XLY: An ETF that tracks the performance of the Consumer Discretionary Select Sector Index. "XLY", # ERX: A leveraged ETF that aims to provide 2x the daily return of the S&P Consumer Discretionary Select Sector Index. "ERX", # SCC: A leveraged ETF that seeks to deliver -2x the daily return of the S&P Consumer Discretionary Select Sector Index. "SCC" ], "Energy": [ # XLE: An ETF that tracks the performance of the Energy Select Sector Index. "XLE", # ERX: A leveraged ETF that aims to provide 2x the daily return of the S&P Energy Select Sector Index. "ERX", # ERY: A leveraged ETF that seeks to deliver -2x the daily return of the S&P Energy Select Sector Index. "ERY" ], "Industrials": [ # XLI: An ETF that tracks the performance of the Industrial Select Sector Index. "XLI", # DUSL: A leveraged ETF that aims to provide 2x the daily return of the Industrial Select Sector Index. "DUSL", # SIJ: A leveraged ETF that seeks to deliver -2x the daily return of the Industrial Select Sector Index. "SIJ" ], "Communication Services": [ # XLC: An ETF that tracks the performance of the Communication Services Select Sector Index. "XLC", # FNGU: A leveraged ETF that aims to provide 3x the daily return of the NYSE FANG+ Index. "FNGU", # FNGD: A leveraged ETF that seeks to deliver -3x the daily return of the NYSE FANG+ Index. "FNGD" ], "Utilities": [ # XLU: An ETF that tracks the performance of the Utilities Select Sector Index. "XLU", # UPW: A leveraged ETF that aims to provide 2x the daily return of the Utilities Select Sector Index. "UPW", # SDP: A leveraged ETF that seeks to deliver -2x the daily return of the Utilities Select Sector Index. "SDP" ], "Materials": [ # XLB: An ETF that tracks the performance of the Materials Select Sector Index. "XLB", # UYM: A leveraged ETF that aims to provide 2x the daily return of the Materials Select Sector Index. "UYM", # SMN: A leveraged ETF that seeks to deliver -2x the daily return of the Materials Select Sector Index. "SMN" ] } } - Assistant