stmrtpy 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stmrtpy-1.0.0/LICENSE +21 -0
- stmrtpy-1.0.0/PKG-INFO +44 -0
- stmrtpy-1.0.0/README.md +31 -0
- stmrtpy-1.0.0/pyproject.toml +18 -0
- stmrtpy-1.0.0/setup.cfg +4 -0
- stmrtpy-1.0.0/stmrtpy/__init__.py +1 -0
- stmrtpy-1.0.0/stmrtpy/chart.py +78 -0
- stmrtpy-1.0.0/stmrtpy/indicators.py +15 -0
- stmrtpy-1.0.0/stmrtpy/utils.py +14 -0
- stmrtpy-1.0.0/stmrtpy.egg-info/PKG-INFO +44 -0
- stmrtpy-1.0.0/stmrtpy.egg-info/SOURCES.txt +12 -0
- stmrtpy-1.0.0/stmrtpy.egg-info/dependency_links.txt +1 -0
- stmrtpy-1.0.0/stmrtpy.egg-info/requires.txt +3 -0
- stmrtpy-1.0.0/stmrtpy.egg-info/top_level.txt +1 -0
stmrtpy-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ayaan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
stmrtpy-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stmrtpy
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Professional stock plotting library with candlestick, volume, MA and RSI
|
|
5
|
+
Author-email: Ayaan <zerogravitygamingx211@gmail.com>
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: matplotlib
|
|
10
|
+
Requires-Dist: pandas
|
|
11
|
+
Requires-Dist: numpy
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# stmrtpy
|
|
15
|
+
|
|
16
|
+
Professional stock market plotting library.
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- Candlestick chart
|
|
21
|
+
- Volume subplot
|
|
22
|
+
- Moving averages
|
|
23
|
+
- RSI
|
|
24
|
+
- Dark mode
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
pip install stmrtpy
|
|
29
|
+
|
|
30
|
+
## Example
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
import pandas as pd
|
|
34
|
+
from stmrtpy import plot_chart
|
|
35
|
+
|
|
36
|
+
df = pd.read_csv("data.csv")
|
|
37
|
+
|
|
38
|
+
plot_chart(
|
|
39
|
+
df,
|
|
40
|
+
ma_windows=(20, 50),
|
|
41
|
+
show_rsi=True,
|
|
42
|
+
dark=True,
|
|
43
|
+
save_path="chart.png"
|
|
44
|
+
)
|
stmrtpy-1.0.0/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# stmrtpy
|
|
2
|
+
|
|
3
|
+
Professional stock market plotting library.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Candlestick chart
|
|
8
|
+
- Volume subplot
|
|
9
|
+
- Moving averages
|
|
10
|
+
- RSI
|
|
11
|
+
- Dark mode
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
pip install stmrtpy
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
import pandas as pd
|
|
21
|
+
from stmrtpy import plot_chart
|
|
22
|
+
|
|
23
|
+
df = pd.read_csv("data.csv")
|
|
24
|
+
|
|
25
|
+
plot_chart(
|
|
26
|
+
df,
|
|
27
|
+
ma_windows=(20, 50),
|
|
28
|
+
show_rsi=True,
|
|
29
|
+
dark=True,
|
|
30
|
+
save_path="chart.png"
|
|
31
|
+
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "stmrtpy"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Professional stock plotting library with candlestick, volume, MA and RSI"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name="Ayaan", email="zerogravitygamingx211@gmail.com" }
|
|
11
|
+
]
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.8"
|
|
14
|
+
dependencies = [
|
|
15
|
+
"matplotlib",
|
|
16
|
+
"pandas",
|
|
17
|
+
"numpy"
|
|
18
|
+
]
|
stmrtpy-1.0.0/setup.cfg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .chart import plot_chart
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import matplotlib.pyplot as plt
|
|
2
|
+
import numpy as np
|
|
3
|
+
from matplotlib.patches import Rectangle
|
|
4
|
+
from .utils import validate_dataframe
|
|
5
|
+
from .indicators import moving_average, rsi
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_chart(
|
|
9
|
+
df,
|
|
10
|
+
ma_windows=(20, 50),
|
|
11
|
+
show_rsi=True,
|
|
12
|
+
dark=False,
|
|
13
|
+
save_path=None
|
|
14
|
+
):
|
|
15
|
+
|
|
16
|
+
df = validate_dataframe(df)
|
|
17
|
+
dates = np.arange(len(df))
|
|
18
|
+
|
|
19
|
+
if dark:
|
|
20
|
+
plt.style.use("dark_background")
|
|
21
|
+
|
|
22
|
+
fig = plt.figure(figsize=(14, 10))
|
|
23
|
+
|
|
24
|
+
if show_rsi:
|
|
25
|
+
gs = fig.add_gridspec(3, 1, height_ratios=[3, 1, 1])
|
|
26
|
+
ax_price = fig.add_subplot(gs[0])
|
|
27
|
+
ax_volume = fig.add_subplot(gs[1], sharex=ax_price)
|
|
28
|
+
ax_rsi = fig.add_subplot(gs[2], sharex=ax_price)
|
|
29
|
+
else:
|
|
30
|
+
gs = fig.add_gridspec(2, 1, height_ratios=[3, 1])
|
|
31
|
+
ax_price = fig.add_subplot(gs[0])
|
|
32
|
+
ax_volume = fig.add_subplot(gs[1], sharex=ax_price)
|
|
33
|
+
ax_rsi = None
|
|
34
|
+
|
|
35
|
+
# Candlesticks
|
|
36
|
+
for i in range(len(df)):
|
|
37
|
+
open_ = df["Open"].iloc[i]
|
|
38
|
+
close = df["Close"].iloc[i]
|
|
39
|
+
high = df["High"].iloc[i]
|
|
40
|
+
low = df["Low"].iloc[i]
|
|
41
|
+
|
|
42
|
+
color = "green" if close >= open_ else "red"
|
|
43
|
+
|
|
44
|
+
ax_price.plot([dates[i], dates[i]], [low, high])
|
|
45
|
+
|
|
46
|
+
rect = Rectangle(
|
|
47
|
+
(dates[i] - 0.3, min(open_, close)),
|
|
48
|
+
0.6,
|
|
49
|
+
abs(close - open_),
|
|
50
|
+
facecolor=color
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
ax_price.add_patch(rect)
|
|
54
|
+
|
|
55
|
+
# Moving Averages
|
|
56
|
+
for window in ma_windows:
|
|
57
|
+
ma = moving_average(df["Close"], window)
|
|
58
|
+
ax_price.plot(dates, ma, label=f"MA{window}")
|
|
59
|
+
|
|
60
|
+
ax_price.legend()
|
|
61
|
+
ax_price.set_title("stmrtpy Stock Chart")
|
|
62
|
+
|
|
63
|
+
# Volume
|
|
64
|
+
ax_volume.bar(dates, df["Volume"])
|
|
65
|
+
|
|
66
|
+
# RSI
|
|
67
|
+
if show_rsi:
|
|
68
|
+
rsi_values = rsi(df["Close"])
|
|
69
|
+
ax_rsi.plot(dates, rsi_values)
|
|
70
|
+
ax_rsi.axhline(70)
|
|
71
|
+
ax_rsi.axhline(30)
|
|
72
|
+
|
|
73
|
+
plt.tight_layout()
|
|
74
|
+
|
|
75
|
+
if save_path:
|
|
76
|
+
plt.savefig(save_path)
|
|
77
|
+
|
|
78
|
+
plt.show()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
3
|
+
def moving_average(series, window):
|
|
4
|
+
return series.rolling(window=window).mean()
|
|
5
|
+
|
|
6
|
+
def rsi(series, period=14):
|
|
7
|
+
delta = series.diff()
|
|
8
|
+
gain = delta.clip(lower=0)
|
|
9
|
+
loss = -delta.clip(upper=0)
|
|
10
|
+
|
|
11
|
+
avg_gain = gain.rolling(period).mean()
|
|
12
|
+
avg_loss = loss.rolling(period).mean()
|
|
13
|
+
|
|
14
|
+
rs = avg_gain / avg_loss
|
|
15
|
+
return 100 - (100 / (1 + rs))
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
|
|
3
|
+
def validate_dataframe(df):
|
|
4
|
+
required = ["Date", "Open", "High", "Low", "Close", "Volume"]
|
|
5
|
+
|
|
6
|
+
for col in required:
|
|
7
|
+
if col not in df.columns:
|
|
8
|
+
raise ValueError(f"Missing required column: {col}")
|
|
9
|
+
|
|
10
|
+
df = df.copy()
|
|
11
|
+
df["Date"] = pd.to_datetime(df["Date"])
|
|
12
|
+
df.sort_values("Date", inplace=True)
|
|
13
|
+
|
|
14
|
+
return df
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stmrtpy
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Professional stock plotting library with candlestick, volume, MA and RSI
|
|
5
|
+
Author-email: Ayaan <zerogravitygamingx211@gmail.com>
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: matplotlib
|
|
10
|
+
Requires-Dist: pandas
|
|
11
|
+
Requires-Dist: numpy
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# stmrtpy
|
|
15
|
+
|
|
16
|
+
Professional stock market plotting library.
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- Candlestick chart
|
|
21
|
+
- Volume subplot
|
|
22
|
+
- Moving averages
|
|
23
|
+
- RSI
|
|
24
|
+
- Dark mode
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
pip install stmrtpy
|
|
29
|
+
|
|
30
|
+
## Example
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
import pandas as pd
|
|
34
|
+
from stmrtpy import plot_chart
|
|
35
|
+
|
|
36
|
+
df = pd.read_csv("data.csv")
|
|
37
|
+
|
|
38
|
+
plot_chart(
|
|
39
|
+
df,
|
|
40
|
+
ma_windows=(20, 50),
|
|
41
|
+
show_rsi=True,
|
|
42
|
+
dark=True,
|
|
43
|
+
save_path="chart.png"
|
|
44
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
stmrtpy/__init__.py
|
|
5
|
+
stmrtpy/chart.py
|
|
6
|
+
stmrtpy/indicators.py
|
|
7
|
+
stmrtpy/utils.py
|
|
8
|
+
stmrtpy.egg-info/PKG-INFO
|
|
9
|
+
stmrtpy.egg-info/SOURCES.txt
|
|
10
|
+
stmrtpy.egg-info/dependency_links.txt
|
|
11
|
+
stmrtpy.egg-info/requires.txt
|
|
12
|
+
stmrtpy.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
stmrtpy
|