Adilbai commited on
Commit
807977e
·
verified ·
1 Parent(s): fca4d2b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +174 -0
README.md CHANGED
@@ -158,4 +158,178 @@ configs:
158
  data_files:
159
  - split: train
160
  path: data/train-*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  data_files:
159
  - split: train
160
  path: data/train-*
161
+ license: mit
162
+ task_categories:
163
+ - time-series-forecasting
164
+ - reinforcement-learning
165
+ - tabular-regression
166
+ language:
167
+ - en
168
+ tags:
169
+ - finance
170
+ - time-series
171
+ - stocks
172
+ - technical-analysis
173
+ - yahoo-finance
174
+ - reinforcement-learning
175
+ pretty_name: S&P 500 Comprehensive Stock Market Dataset
176
+ size_categories:
177
+ - 100K<n<1M
178
  ---
179
+ S&P 500 Comprehensive Stock Market Dataset
180
+ Dataset Description
181
+ This dataset contains comprehensive historical stock market data for S&P 500 companies, spanning the last 5 years with extensive feature engineering and technical analysis indicators. The dataset is designed for time series forecasting, stock price prediction, and financial modeling tasks.
182
+
183
+ Dataset Summary
184
+ Total Records: 620,095 daily observations
185
+ Features: 73 comprehensive features including raw price data, technical indicators, and engineered features
186
+ Time Period: Last 5 years of historical data
187
+ Data Source: Yahoo Finance API
188
+ Companies: S&P 500 constituent stocks
189
+ Update Frequency: Daily market data
190
+ Features Overview
191
+ Basic Market Data (9 features)
192
+ Date: Trading date timestamp
193
+ Open, High, Low, Close: Standard OHLC price data
194
+ Volume: Number of shares traded
195
+ Dividends: Dividend payments on the date
196
+ Stock Splits: Stock split information
197
+ Ticker: Stock symbol identifier
198
+ Technical Analysis Indicators (16 features)
199
+ Moving Averages
200
+ SMA_5, SMA_10, SMA_20, SMA_50: Simple Moving Averages for different periods
201
+ EMA_12, EMA_26: Exponential Moving Averages
202
+ Momentum Indicators
203
+ MACD, MACD_Signal, MACD_Histogram: Moving Average Convergence Divergence indicators
204
+ RSI: Relative Strength Index (14-period)
205
+ Volatility Indicators
206
+ BB_Middle, BB_Upper, BB_Lower: Bollinger Bands components
207
+ BB_Width: Bollinger Bands width
208
+ BB_Position: Price position within Bollinger Bands
209
+ Volatility: Historical volatility measure
210
+ Engineered Features (16 features)
211
+ Price_Change: Daily price change
212
+ Price_Change_5d: 5-day price change
213
+ High_Low_Ratio: Ratio of high to low prices
214
+ Open_Close_Ratio: Ratio of open to close prices
215
+ Volume_SMA: Volume simple moving average
216
+ Volume_Ratio: Current volume to average volume ratio
217
+ Lagged Features (32 features)
218
+ The dataset includes lagged versions of key features for time series modeling:
219
+
220
+ Price Lags (5 features)
221
+ Close_lag_1 to Close_lag_10: Historical closing prices
222
+ Volume Lags (5 features)
223
+ Volume_lag_1 to Volume_lag_10: Historical volume data
224
+ Price Change Lags (5 features)
225
+ Price_Change_lag_1 to Price_Change_lag_10: Historical price changes
226
+ RSI Lags (5 features)
227
+ RSI_lag_1 to RSI_lag_10: Historical RSI values
228
+ MACD Lags (5 features)
229
+ MACD_lag_1 to MACD_lag_10: Historical MACD values
230
+ Volatility Lags (5 features)
231
+ Volatility_lag_1 to Volatility_lag_10: Historical volatility measures
232
+ Target Variables (12 features)
233
+ The dataset includes multiple prediction targets for different time horizons:
234
+
235
+ 1-Day Predictions
236
+ Future_Return_1d: Next day return percentage
237
+ Future_Up_1d: Binary indicator for price increase
238
+ Future_Category_1d: Categorical classification of price movement
239
+ 5-Day Predictions
240
+ Future_Return_5d: 5-day forward return
241
+ Future_Up_5d: 5-day binary direction
242
+ Future_Category_5d: 5-day categorical movement
243
+ 10-Day Predictions
244
+ Future_Return_10d: 10-day forward return
245
+ Future_Up_10d: 10-day binary direction
246
+ Future_Category_10d: 10-day categorical movement
247
+ 20-Day Predictions
248
+ Future_Return_20d: 20-day forward return
249
+ Future_Up_20d: 20-day binary direction
250
+ Future_Category_20d: 20-day categorical movement
251
+ Use Cases
252
+ Primary Applications
253
+ Stock Price Prediction: Forecast future stock prices using technical indicators and historical patterns
254
+ Direction Classification: Predict whether stock prices will go up or down
255
+ Risk Assessment: Analyze volatility patterns and market risk
256
+ Trading Strategy Development: Backtest and develop algorithmic trading strategies
257
+ Financial Research: Academic research in computational finance and market efficiency
258
+ Machine Learning Tasks
259
+ Regression: Predict continuous returns (Future_Return_*)
260
+ Binary Classification: Predict price direction (Future_Up_*)
261
+ Multi-class Classification: Predict categorical movements (Future_Category_*)
262
+ Time Series Forecasting: Leverage lagged features for temporal modeling
263
+ Anomaly Detection: Identify unusual market patterns
264
+ Data Quality and Processing
265
+ Feature Engineering Quality
266
+ Technical Indicators: Industry-standard calculations for all technical analysis features
267
+ Lag Features: Comprehensive historical context with multiple time horizons
268
+ Target Engineering: Multiple prediction horizons for flexible modeling approaches
269
+ Data Validation: Processed through robust data validation pipelines
270
+ Missing Data Handling
271
+ Forward-fill methodology for missing price data
272
+ Proper handling of weekends and market holidays
273
+ Corporate action adjustments included
274
+ Data Integrity
275
+ All features computed using vectorized operations for consistency
276
+ Proper handling of stock splits and dividend adjustments
277
+ No look-ahead bias in feature construction
278
+ Usage Examples
279
+ Loading the Dataset
280
+ python
281
+ from datasets import load_dataset
282
+
283
+ dataset = load_dataset("Adilbai/stock-dataset")
284
+ df = dataset["train"].to_pandas()
285
+ Basic Analysis
286
+ python
287
+ # View dataset structure
288
+ print(f"Dataset shape: {df.shape}")
289
+ print(f"Date range: {df['Date'].min()} to {df['Date'].max()}")
290
+ print(f"Number of unique tickers: {df['Ticker'].nunique()}")
291
+
292
+ # Check target distributions
293
+ print(df['Future_Up_1d'].value_counts())
294
+ Feature Selection for Modeling
295
+ python
296
+ # Technical indicators
297
+ technical_features = ['SMA_5', 'SMA_10', 'RSI', 'MACD', 'BB_Position', 'Volatility']
298
+
299
+ # Lagged features
300
+ lag_features = [col for col in df.columns if 'lag' in col]
301
+
302
+ # Targets
303
+ targets = ['Future_Return_1d', 'Future_Up_1d', 'Future_Category_1d']
304
+ Dataset Statistics
305
+ Coverage: All S&P 500 constituent companies
306
+ Temporal Span: 5 years of daily data
307
+ Feature Density: 73 features per observation
308
+ Target Variety: 12 different prediction targets
309
+ Technical Indicators: 16 professional-grade technical analysis features
310
+ Lag Depth: Up to 10-period historical context
311
+ Limitations and Considerations
312
+ Data Limitations
313
+ Survivorship Bias: Only includes current S&P 500 constituents
314
+ Market Hours: Only includes regular trading session data
315
+ Corporate Actions: Historical adjustments may affect long-term patterns
316
+ Usage Considerations
317
+ Look-ahead Bias: Ensure proper train/test splits respecting temporal order
318
+ Market Regime Changes: Model performance may vary across different market conditions
319
+ Feature Correlation: Many technical indicators are derived from the same underlying price data
320
+ Citation
321
+ If you use this dataset in your research, please cite:
322
+
323
+ bibtex
324
+ @dataset{adilbai_sp500_dataset,
325
+ title={S&P 500 Comprehensive Stock Market Dataset},
326
+ author={Adilbai},
327
+ year={2024},
328
+ publisher={Hugging Face},
329
+ url={https://huggingface.co/datasets/Adilbai/stock-dataset}
330
+ }
331
+ License
332
+ This dataset is released under the MIT License. Please note that while the dataset compilation and feature engineering are provided under MIT license, users should be aware of Yahoo Finance's terms of service for the underlying data.
333
+
334
+ Disclaimer
335
+ This dataset is provided for educational and research purposes only. It should not be used as the sole basis for investment decisions. Past performance does not guarantee future results. Users should conduct their own research and consider consulting with financial advisors before making investment decisions.