goldhand 13.5__tar.gz → 14.2__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-13.5 → goldhand-14.2}/PKG-INFO +1 -1
- {goldhand-13.5 → goldhand-14.2}/goldhand/stocks.py +29 -16
- {goldhand-13.5 → goldhand-14.2}/goldhand.egg-info/PKG-INFO +1 -1
- {goldhand-13.5 → goldhand-14.2}/setup.py +1 -1
- {goldhand-13.5 → goldhand-14.2}/README.md +0 -0
- {goldhand-13.5 → goldhand-14.2}/goldhand/__init__.py +0 -0
- {goldhand-13.5 → goldhand-14.2}/goldhand/backtest.py +0 -0
- {goldhand-13.5 → goldhand-14.2}/goldhand/helpers.py +0 -0
- {goldhand-13.5 → goldhand-14.2}/goldhand/strategy_goldhand_line.py +0 -0
- {goldhand-13.5 → goldhand-14.2}/goldhand/strategy_rsi.py +0 -0
- {goldhand-13.5 → goldhand-14.2}/goldhand/tw.py +0 -0
- {goldhand-13.5 → goldhand-14.2}/goldhand.egg-info/SOURCES.txt +0 -0
- {goldhand-13.5 → goldhand-14.2}/goldhand.egg-info/dependency_links.txt +0 -0
- {goldhand-13.5 → goldhand-14.2}/goldhand.egg-info/requires.txt +0 -0
- {goldhand-13.5 → goldhand-14.2}/goldhand.egg-info/top_level.txt +0 -0
- {goldhand-13.5 → goldhand-14.2}/setup.cfg +0 -0
|
@@ -143,22 +143,22 @@ class GoldHand:
|
|
|
143
143
|
self.df.loc[states[i], 'local_text'] = f'{temj}{fall}%<br>${round(current_low, 2)}'
|
|
144
144
|
|
|
145
145
|
|
|
146
|
-
def plotly_last_year(self, plot_title, plot_height=900):
|
|
147
|
-
tdf = self.df.tail(
|
|
146
|
+
def plotly_last_year(self, plot_title, plot_height=900, ndays=500, ad_local_min_max=True):
|
|
147
|
+
tdf = self.df.tail(ndays)
|
|
148
148
|
|
|
149
149
|
fig = go.Figure(data=go.Ohlc(x=tdf['date'], open=tdf['open'], high=tdf['high'], low=tdf['low'],close=tdf['close']))
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
150
|
+
if ad_local_min_max:
|
|
151
|
+
for index, row in tdf[tdf['local']!=''].iterrows():
|
|
152
|
+
direction = row['local']
|
|
153
|
+
tdate = row['date']
|
|
154
|
+
local_text = row['local_text']
|
|
155
|
+
min_price = row['low']
|
|
156
|
+
max_price = row['high']
|
|
157
|
+
if direction == 'maximum':
|
|
158
|
+
fig.add_annotation( x=tdate, y=max_price, text=local_text, showarrow=True, align="center", bordercolor="#c7c7c7", font=dict(family="Courier New, monospace", size=16, color="#214e34" ), borderwidth=2, borderpad=4, bgcolor="#f4fdff", opacity=0.8, arrowhead=2, arrowsize=1, arrowwidth=1, ax=-45,ay=-45)
|
|
159
|
+
|
|
160
|
+
if direction == 'minimum':
|
|
161
|
+
fig.add_annotation( x=tdate, y=min_price, text=local_text, showarrow=True, align="center", bordercolor="#c7c7c7", font=dict(family="Courier New, monospace", size=16, color="red" ), borderwidth=2, borderpad=4, bgcolor="#f4fdff", opacity=0.8, arrowhead=2, arrowsize=1, arrowwidth=1, ax=45,ay=45)
|
|
162
162
|
|
|
163
163
|
fig.update_layout(showlegend=False, plot_bgcolor='white', height=plot_height, title= plot_title)
|
|
164
164
|
|
|
@@ -169,7 +169,7 @@ class GoldHand:
|
|
|
169
169
|
fig.add_trace( go.Scatter(x=tdf['date'], y=tdf['sma_200'], opacity =0.7, line=dict(color='red', width = 2.5) , name = 'SMA 200') )
|
|
170
170
|
return(fig)
|
|
171
171
|
|
|
172
|
-
def plot_goldhand_line(self, plot_title, plot_height=900):
|
|
172
|
+
def plot_goldhand_line(self, plot_title, plot_height=900, ndays=800, ad_local_min_max=True):
|
|
173
173
|
|
|
174
174
|
data = self.df.copy()
|
|
175
175
|
# Apply SMMA to the dataframe
|
|
@@ -190,9 +190,22 @@ class GoldHand:
|
|
|
190
190
|
# Create a 'group' column and increase the value only when there's a color change
|
|
191
191
|
data['group'] = (data['color_change']).cumsum()
|
|
192
192
|
|
|
193
|
-
tdf = data.tail(
|
|
193
|
+
tdf = data.tail(ndays)
|
|
194
194
|
|
|
195
195
|
fig = go.Figure(data=go.Ohlc(x=tdf['date'], open=tdf['open'], high=tdf['high'], low=tdf['low'],close=tdf['close']))
|
|
196
|
+
if ad_local_min_max:
|
|
197
|
+
for index, row in tdf[tdf['local']!=''].iterrows():
|
|
198
|
+
direction = row['local']
|
|
199
|
+
tdate = row['date']
|
|
200
|
+
local_text = row['local_text']
|
|
201
|
+
min_price = row['low']
|
|
202
|
+
max_price = row['high']
|
|
203
|
+
if direction == 'maximum':
|
|
204
|
+
fig.add_annotation( x=tdate, y=max_price, text=local_text, showarrow=True, align="center", bordercolor="#c7c7c7", font=dict(family="Courier New, monospace", size=16, color="#214e34" ), borderwidth=2, borderpad=4, bgcolor="#f4fdff", opacity=0.8, arrowhead=2, arrowsize=1, arrowwidth=1, ax=-45,ay=-45)
|
|
205
|
+
|
|
206
|
+
if direction == 'minimum':
|
|
207
|
+
fig.add_annotation( x=tdate, y=min_price, text=local_text, showarrow=True, align="center", bordercolor="#c7c7c7", font=dict(family="Courier New, monospace", size=16, color="red" ), borderwidth=2, borderpad=4, bgcolor="#f4fdff", opacity=0.8, arrowhead=2, arrowsize=1, arrowwidth=1, ax=45,ay=45)
|
|
208
|
+
|
|
196
209
|
|
|
197
210
|
fig.update_xaxes( mirror=True, ticks='outside', showline=True, linecolor='black', gridcolor='lightgrey' )
|
|
198
211
|
fig.update_yaxes( mirror=True, ticks='outside', showline=True, linecolor='black', gridcolor='lightgrey')
|
|
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
|
|
File without changes
|
|
File without changes
|