This challenge focuses on using the Quantrocket platform to build a minimalist trading workflow and involves pulling daily close price data for Apple stock for the year 2023 and implementing a simple model to make buy orders.
☑️ Installed QuantRocket using Docker.
☑️ Went through tutorials to understand basic platform capabilities.
☑️ Pulled daily close price data for Apple stock (AAPL) for the year 2023 (01-01-2023 to 12-31-2023).
🎯 Objective : To build a model for making trading decisions (placing buy orders) on certain days in a year.
- Aims to 📈 maximize the portfolio value by deciding whether to place a buy order trade for the next day.
- Uses daily close prices (p(d)) and calculates percentage returns (r(d)) 💵.
% Return : r(d) = [ p(d) - p(d-1) ] / [ p(d-1) ]
Classified the state (s(d)) based on percentage returns.
If r(d) >= 0.1, s(d) = +1 (Bull state)
Else if -0.1 < r(d) < 0.1, s(d) = 0 (Flat state)
Else s(d) = -1 (Bear state)
Obtained V(N) based on the states classified.
If s(d+1) = 1 & s(d) = 0 ---> V(d+1) = V(d) + 1
Else if s(d+1) = -1 & s(d) = 0 ---> V(d+1) = V(d) - 1
Else (in all other cases) ---> V(d+1) = V(d)
Determining the probability distribution of transitioning from state s(d) to different possible states using data up to day d.
- Used generator function to yield intermediate results.
- Updated transition counts and probabilities as new data points arrive.
- Continuously calculated probabilities based on streaming data.
FINAL PORTFOLIO VALUE = 40
OPTIMAL BUY INDICES = [6, 8, 12, 16, 21, 28, 30, 41, 50, 52, 59, 61, 69, 79, 85, 88, 94, 100, 103, 108, 110, 113, 117, 120, 123, 133, 142, 160, 164, 177, 187, 191, 207, 209, 212, 216, 218, 232, 234, 238]
👉 Check Report.pdf in the current repository for detailed insights and results.