Skip to content

Commit a545467

Browse files
authored
Merge pull request #1 from mayur7garg/marimo
Added interactive notebook
2 parents 0f4785e + 4fb92dc commit a545467

File tree

6 files changed

+444
-13
lines changed

6 files changed

+444
-13
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"customizations": {
77
"vscode": {
88
"extensions": [
9-
"ms-python.python"
9+
"ms-python.python",
10+
"marimo-team.vscode-marimo"
1011
]
1112
}
1213
}

README.md

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,63 @@ Easy to follow stock price analysis on Indian stock data with results hosted at
77
<summary>Click to expand</summary>
88

99
- [Data](#data)
10-
- [Project Requirements](#project-requirements)
10+
- [Project Prerequisites](#project-prerequisites)
11+
- [Usage](#usage)
1112
- [Notes and Caveats](#notes-and-caveats)
1213
- [About this project](#about-this-project)
1314
</details>
1415

1516
## Data
17+
18+
### Sources
1619
This project uses historical data acquired from publicly available sources listed below:
1720

18-
1. [NSE India](https://www.nseindia.com/)
19-
2. [Screener.in](https://www.screener.in/)
21+
1. [NSE India](https://www.nseindia.com/) - Daily stock prices
22+
2. [Screener.in](https://www.screener.in/) - Stock PE
23+
24+
### Update schedule
25+
Stock pricing data is updated 3 times a week for a set of symbols via a [cron workflow](.github/workflows/main.yml) running on GitHub actions.
26+
27+
Updating PE data, however, is a manual process. Hence, PE information is not likely to be correct for recent dates and should not be relied upon.
2028

21-
## Project Requirements
29+
## Project Prerequisites
2230

2331
### Docker
24-
Development of this project was done inside a developmental Docker container using the base image of `Python v3.11.6`. The same environment can be set up using the `docker-compose.yml` available [here](./docker-compose.yml).
32+
Development of this project was done inside a Docker container using the base image of `Python v3.11.6`. The same environment can be set up using the `docker-compose.yml` available [here](./docker-compose.yml).
33+
34+
If using VS Code or GitHub Codespaces, a developmental container can be instantiated using the [devcontainer.json](.devcontainer/devcontainer.json) file
2535

2636
### Requirements
2737
All top level packages used in this project are listed in the [requirements](./requirements.txt) file. This project does not use any niche functionality from any of the listed packages and hence should work with their most recent releases.
2838

39+
## Usage
40+
41+
### Static reports
42+
This project generates static HTML reports which are hosted using GitHub Pages which can be viewed at [FinancialModelling](https://mayur7garg.github.io/FinancialModelling/).
43+
44+
To regenerate the reports and the associated plots, run the following command:
45+
```sh
46+
cd 'Stock Forecasting' && python main.py
47+
```
48+
49+
Once generated, the reports can be viewed by opening [index.html](index.html) in any web browser.
50+
51+
### Interactive notebook
52+
An interactive [marimo](https://marimo.io/) notebook has been included which can be run using the following command:
53+
```sh
54+
cd 'Stock Forecasting' && marimo run stock_interactive.py
55+
```
56+
2957
## Notes and Caveats
30-
- This project only focuses on day level stock price data and does not factor in intraday price changes.
58+
- This project is only meant to be educational and analytical purposes and should not be interpreted as a financial advice.
59+
- This project only focuses on day level stock price data and does not factor in intraday price changes or company fundamentals.
60+
- Data used in this project is not updated in realtime and may be out of date.
3161
- Currently, the analysis doesn't factor in stock splits, bonus shares, etc. as structured data for the same is difficult to obtain.
32-
- This project is only meant to be educational and should not be interpreted as a financial advice.
3362

3463
## About this project
3564

65+
Feel free to leave a star if you liked this project.
66+
3667
```bibtex
3768
@misc{MayurGarg_FinancialModelling,
3869
title={Financial Modelling},

Stock Forecasting/data_process.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ def __init__(
4747
) -> None:
4848
self.symbol = symbol
4949
self.image_out_path = image_out_path
50-
consolidated_data_path = stock_data_dir.joinpath(symbol, "consolidated.parquet")
50+
self.consolidated_data_path = stock_data_dir.joinpath(symbol, "consolidated.parquet")
5151

52-
if reload_data or (not (consolidated_data_path.exists() and consolidated_data_path.is_file())):
52+
if reload_data or (not (self.consolidated_data_path.exists() and self.consolidated_data_path.is_file())):
5353
self.raw_data = self.consolidate_data(
5454
stock_data_dir,
5555
eps_data_dir
5656
)
57-
self.raw_data.to_parquet(consolidated_data_path, index = False)
57+
self.raw_data.to_parquet(self.consolidated_data_path, index = False)
5858
else:
59-
self.raw_data = pd.read_parquet(consolidated_data_path)
59+
self.raw_data = pd.read_parquet(self.consolidated_data_path)
6060

6161
self.last_close = self.raw_data['Close'].iloc[-1]
6262

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
{
2+
"type": "grid",
3+
"data": {
4+
"columns": 24,
5+
"rowHeight": 20,
6+
"maxWidth": 1400,
7+
"bordered": true,
8+
"cells": [
9+
{
10+
"position": null
11+
},
12+
{
13+
"position": null
14+
},
15+
{
16+
"position": [
17+
9,
18+
0,
19+
6,
20+
2
21+
]
22+
},
23+
{
24+
"position": [
25+
9,
26+
3,
27+
6,
28+
3
29+
]
30+
},
31+
{
32+
"position": null
33+
},
34+
{
35+
"position": [
36+
0,
37+
7,
38+
6,
39+
2
40+
]
41+
},
42+
{
43+
"position": [
44+
0,
45+
9,
46+
24,
47+
25
48+
],
49+
"scrollable": true
50+
},
51+
{
52+
"position": [
53+
0,
54+
35,
55+
6,
56+
2
57+
]
58+
},
59+
{
60+
"position": [
61+
0,
62+
37,
63+
24,
64+
15
65+
],
66+
"scrollable": true
67+
},
68+
{
69+
"position": [
70+
0,
71+
53,
72+
6,
73+
2
74+
]
75+
},
76+
{
77+
"position": [
78+
0,
79+
55,
80+
12,
81+
19
82+
]
83+
},
84+
{
85+
"position": [
86+
12,
87+
55,
88+
12,
89+
19
90+
]
91+
},
92+
{
93+
"position": [
94+
0,
95+
75,
96+
6,
97+
2
98+
]
99+
},
100+
{
101+
"position": [
102+
0,
103+
77,
104+
10,
105+
23
106+
]
107+
},
108+
{
109+
"position": [
110+
10,
111+
77,
112+
14,
113+
23
114+
]
115+
},
116+
{
117+
"position": [
118+
0,
119+
101,
120+
6,
121+
2
122+
]
123+
},
124+
{
125+
"position": [
126+
0,
127+
103,
128+
10,
129+
20
130+
]
131+
},
132+
{
133+
"position": [
134+
10,
135+
101,
136+
14,
137+
22
138+
]
139+
},
140+
{
141+
"position": [
142+
0,
143+
124,
144+
6,
145+
2
146+
]
147+
},
148+
{
149+
"position": [
150+
0,
151+
126,
152+
12,
153+
20
154+
]
155+
},
156+
{
157+
"position": [
158+
12,
159+
126,
160+
12,
161+
20
162+
]
163+
},
164+
{
165+
"position": [
166+
0,
167+
147,
168+
9,
169+
2
170+
]
171+
},
172+
{
173+
"position": [
174+
0,
175+
149,
176+
12,
177+
19
178+
]
179+
},
180+
{
181+
"position": [
182+
12,
183+
149,
184+
12,
185+
19
186+
]
187+
}
188+
]
189+
}
190+
}

0 commit comments

Comments
 (0)