virgo-modules 0.3.7__tar.gz → 0.4.1__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 virgo-modules might be problematic. Click here for more details.
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/PKG-INFO +2 -2
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/setup.py +2 -5
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules/src/edge_utils/edge_utils.py +48 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules/src/re_utils.py +1 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules.egg-info/PKG-INFO +2 -2
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/LICENSE +0 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/README.md +0 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/setup.cfg +0 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules/__init__.py +0 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules/src/__init__.py +0 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules/src/aws_utils.py +0 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules/src/backtester.py +0 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules/src/edge_utils/__init__.py +0 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules/src/edge_utils/conformal_utils.py +0 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules/src/edge_utils/shap_utils.py +0 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules/src/hmm_utils.py +0 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules/src/pull_artifacts.py +0 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules/src/ticketer_source.py +0 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules/src/transformer_utils.py +0 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules.egg-info/SOURCES.txt +0 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules.egg-info/dependency_links.txt +0 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules.egg-info/requires.txt +0 -0
- {virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: virgo_modules
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.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
|
|
@@ -9,7 +9,7 @@ License: MIT
|
|
|
9
9
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.9
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
|
12
|
-
Requires-Python: >=3.9
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
15
|
Provides-Extra: dev
|
|
@@ -5,7 +5,7 @@ with open("virgo_app/README.md", "r") as f:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="virgo_modules",
|
|
8
|
-
version="0.
|
|
8
|
+
version="0.4.1",
|
|
9
9
|
description="data processing and statistical modeling using stock market data",
|
|
10
10
|
package_dir={"": "virgo_app"},
|
|
11
11
|
packages=find_packages(where="virgo_app"),
|
|
@@ -20,11 +20,8 @@ setup(
|
|
|
20
20
|
"Programming Language :: Python :: 3.9",
|
|
21
21
|
"Operating System :: OS Independent",
|
|
22
22
|
],
|
|
23
|
-
# install_requires=["feature-engine==1.6.1","matplotlib==3.6.3","mlflow==2.1.1","numpy==1.23.5","optuna==3.1.0","pandas==1.5.3",
|
|
24
|
-
# "plotly==5.15.0","rsa==4.9","scikit-learn==1.2.1","scipy==1.10.0","seaborn==0.12.2","starlette==0.22.0","statsmodels==0.13.5",
|
|
25
|
-
# "ta==0.10.2","yfinance==0.2.9","hmmlearn==0.3.0","boto3"],
|
|
26
23
|
extras_require={
|
|
27
24
|
"dev": ["pytest>=7.0"],
|
|
28
25
|
},
|
|
29
|
-
python_requires=">=3.9
|
|
26
|
+
python_requires=">=3.9",
|
|
30
27
|
)
|
{virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules/src/edge_utils/edge_utils.py
RENAMED
|
@@ -414,4 +414,52 @@ def edge_probas_lines(data, threshold, plot = False, look_back = 750):
|
|
|
414
414
|
fig.update_layout(title_text="sirius - edge probabilities",width=1200,height = 500)
|
|
415
415
|
if plot:
|
|
416
416
|
fig.show()
|
|
417
|
+
return fig
|
|
418
|
+
|
|
419
|
+
def get_rolling_probs(data, window = 3,plot = False, look_back = 750):
|
|
420
|
+
"""
|
|
421
|
+
produce a plotly plot of smoothed edges and closing prices
|
|
422
|
+
|
|
423
|
+
Parameters:
|
|
424
|
+
data (pd.DataFrame): asset data with edge probabilities
|
|
425
|
+
window (int): window size
|
|
426
|
+
plot (boolean): if true, display plot
|
|
427
|
+
look_back (int): number of rows back to display
|
|
428
|
+
|
|
429
|
+
Returns:
|
|
430
|
+
fig (obj): plotly go object
|
|
431
|
+
"""
|
|
432
|
+
prob_cols = ['proba_target_down','proba_target_up']
|
|
433
|
+
df = data[prob_cols+['Date','log_return','Close']].iloc[-look_back:]
|
|
434
|
+
for colx in prob_cols:
|
|
435
|
+
df[f'roll_{colx}'] = df.sort_values('Date')[colx].rolling(window, min_periods=1).mean()
|
|
436
|
+
df['roll_edge'] = np.where(df['roll_proba_target_up'] > df['roll_proba_target_down'],'up','down')
|
|
437
|
+
#order chaining
|
|
438
|
+
df['lag'] = df['roll_edge'].shift(1)
|
|
439
|
+
df['change'] = np.where(df['roll_edge']!=df['lag'],1,np.nan)
|
|
440
|
+
df['rn'] = df.sort_values('Date').groupby('change').cumcount() + 1
|
|
441
|
+
df['rn'] = np.where(df['change']==1,df['rn'],np.nan)
|
|
442
|
+
df['chain'] = df.sort_values('Date')['rn'].fillna(method='ffill')
|
|
443
|
+
df['chain_id'] = df.sort_values(['Date']).groupby(['chain','chain']).cumcount() + 1
|
|
444
|
+
|
|
445
|
+
colors = {'up':'blue','down':'red'}
|
|
446
|
+
fig = make_subplots(
|
|
447
|
+
rows=2, cols=2,shared_xaxes=False,vertical_spacing=0.08,
|
|
448
|
+
specs=[[{"colspan": 2, "secondary_y":True}, None],[{}, {}]],
|
|
449
|
+
subplot_titles=("Smooth edge probabilities", "expected log return", "Duration"))
|
|
450
|
+
fig.add_trace(go.Scatter(x=df.Date, y=df.Close,mode='lines+markers',name='Close price'))
|
|
451
|
+
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)
|
|
452
|
+
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)
|
|
453
|
+
|
|
454
|
+
for re in df['roll_edge'].unique():
|
|
455
|
+
fig.add_trace(go.Box(x=df[df['roll_edge']==re]["log_return"],name=re,marker_color=colors.get(re),showlegend=False),col=1,row=2)
|
|
456
|
+
|
|
457
|
+
df_ = df.groupby(['roll_edge','chain'],as_index=False).agg(max_duration = ('chain_id','max'))
|
|
458
|
+
for re in df_['roll_edge'].unique():
|
|
459
|
+
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)
|
|
460
|
+
|
|
461
|
+
fig.update_layout(title_text="sirius - smooth edge probabilities",width=1200,height = 1000)
|
|
462
|
+
if plot:
|
|
463
|
+
fig.show()
|
|
464
|
+
|
|
417
465
|
return fig
|
|
@@ -749,6 +749,7 @@ def get_data(ticker_name:str, ticket_settings:dict, n_days:int = False, hmm_avai
|
|
|
749
749
|
if len(discrete_features) > 0:
|
|
750
750
|
for feature_name in discrete_features:
|
|
751
751
|
object_stock.produce_order_features(feature_name)
|
|
752
|
+
object_stock.get_order_feature_nosignal(feature_name)
|
|
752
753
|
|
|
753
754
|
if hmm_available:
|
|
754
755
|
object_stock.cluster_hmm_analysis( n_clusters = None,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: virgo-modules
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.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
|
|
@@ -9,7 +9,7 @@ License: MIT
|
|
|
9
9
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.9
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
|
12
|
-
Requires-Python: >=3.9
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
15
|
Provides-Extra: dev
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules/src/edge_utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules/src/edge_utils/shap_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules/src/transformer_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{virgo_modules-0.3.7 → virgo_modules-0.4.1}/virgo_app/virgo_modules.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|