virgo-modules 0.8.1__py3-none-any.whl → 0.8.3__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.
- virgo_modules/src/edge_utils/edge_utils.py +5 -4
- virgo_modules/src/re_utils.py +5 -0
- virgo_modules/src/ticketer_source.py +19 -0
- {virgo_modules-0.8.1.dist-info → virgo_modules-0.8.3.dist-info}/METADATA +15 -6
- {virgo_modules-0.8.1.dist-info → virgo_modules-0.8.3.dist-info}/RECORD +8 -8
- {virgo_modules-0.8.1.dist-info → virgo_modules-0.8.3.dist-info}/WHEEL +1 -1
- {virgo_modules-0.8.1.dist-info → virgo_modules-0.8.3.dist-info/licenses}/LICENSE +0 -0
- {virgo_modules-0.8.1.dist-info → virgo_modules-0.8.3.dist-info}/top_level.txt +0 -0
|
@@ -450,7 +450,7 @@ def edge_probas_lines(data, threshold, plot = False, look_back = 750):
|
|
|
450
450
|
fig.show()
|
|
451
451
|
return fig
|
|
452
452
|
|
|
453
|
-
def get_rolling_probs(data, window = 3,plot = False, look_back = 750):
|
|
453
|
+
def get_rolling_probs(data, window = 3,plot = False, look_back = 750, rets_eval=7):
|
|
454
454
|
"""
|
|
455
455
|
produce a plotly plot of smoothed edges and closing prices
|
|
456
456
|
|
|
@@ -465,6 +465,7 @@ def get_rolling_probs(data, window = 3,plot = False, look_back = 750):
|
|
|
465
465
|
"""
|
|
466
466
|
prob_cols = ['proba_target_down','proba_target_up']
|
|
467
467
|
df = data[prob_cols+['Date','log_return','Close']].iloc[-look_back:]
|
|
468
|
+
df["eval_rets"] = (df["Close"]/df["Close"].shift(rets_eval)-1)*100
|
|
468
469
|
for colx in prob_cols:
|
|
469
470
|
df[f'roll_{colx}'] = df.sort_values('Date')[colx].rolling(window, min_periods=1).mean()
|
|
470
471
|
df['roll_edge'] = np.where(df['roll_proba_target_up'] > df['roll_proba_target_down'],'up','down')
|
|
@@ -480,14 +481,14 @@ def get_rolling_probs(data, window = 3,plot = False, look_back = 750):
|
|
|
480
481
|
fig = make_subplots(
|
|
481
482
|
rows=2, cols=2,shared_xaxes=False,vertical_spacing=0.08,
|
|
482
483
|
specs=[[{"colspan": 2, "secondary_y":True}, None],[{}, {}]],
|
|
483
|
-
subplot_titles=("Smooth edge probabilities", "expected
|
|
484
|
+
subplot_titles=("Smooth edge probabilities", f"expected return {rets_eval} days", "Duration"))
|
|
484
485
|
fig.add_trace(go.Scatter(x=df.Date, y=df.Close,mode='lines+markers',name='Close price'))
|
|
485
486
|
fig.add_trace(go.Scatter(x=df.Date, y=df.roll_proba_target_down,mode='lines',marker = dict(color = 'coral'),name='go down'),secondary_y=True,col=1,row=1)
|
|
486
487
|
fig.add_trace(go.Scatter(x=df.Date, y=df.roll_proba_target_up,mode='lines',marker = dict(opacity=0.1,size=80), name='go up'),secondary_y=True,col=1,row=1)
|
|
487
488
|
|
|
488
489
|
for re in df['roll_edge'].unique():
|
|
489
|
-
fig.add_trace(go.Box(x=df[df['roll_edge']==re]["
|
|
490
|
-
|
|
490
|
+
fig.add_trace(go.Box(x=df[df['roll_edge']==re]["eval_rets"],name=re,marker_color=colors.get(re),showlegend=False),col=1,row=2)
|
|
491
|
+
fig.add_vline(x=0, line_width=2, line_dash="dash", line_color="grey", col=1,row=2)
|
|
491
492
|
df_ = df.groupby(['roll_edge','chain'],as_index=False).agg(max_duration = ('chain_id','max'))
|
|
492
493
|
for re in df_['roll_edge'].unique():
|
|
493
494
|
fig.add_trace(go.Box(x=df_[df_['roll_edge']==re]["max_duration"],name=re,marker_color=colors.get(re),showlegend=False),col=2,row=2)
|
virgo_modules/src/re_utils.py
CHANGED
|
@@ -1421,6 +1421,11 @@ def extract_data_traintest(object_stock,features_to_search,configs, target_confi
|
|
|
1421
1421
|
last_signal_featlist = last_signal_featlist.split('//')
|
|
1422
1422
|
if feature_name in last_signal_featlist:
|
|
1423
1423
|
object_stock.compute_last_signal(feature_name, False)
|
|
1424
|
+
volatility_features = configs.get('custom_transformations',{}).get('volatility_features', False)
|
|
1425
|
+
if volatility_features:
|
|
1426
|
+
for al in volatility_features:
|
|
1427
|
+
object_stock.lag_log_return(lags = al, feature="Close", feature_name=f"asset_{al}_logreturn")
|
|
1428
|
+
object_stock.produce_log_volatility(trad_days=al,feature=f"asset_{al}_logreturn",feature_name=f"asset_{al}_volatility")
|
|
1424
1429
|
market_interaction_features = configs.get('custom_transformations',{}).get('market_interaction_features', False)
|
|
1425
1430
|
if market_interaction_features:
|
|
1426
1431
|
for stage in market_interaction_features.keys():
|
|
@@ -142,6 +142,8 @@ class stock_eda_panel(object):
|
|
|
142
142
|
extract new asset data and merge it to the main asset data
|
|
143
143
|
lag_log_return(lags=int, feature=str, feature_name=str):
|
|
144
144
|
compute log return given some lags
|
|
145
|
+
produce_log_volatility(trad_days=int, feature=str, feature_name=str):
|
|
146
|
+
compute volatility
|
|
145
147
|
signal_plotter(feature_name=str):
|
|
146
148
|
display analysis plot of a feature with high and low signals
|
|
147
149
|
log_features_standard(feature_name=str):
|
|
@@ -727,6 +729,23 @@ class stock_eda_panel(object):
|
|
|
727
729
|
|
|
728
730
|
feature_name = feature_name if feature_name else f"{feature}_log_return"
|
|
729
731
|
self.df[feature_name] = np.log(self.df[feature]/self.df[feature].shift(lags))
|
|
732
|
+
|
|
733
|
+
def produce_log_volatility(self, trad_days, feature, feature_name=False):
|
|
734
|
+
"""
|
|
735
|
+
compute log return given some lags
|
|
736
|
+
|
|
737
|
+
Parameters
|
|
738
|
+
----------
|
|
739
|
+
trad_days (int): window function to calculate standard deviation
|
|
740
|
+
feature (str): feature to apply computation
|
|
741
|
+
feature_name (str): resulting feature name
|
|
742
|
+
|
|
743
|
+
Returns
|
|
744
|
+
-------
|
|
745
|
+
None
|
|
746
|
+
"""
|
|
747
|
+
feature_name = feature_name if feature_name else f"{feature}_log_return_{trad_days}"
|
|
748
|
+
self.df[feature_name] = self.df.sort_values("Date")[feature].rolling(window = trad_days).std()*np.sqrt(252)
|
|
730
749
|
|
|
731
750
|
def signal_plotter(self, feature_name):
|
|
732
751
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
2
|
-
Name:
|
|
3
|
-
Version: 0.8.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: virgo_modules
|
|
3
|
+
Version: 0.8.3
|
|
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
|
|
7
7
|
Author-email: miguelmayhem92@gmail.com
|
|
8
8
|
License: MIT
|
|
9
|
-
Platform: UNKNOWN
|
|
10
9
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
10
|
Classifier: Programming Language :: Python :: 3.9
|
|
12
11
|
Classifier: Operating System :: OS Independent
|
|
@@ -14,7 +13,18 @@ Requires-Python: >=3.9
|
|
|
14
13
|
Description-Content-Type: text/markdown
|
|
15
14
|
License-File: LICENSE
|
|
16
15
|
Provides-Extra: dev
|
|
17
|
-
Requires-Dist: pytest
|
|
16
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
17
|
+
Dynamic: author
|
|
18
|
+
Dynamic: author-email
|
|
19
|
+
Dynamic: classifier
|
|
20
|
+
Dynamic: description
|
|
21
|
+
Dynamic: description-content-type
|
|
22
|
+
Dynamic: home-page
|
|
23
|
+
Dynamic: license
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
Dynamic: provides-extra
|
|
26
|
+
Dynamic: requires-python
|
|
27
|
+
Dynamic: summary
|
|
18
28
|
|
|
19
29
|
# Virgo Package
|
|
20
30
|
|
|
@@ -35,4 +45,3 @@ obj = stock_eda_panel(stock_code = 'PEP', n_days = 20)
|
|
|
35
45
|
obj.get_data()
|
|
36
46
|
print(obj.df.shape)
|
|
37
47
|
```
|
|
38
|
-
|
|
@@ -4,19 +4,19 @@ virgo_modules/src/aws_utils.py,sha256=QCyxJwZ6bNCkMpuuxzxkNxejj-hJf4kj2arb1SQPNu
|
|
|
4
4
|
virgo_modules/src/backtester.py,sha256=OhiWyzDX0PthXGuhChyWUmDN3cLkzVYe95zS4nGtia8,22106
|
|
5
5
|
virgo_modules/src/hmm_utils.py,sha256=D7axAnCdSe1_1EgRyli2PAnM2f6699hTY9GcxjPXG-o,21221
|
|
6
6
|
virgo_modules/src/pull_artifacts.py,sha256=5OPrgR7pcMSdpbevDRhf0ebk7g7ZRjff4NpTIIWAKjE,1989
|
|
7
|
-
virgo_modules/src/re_utils.py,sha256=
|
|
8
|
-
virgo_modules/src/ticketer_source.py,sha256=
|
|
7
|
+
virgo_modules/src/re_utils.py,sha256=AQlhyO0cvU-G42dolhedz5E-sniRzeFhf40RD5QVYpo,75506
|
|
8
|
+
virgo_modules/src/ticketer_source.py,sha256=ig6kgR6qSPhyFePRuO52pNmVsYawpgUXCn7RIO3xf5E,104623
|
|
9
9
|
virgo_modules/src/transformer_utils.py,sha256=SnYdtsFPnSF6u4UFIat0-X3-qVuUWvv_T46kiB-H0Sk,13682
|
|
10
10
|
virgo_modules/src/edge_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
virgo_modules/src/edge_utils/conformal_utils.py,sha256=cKm4KSM261Eu1FJn4oowKYiKIesW81VbqITIvopGSVk,5410
|
|
12
|
-
virgo_modules/src/edge_utils/edge_utils.py,sha256=
|
|
12
|
+
virgo_modules/src/edge_utils/edge_utils.py,sha256=8xdcmeEPyfD76c-mcdfkHqWjwtJOPoUsit5UH3cRJTg,20207
|
|
13
13
|
virgo_modules/src/edge_utils/feature_selection.py,sha256=HYbQ0JLPDiRYhn-5-C438YEKbuNduDmuvboFC_VkHww,2453
|
|
14
14
|
virgo_modules/src/edge_utils/shap_utils.py,sha256=FgcHkfddvdFSeUqEubYa2ExRGVAWSthqK4b-eKagEmo,2333
|
|
15
15
|
virgo_modules/src/edge_utils/stack_model.py,sha256=QqE91uLo2KauGEj91AVNANB1xE7J4Fa49YOX7k5mFng,4257
|
|
16
16
|
virgo_modules/src/market/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
virgo_modules/src/market/market_tools.py,sha256=vBt66_7E3ANz7avzfeNw_RHMGvG9lh5PRhxmcf_Oyjc,6880
|
|
18
|
-
virgo_modules-0.8.
|
|
19
|
-
virgo_modules-0.8.
|
|
20
|
-
virgo_modules-0.8.
|
|
21
|
-
virgo_modules-0.8.
|
|
22
|
-
virgo_modules-0.8.
|
|
18
|
+
virgo_modules-0.8.3.dist-info/licenses/LICENSE,sha256=pNgFyCYgmimaw0o6V20JupZLROycAnOA_HDDh1tX2V4,1097
|
|
19
|
+
virgo_modules-0.8.3.dist-info/METADATA,sha256=an7Yx_L5o_jC_P_cVGwdndeQGAfYGeCzIeGubxK_z4Y,1122
|
|
20
|
+
virgo_modules-0.8.3.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
|
|
21
|
+
virgo_modules-0.8.3.dist-info/top_level.txt,sha256=ZjI-qEkDtT-8mFwGAWnXfqPOKEGlIhWRW1es1VyXc60,14
|
|
22
|
+
virgo_modules-0.8.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|