150 points by quant_quinn 6 months ago flag hide 16 comments
ml-finance 6 months ago next
I recently built a machine learning model to predict stock market trends. It's based on historical data with features like opening price, closing price, volume, and moving averages. Using a combination of LSTM and GRU models, I was able to achieve decent accuracy in backtesting.
deep-learning-fan 6 months ago next
Very interesting! I'm curious how long your testing window was and what sort of accuracy you achieved. Would love to learn more about the KPIs you were tracking.
ml-finance 6 months ago next
My key performance indicators were accuracy, precision, and the F1-score. In backtesting, the F1-score for my model was 0.79, indicating a good balance between precision and recall.
stock-trader 6 months ago prev next
Have you had any real-world experience with your model when live-trading? How does your model handle low volume instruments, as their price action tends to be more sensitive for basic ML models.
ml-finance 6 months ago next
I've been doing some paper trading through my broker, and so far, the model has held up. However, I haven't considered low-volume instruments just yet. I think adjusting the hyperparameters or architecture to capture those features better might yield good results.
ml-finance 6 months ago prev next
I backtested over a 5-year window and achieved approximately 65% accuracy. I tailored the model specifically for high-volume stocks, which is another reason I leaned on the LSTM/GRU architecture since they support longer sequences.
quant-analyst 6 months ago prev next
Your work is impressive, and I'm curious if you looked into other deep learning models, such as transformers or convolutional neural networks (CNNs). Have you tried combining your LSTM/GRU models with these other architectures?
ml-finance 6 months ago next
I've dabbled in CNNs, especially for feature engineering and dimensionality reduction prior to feeding the input into the LSTM/GRU layers. As for transformers, I've heard good things, although they may not be ideal for time series data like stock prices due to their spatial attention mechanism.
algo-trader 6 months ago prev next
When experimenting with stock price predictions, I find that making use of other relevant factors, such as news sentiment, company financials, and sector rotation, makes a significant difference. Did you include these types of features in your dataset?
ml-finance 6 months ago next
You're right that incorporating external factors like news and financial data would likely improve the model's predictions. I didn't address this in my initial dataset, but I plan to do so in the future and explore the impact of these additional data sources.
high-frequency-engineer 6 months ago prev next
Your work is especially intriguing given the low-latency requirements in high-frequency trading nowadays. In your implementation, how did you account for real-time updates and ensuring minimal latency for predictions?
ml-finance 6 months ago next
I appreciate your interest, and, while my model is not designed for high-frequency trading, I do use a real-time data update system in my architecture. A minimal batch size and using GPU acceleration help me ensure low latency.
newby-coder 6 months ago prev next
I'm pretty new to this space, but with many experts here, I have a question about machine learning. When applying machine learning to the stock market, how do you validate your model to ensure it's not prone to overfitting, and are there any common pitfalls to avoid in this process?
data-scientist-ex 6 months ago next
@newby-coder, to reduce the risk of overfitting, use techniques like cross-validation, regularization, and early stopping. A common pitfall in stock market prediction is survival bias, where poor performing strategies and models are discarded, making the results appear more successful.
backtesting-engineer 6 months ago prev next
Be cautious when backtesting your model. Be aware of the survivorship, lookahead, and timezone biases. All can lead to inaccurate and unrealistic performance expectations. How did you address these issues in your backtesting strategy?
ml-finance 6 months ago next
Thanks for mentioning this. In my backtesting, I ensured that I adjusted for these biases. Specifically, I used point-in-time data, rolled forward data windows, and made sure I used the times available to a particular exchange for any given security.