virgo-modules 0.1.0__py3-none-any.whl → 0.1.1__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 virgo-modules might be problematic. Click here for more details.

@@ -50,9 +50,11 @@ class SignalAnalyserObject:
50
50
  aws_credentials: dict
51
51
  signal_position: int
52
52
  if available, signal position to open a position
53
- df: pd.DataFrame:
53
+ df: pd.DataFrame
54
54
  transformed data of the selected feature to perform back-test
55
-
55
+ median_return: float
56
+ median return after end low signals
57
+
56
58
  Methods
57
59
  -------
58
60
  signal_analyser(days_list=list):
@@ -169,12 +171,19 @@ class SignalAnalyserObject:
169
171
 
170
172
  df['open_long'] = np.where(df.last_in_chain == True, True, np.nan)
171
173
  df['open_short'] = np.where(df.first_in_chain == True, True, np.nan)
174
+ df.signal_type = df.signal_type.map({'up':'go down', 'down': 'go up'})
175
+
176
+ # median return
177
+ returns_list = [f'return_{days}d' for days in days_list]
178
+ df_melt = df[df.open_long == True].pivot_table(index=['signal_type'], values=returns_list, aggfunc='median')
179
+ df_melt['median'] = df_melt[returns_list].median(axis = 1)
180
+ self.median_return = df_melt.loc['go up', 'median']
172
181
 
173
182
  # plotting
174
183
  fig, axs = plt.subplots(1, 4, figsize = (20,5))
175
184
  palette ={"go down": "tomato", "go up": "lightblue"}
176
185
 
177
- df2 = df[df.signal_type.isin(['up','down'])]
186
+ df2 = df[df.signal_type.isin(['go down','go up'])]
178
187
  df2['lag_Date'] = df2['Date'].shift(1)
179
188
  df2['lag_signal_type'] = df2['signal_type'].shift(1)
180
189
  df2 = df2[df2.lag_signal_type != df2.signal_type]
@@ -183,7 +192,6 @@ class SignalAnalyserObject:
183
192
  sns.stripplot(data=df2, y="span",ax = axs[0], jitter=True, zorder=1)
184
193
  axs[0].set_title('span between last signals')
185
194
 
186
- df.signal_type = df.signal_type.map({'up':'go down', 'down': 'go up'})
187
195
  df_ = df[df.last_in_chain == True]
188
196
  df_['part'] = '-'
189
197
  sns.violinplot(data=df_, y="internal_rn", x='part', ax = axs[1], hue="signal_type", inner="quart",palette = palette,gap=0.1, split=True, linewidth=0.7)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: virgo-modules
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: data processing and statistical modeling using stock market data
5
5
  Home-page: https://github.com/miguelmayhem92/virgo_module
6
6
  Author: Miguel Mayhuire
@@ -1,13 +1,13 @@
1
1
  virgo_modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  virgo_modules/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  virgo_modules/src/aws_utils.py,sha256=q0l7D7ofo09Lu1QQjv-esheQ06uiSy1Pdq3xMul8zvk,2571
4
- virgo_modules/src/backtester.py,sha256=9ZFUl2VbcJhn4ycQ3prPSXforaw-mb_FmDssDKzK5mc,17252
4
+ virgo_modules/src/backtester.py,sha256=MKtDkwwoCfYgzIwKPxsSsEzxt8Nly_kKTQRXWtT7OZM,17680
5
5
  virgo_modules/src/edge_utils.py,sha256=i3Hm3fO-QA-u17jDpnRodLLILMWZ2VTMEkMKijdGKLg,14287
6
6
  virgo_modules/src/pull_artifacts.py,sha256=5OPrgR7pcMSdpbevDRhf0ebk7g7ZRjff4NpTIIWAKjE,1989
7
7
  virgo_modules/src/re_utils.py,sha256=tRyU9WpH0K7qMWXB6DIDtVqjsWg_pVdxEbq363RHZ4M,72306
8
8
  virgo_modules/src/ticketer_source.py,sha256=2wnPm2ng8VyzhApFuJ6tn8VYX_3C8bg77qijsZq_u7k,150153
9
- virgo_modules-0.1.0.dist-info/LICENSE,sha256=pNgFyCYgmimaw0o6V20JupZLROycAnOA_HDDh1tX2V4,1097
10
- virgo_modules-0.1.0.dist-info/METADATA,sha256=kUgig6T9Goiuwmw1iRf_572ii__9MTRaPSnu4aZ5Qxo,1428
11
- virgo_modules-0.1.0.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
12
- virgo_modules-0.1.0.dist-info/top_level.txt,sha256=ZjI-qEkDtT-8mFwGAWnXfqPOKEGlIhWRW1es1VyXc60,14
13
- virgo_modules-0.1.0.dist-info/RECORD,,
9
+ virgo_modules-0.1.1.dist-info/LICENSE,sha256=pNgFyCYgmimaw0o6V20JupZLROycAnOA_HDDh1tX2V4,1097
10
+ virgo_modules-0.1.1.dist-info/METADATA,sha256=JjIDcgyOd3VskJJAoFKs_V4g_b2tQXjmcd7g4DY7miA,1428
11
+ virgo_modules-0.1.1.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
12
+ virgo_modules-0.1.1.dist-info/top_level.txt,sha256=ZjI-qEkDtT-8mFwGAWnXfqPOKEGlIhWRW1es1VyXc60,14
13
+ virgo_modules-0.1.1.dist-info/RECORD,,