goldhand 17.5__tar.gz → 18.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.
Potentially problematic release.
This version of goldhand might be problematic. Click here for more details.
- {goldhand-17.5 → goldhand-18.0}/PKG-INFO +1 -3
- {goldhand-17.5 → goldhand-18.0}/goldhand/helpers.py +28 -16
- {goldhand-17.5 → goldhand-18.0}/goldhand/stocks.py +26 -9
- {goldhand-17.5 → goldhand-18.0}/goldhand.egg-info/PKG-INFO +1 -3
- {goldhand-17.5 → goldhand-18.0}/goldhand.egg-info/requires.txt +0 -2
- {goldhand-17.5 → goldhand-18.0}/setup.py +3 -3
- {goldhand-17.5 → goldhand-18.0}/README.md +0 -0
- {goldhand-17.5 → goldhand-18.0}/goldhand/__init__.py +0 -0
- {goldhand-17.5 → goldhand-18.0}/goldhand/backtest.py +0 -0
- {goldhand-17.5 → goldhand-18.0}/goldhand/strategy_goldhand_line.py +0 -0
- {goldhand-17.5 → goldhand-18.0}/goldhand/strategy_rsi.py +0 -0
- {goldhand-17.5 → goldhand-18.0}/goldhand/tw.py +0 -0
- {goldhand-17.5 → goldhand-18.0}/goldhand.egg-info/SOURCES.txt +0 -0
- {goldhand-17.5 → goldhand-18.0}/goldhand.egg-info/dependency_links.txt +0 -0
- {goldhand-17.5 → goldhand-18.0}/goldhand.egg-info/top_level.txt +0 -0
- {goldhand-17.5 → goldhand-18.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: goldhand
|
|
3
|
-
Version:
|
|
3
|
+
Version: 18.0
|
|
4
4
|
Summary: A package working with financial data
|
|
5
5
|
Home-page: https://github.com/misrori/goldhand
|
|
6
6
|
Author: Mihaly
|
|
@@ -9,12 +9,10 @@ License: MIT
|
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
10
|
Requires-Dist: pandas_datareader
|
|
11
11
|
Requires-Dist: pandas
|
|
12
|
-
Requires-Dist: pandas_ta
|
|
13
12
|
Requires-Dist: plotly
|
|
14
13
|
Requires-Dist: scipy
|
|
15
14
|
Requires-Dist: numpy
|
|
16
15
|
Requires-Dist: numba
|
|
17
|
-
Requires-Dist: numpy
|
|
18
16
|
Requires-Dist: requests
|
|
19
17
|
Requires-Dist: cloudscraper
|
|
20
18
|
Requires-Dist: tqdm
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from datetime import datetime, timedelta
|
|
2
2
|
import pandas as pd
|
|
3
|
-
import pandas_ta as ta
|
|
4
3
|
import plotly.graph_objects as go
|
|
5
4
|
import plotly.express as px
|
|
6
5
|
from scipy.signal import argrelextrema
|
|
@@ -21,30 +20,43 @@ def get_olhc( ticker, scraper = cloudscraper.create_scraper(), ad_ticker=False,
|
|
|
21
20
|
|
|
22
21
|
|
|
23
22
|
def get_olhc_data(ticker):
|
|
24
|
-
# Download historical stock data for the last year
|
|
25
23
|
df = get_olhc(ticker)
|
|
26
24
|
df.columns = df.columns.str.lower()
|
|
27
25
|
df['date']= [x.date() for x in df['date']]
|
|
28
26
|
|
|
29
|
-
#
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
# ===== RSI (14, Wilder smoothing) =====
|
|
28
|
+
delta = df['close'].diff()
|
|
29
|
+
gain = delta.clip(lower=0)
|
|
30
|
+
loss = -delta.clip(upper=0)
|
|
31
|
+
win = 14
|
|
32
|
+
avg_gain = gain.ewm(alpha=1/win, min_periods=win).mean()
|
|
33
|
+
avg_loss = loss.ewm(alpha=1/win, min_periods=win).mean()
|
|
34
|
+
rs = avg_gain / avg_loss
|
|
35
|
+
df['rsi'] = 100 - (100 / (1 + rs))
|
|
36
|
+
|
|
37
|
+
# ===== SMAS =====
|
|
38
|
+
df['sma_50'] = df['close'].rolling(50).mean()
|
|
39
|
+
df['diff_sma50'] = (df['close']/df['sma_50'] -1)*100
|
|
40
|
+
|
|
41
|
+
df['sma_100'] = df['close'].rolling(100).mean()
|
|
36
42
|
df['diff_sma100'] = (df['close']/df['sma_100'] -1)*100
|
|
37
|
-
|
|
43
|
+
|
|
44
|
+
df['sma_200'] = df['close'].rolling(200).mean()
|
|
38
45
|
df['diff_sma200'] = (df['close']/df['sma_200'] -1)*100
|
|
39
46
|
|
|
40
|
-
#
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
df['
|
|
44
|
-
df['bb_upper'] =
|
|
47
|
+
# ===== Bollinger Bands (20, 2) =====
|
|
48
|
+
mid = df['close'].rolling(20).mean()
|
|
49
|
+
std = df['close'].rolling(20).std()
|
|
50
|
+
df['bb_mid'] = mid
|
|
51
|
+
df['bb_upper'] = mid + 2*std
|
|
52
|
+
df['bb_lower'] = mid - 2*std
|
|
53
|
+
|
|
45
54
|
df['diff_upper_bb'] = (df['bb_upper']/df['close'] -1)*100
|
|
46
55
|
df['diff_lower_bb'] = (df['bb_lower']/df['close'] -1)*100
|
|
47
|
-
|
|
56
|
+
|
|
57
|
+
return df
|
|
58
|
+
|
|
59
|
+
|
|
48
60
|
|
|
49
61
|
def add_locals_to_olhc(df):
|
|
50
62
|
#local min maxs
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from datetime import datetime, timedelta
|
|
2
2
|
import pandas as pd
|
|
3
|
-
import pandas_ta as ta
|
|
4
3
|
import plotly.graph_objects as go
|
|
5
4
|
import plotly.express as px
|
|
6
5
|
from scipy.signal import argrelextrema
|
|
@@ -77,24 +76,42 @@ class GoldHand:
|
|
|
77
76
|
|
|
78
77
|
try:
|
|
79
78
|
# Rsi
|
|
80
|
-
|
|
79
|
+
window = 14
|
|
80
|
+
delta = self.df['close'].diff()
|
|
81
|
+
|
|
82
|
+
gain = delta.clip(lower=0)
|
|
83
|
+
loss = -delta.clip(upper=0)
|
|
84
|
+
|
|
85
|
+
avg_gain = gain.rolling(window).mean()
|
|
86
|
+
avg_loss = loss.rolling(window).mean()
|
|
87
|
+
|
|
88
|
+
rs = avg_gain / avg_loss
|
|
89
|
+
self.df['rsi'] = 100 - (100 / (1 + rs))
|
|
90
|
+
|
|
81
91
|
|
|
82
92
|
# SMAS
|
|
83
|
-
self.df['sma_50']=
|
|
93
|
+
self.df['sma_50'] = self.df['close'].rolling(50).mean()
|
|
94
|
+
self.df['sma_100'] = self.df['close'].rolling(100).mean()
|
|
95
|
+
self.df['sma_200'] = self.df['close'].rolling(200).mean()
|
|
96
|
+
|
|
84
97
|
self.df['diff_sma50'] = (self.df['close']/self.df['sma_50'] -1)*100
|
|
85
|
-
self.df['sma_100']= ta.sma(self.df['close'], 100)
|
|
86
98
|
self.df['diff_sma100'] = (self.df['close']/self.df['sma_100'] -1)*100
|
|
87
|
-
self.df['sma_200']= ta.sma(self.df['close'], 200)
|
|
88
99
|
self.df['diff_sma200'] = (self.df['close']/self.df['sma_200'] -1)*100
|
|
89
100
|
|
|
90
101
|
#Bolinger bands
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
self.df['
|
|
94
|
-
self.df['
|
|
102
|
+
bb_window = 20
|
|
103
|
+
|
|
104
|
+
mid = self.df['close'].rolling(bb_window).mean()
|
|
105
|
+
std = self.df['close'].rolling(bb_window).std()
|
|
106
|
+
|
|
107
|
+
self.df['bb_mid'] = mid
|
|
108
|
+
self.df['bb_upper'] = mid + 2*std
|
|
109
|
+
self.df['bb_lower'] = mid - 2*std
|
|
110
|
+
|
|
95
111
|
self.df['diff_upper_bb'] = (self.df['bb_upper']/self.df['close'] -1)*100
|
|
96
112
|
self.df['diff_lower_bb'] = (self.df['bb_lower']/self.df['close'] -1)*100
|
|
97
113
|
|
|
114
|
+
|
|
98
115
|
#local min maxs
|
|
99
116
|
self.df['local'] = ''
|
|
100
117
|
self.df['local_text'] = ''
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: goldhand
|
|
3
|
-
Version:
|
|
3
|
+
Version: 18.0
|
|
4
4
|
Summary: A package working with financial data
|
|
5
5
|
Home-page: https://github.com/misrori/goldhand
|
|
6
6
|
Author: Mihaly
|
|
@@ -9,12 +9,10 @@ License: MIT
|
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
10
|
Requires-Dist: pandas_datareader
|
|
11
11
|
Requires-Dist: pandas
|
|
12
|
-
Requires-Dist: pandas_ta
|
|
13
12
|
Requires-Dist: plotly
|
|
14
13
|
Requires-Dist: scipy
|
|
15
14
|
Requires-Dist: numpy
|
|
16
15
|
Requires-Dist: numba
|
|
17
|
-
Requires-Dist: numpy
|
|
18
16
|
Requires-Dist: requests
|
|
19
17
|
Requires-Dist: cloudscraper
|
|
20
18
|
Requires-Dist: tqdm
|
|
@@ -8,14 +8,14 @@ long_description = (this_directory / "README.md").read_text()
|
|
|
8
8
|
|
|
9
9
|
setup(
|
|
10
10
|
name="goldhand",
|
|
11
|
-
version="
|
|
11
|
+
version="18.0",
|
|
12
12
|
author="Mihaly",
|
|
13
13
|
author_email="ormraat.pte@gmail.com",
|
|
14
14
|
description="A package working with financial data",
|
|
15
15
|
url="https://github.com/misrori/goldhand",
|
|
16
16
|
license="MIT",
|
|
17
|
-
install_requires=['pandas_datareader', 'pandas', '
|
|
18
|
-
'
|
|
17
|
+
install_requires=['pandas_datareader', 'pandas', 'plotly', 'scipy', 'numpy', 'numba',
|
|
18
|
+
'requests', 'cloudscraper', 'tqdm'],
|
|
19
19
|
packages=find_packages(),
|
|
20
20
|
# other arguments omitted
|
|
21
21
|
long_description=long_description,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|