goldhand 13.3__py3-none-any.whl → 14.2__py3-none-any.whl

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/stocks.py CHANGED
@@ -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(500)
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
- 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)
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(800)
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')
@@ -140,7 +140,7 @@ def show_indicator_goldhand_line_strategy(ticker, plot_title = '', ndays=0, plot
140
140
  data = data.tail(ndays)
141
141
  trades = trades.loc[trades['buy_date']>data.date.min()]
142
142
 
143
- if data['high'].max() >= max(data['high'][0:50]):
143
+ if data['high'].max() == max(data['high'][0:50]):
144
144
  tex_loc = [0.1, 0.2]
145
145
  else:
146
146
  tex_loc = [0.1, 0.85]
goldhand/strategy_rsi.py CHANGED
@@ -77,7 +77,7 @@ def show_indicator_rsi_strategy(ticker, buy_threshold = 30, sell_threshold = 70,
77
77
  tdf = data.tail(tdf)
78
78
  trades = trades.loc[trades['buy_date']>tdf.date.min()]
79
79
 
80
- if data['high'].max() >= max(data['high'][0:50]):
80
+ if tdf['high'].max() == max(tdf['high'][0:50]):
81
81
  tex_loc = [0.1, 0.2]
82
82
  else:
83
83
  tex_loc = [0.1, 0.85]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: goldhand
3
- Version: 13.3
3
+ Version: 14.2
4
4
  Summary: A package working with financial data
5
5
  Home-page: https://github.com/misrori/goldhand
6
6
  Author: Mihaly
@@ -0,0 +1,11 @@
1
+ goldhand/__init__.py,sha256=2D68nqSZuv6sqyLJbOXnWIeeFpNgpYc90rHa2Fo70lk,152
2
+ goldhand/backtest.py,sha256=KrZXXaQw3ZPxE3tY0MOCa2qPJX374pVMLwM_VIOKy5Y,6105
3
+ goldhand/helpers.py,sha256=l9yn0kVTiwfUR8sI5nH1QFx6dYikaUQgRA227Ox7hs0,6130
4
+ goldhand/stocks.py,sha256=wizTmZ8ybH76CSHuWbNu0hkbwH95Mw4LWSblb5jl9ro,11680
5
+ goldhand/strategy_goldhand_line.py,sha256=Ulq_wcUOzzQBjtwq45R3_9QbFXHSbkZTtkwOczQC43I,10501
6
+ goldhand/strategy_rsi.py,sha256=Ja2jomY4lw6K_VMLTNcUomn80T2iY3XwL40H2JUdAFY,8802
7
+ goldhand/tw.py,sha256=K8MwMDkW5JtBFBG0qcPzj8OVx2OhDjrOH2UGo6nwtSs,8375
8
+ goldhand-14.2.dist-info/METADATA,sha256=KlD3Z6LQt-MCaGGXPATHgNYP1h3n0oI0QbL_Ewu2NfA,1952
9
+ goldhand-14.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
10
+ goldhand-14.2.dist-info/top_level.txt,sha256=siEJ2_a_Fx_7hqRI4Ms6SzCelbXrK_1H_eOF8KAaMdA,9
11
+ goldhand-14.2.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- goldhand/__init__.py,sha256=2D68nqSZuv6sqyLJbOXnWIeeFpNgpYc90rHa2Fo70lk,152
2
- goldhand/backtest.py,sha256=KrZXXaQw3ZPxE3tY0MOCa2qPJX374pVMLwM_VIOKy5Y,6105
3
- goldhand/helpers.py,sha256=l9yn0kVTiwfUR8sI5nH1QFx6dYikaUQgRA227Ox7hs0,6130
4
- goldhand/stocks.py,sha256=0MnjAex2A2c06JHinToKHBAvUJvYtDFXxtGudqBux6o,10521
5
- goldhand/strategy_goldhand_line.py,sha256=ersczdUtKBpyWpmgbLOEnoGi5MedV1aSjBNptMM-zP0,10501
6
- goldhand/strategy_rsi.py,sha256=9uzKo3HnmpkJV7rxzvovlGZv3-O2rwTJxxdl8V2--s4,8804
7
- goldhand/tw.py,sha256=K8MwMDkW5JtBFBG0qcPzj8OVx2OhDjrOH2UGo6nwtSs,8375
8
- goldhand-13.3.dist-info/METADATA,sha256=rDlhsIGYs5naNPOD5fmCy6_SpNDm9kg0gdkVHCvYlJo,1952
9
- goldhand-13.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
10
- goldhand-13.3.dist-info/top_level.txt,sha256=siEJ2_a_Fx_7hqRI4Ms6SzCelbXrK_1H_eOF8KAaMdA,9
11
- goldhand-13.3.dist-info/RECORD,,