virgo-modules 0.2.3__tar.gz → 0.2.5__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.

Files changed (20) hide show
  1. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/PKG-INFO +4 -20
  2. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/setup.py +1 -1
  3. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/virgo_app/virgo_modules/src/re_utils.py +6 -0
  4. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/virgo_app/virgo_modules/src/ticketer_source.py +49 -0
  5. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/virgo_app/virgo_modules.egg-info/PKG-INFO +4 -20
  6. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/LICENSE +0 -0
  7. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/README.md +0 -0
  8. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/setup.cfg +0 -0
  9. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/virgo_app/virgo_modules/__init__.py +0 -0
  10. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/virgo_app/virgo_modules/src/__init__.py +0 -0
  11. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/virgo_app/virgo_modules/src/aws_utils.py +0 -0
  12. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/virgo_app/virgo_modules/src/backtester.py +0 -0
  13. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/virgo_app/virgo_modules/src/edge_utils.py +0 -0
  14. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/virgo_app/virgo_modules/src/hmm_utils.py +0 -0
  15. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/virgo_app/virgo_modules/src/pull_artifacts.py +0 -0
  16. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/virgo_app/virgo_modules/src/transformer_utils.py +0 -0
  17. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/virgo_app/virgo_modules.egg-info/SOURCES.txt +0 -0
  18. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/virgo_app/virgo_modules.egg-info/dependency_links.txt +0 -0
  19. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/virgo_app/virgo_modules.egg-info/requires.txt +0 -0
  20. {virgo_modules-0.2.3 → virgo_modules-0.2.5}/virgo_app/virgo_modules.egg-info/top_level.txt +0 -0
@@ -1,36 +1,19 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: virgo_modules
3
- Version: 0.2.3
3
+ Version: 0.2.5
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
9
10
  Classifier: License :: OSI Approved :: MIT License
10
11
  Classifier: Programming Language :: Python :: 3.9
11
12
  Classifier: Operating System :: OS Independent
12
13
  Requires-Python: >=3.9, <3.10
13
14
  Description-Content-Type: text/markdown
14
- License-File: LICENSE
15
- Requires-Dist: feature-engine==1.6.1
16
- Requires-Dist: matplotlib==3.6.3
17
- Requires-Dist: mlflow==2.1.1
18
- Requires-Dist: numpy==1.23.5
19
- Requires-Dist: optuna==3.1.0
20
- Requires-Dist: pandas==1.5.3
21
- Requires-Dist: plotly==5.15.0
22
- Requires-Dist: rsa==4.9
23
- Requires-Dist: scikit-learn==1.2.1
24
- Requires-Dist: scipy==1.10.0
25
- Requires-Dist: seaborn==0.12.2
26
- Requires-Dist: starlette==0.22.0
27
- Requires-Dist: statsmodels==0.13.5
28
- Requires-Dist: ta==0.10.2
29
- Requires-Dist: yfinance==0.2.9
30
- Requires-Dist: hmmlearn==0.3.0
31
- Requires-Dist: boto3
32
15
  Provides-Extra: dev
33
- Requires-Dist: pytest>=7.0; extra == "dev"
16
+ License-File: LICENSE
34
17
 
35
18
  # Virgo Package
36
19
 
@@ -51,3 +34,4 @@ obj = stock_eda_panel(stock_code = 'PEP', n_days = 20)
51
34
  obj.get_data()
52
35
  print(obj.df.shape)
53
36
  ```
37
+
@@ -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.2.3",
8
+ version="0.2.5",
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"),
@@ -1383,6 +1383,12 @@ def extract_data_traintest(object_stock,features_to_search,configs, target_confi
1383
1383
  getattr(object_stock, method_to_use)(**arguments_to_use, plot = False, save_features = False)
1384
1384
  if method_to_use not in ['minmax_pricefeature']:
1385
1385
  object_stock.produce_order_features(feature_name)
1386
+ last_signal_featlist = configs.get('custom_transformations',{}).get('compute_last_signal', False)
1387
+ if last_signal_featlist:
1388
+ last_signal_featlist = last_signal_featlist
1389
+ last_signal_featlist = last_signal_featlist.split('//')
1390
+ if feature_name in last_signal_featlist:
1391
+ object_stock.compute_last_signal(feature_name, False)
1386
1392
  # geting targets
1387
1393
  object_stock.get_categorical_targets(**target_params_up)
1388
1394
  object_stock.df = object_stock.df.drop(columns = ['target_down']).rename(columns = {'target_up':'target_up_save'})
@@ -173,6 +173,8 @@ class stock_eda_panel(object):
173
173
  perform additional asset ROC feature, then a new feature is created in the main dataframe
174
174
  produce_order_features(feature_name=str, save_features=boolean):
175
175
  perform a feature that captures high and low values in an index. this is usefull to know duration/persistence of a signal
176
+ compute_last_signal (feature_name=str, save_features=boolean):
177
+ perform a feature that captures high and low values in an index. this is usefull to know duration/persistence of a signal
176
178
  create_hmm_derived_features():
177
179
  create features derived from hmm states features. Features are the index of the state, the duration of the state, chain raturn
178
180
  cluster_hmm_analysis(n_clusters=int,features_hmm=list, test_data_size=int, seed=int, lag_returns_state=int, plot=boolean, save_features=boolean, model=obj):
@@ -1383,6 +1385,53 @@ class stock_eda_panel(object):
1383
1385
  self.signals.append(signal_feature_name)
1384
1386
  self.signals.append(order_feature_name)
1385
1387
 
1388
+ def compute_last_signal(self,feature, save_features = False):
1389
+ """
1390
+ perform two new features when signal is observed, one for the last duration of the previous chain, second for the last duration of the same sign signal
1391
+
1392
+ Parameters
1393
+ ----------
1394
+ feature_name (str): name of the feature
1395
+ save_features (boolean): True to save feature configuration and feature names
1396
+
1397
+ Returns
1398
+ -------
1399
+ None
1400
+ """
1401
+ def create_last_signal(df, feature, prefix, type ='0'):
1402
+ if type == '0':
1403
+ condition = df[f'order_signal_{feature}'] != 0
1404
+ elif type == '+':
1405
+ condition = df[f'order_signal_{feature}'] > 0
1406
+ elif type == '-':
1407
+ condition = df[f'order_signal_{feature}'] < 0
1408
+ df[f'last_maxorder_{feature}'] = np.where(condition, df[f'order_signal_{feature}'],np.nan)
1409
+ df['tmp_chain_index'] = df[f'last_maxorder_{feature}'].shift(-1)
1410
+ df['last'] = np.where((df[f'last_maxorder_{feature}'] != 0) & (df['tmp_chain_index'].isna()),df[f'last_maxorder_{feature}'], np.nan )
1411
+ df['last'] = df['last'].shift(1)
1412
+ df[f'last_maxorder_{feature}'] = df['last'].fillna(method = 'ffill')
1413
+ df = df.drop(columns = ['tmp_chain_index','last'])
1414
+ df[f'last_maxorder_{feature}'] = np.where(df[f'order_signal_{feature}'] != 0,df[f'last_maxorder_{feature}'],np.nan)
1415
+ df[f'last_maxorder_{feature}'] = df[f'last_maxorder_{feature}'].fillna(0)
1416
+ df = df.rename(columns = {f'last_maxorder_{feature}':f'{prefix}_{feature}'})
1417
+ return df
1418
+ prefix0, prefix1, prefix2 = 'ldur', 'pos', 'neg'
1419
+ self.df = create_last_signal(self.df, feature, prefix0, type ='0')
1420
+ self.df = create_last_signal(self.df, feature, prefix1, type ='+')
1421
+ self.df = create_last_signal(self.df, feature, prefix2, type ='-')
1422
+
1423
+ self.df[f'sldur_{feature}'] = np.where(
1424
+ self.df[f'order_signal_{feature}'] > 0, self.df[f'{prefix1}_{feature}'],
1425
+ np.where(
1426
+ self.df[f'order_signal_{feature}'] < 0, self.df[f'{prefix2}_{feature}'],
1427
+ 0
1428
+ )
1429
+ )
1430
+ self.df = self.df.drop(columns = [f'{prefix1}_{feature}',f'{prefix2}_{feature}'])
1431
+ if save_features:
1432
+ self.signals.append(f'sldur_{feature}')
1433
+ self.signals.append(f'ldur_{feature}')
1434
+
1386
1435
  def create_hmm_derived_features(self, lag_returns):
1387
1436
  """
1388
1437
  create features derived from hmm states features. Features are the index of the state, the duration of the state, chain raturn
@@ -1,36 +1,19 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: virgo-modules
3
- Version: 0.2.3
3
+ Version: 0.2.5
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
9
10
  Classifier: License :: OSI Approved :: MIT License
10
11
  Classifier: Programming Language :: Python :: 3.9
11
12
  Classifier: Operating System :: OS Independent
12
13
  Requires-Python: >=3.9, <3.10
13
14
  Description-Content-Type: text/markdown
14
- License-File: LICENSE
15
- Requires-Dist: feature-engine==1.6.1
16
- Requires-Dist: matplotlib==3.6.3
17
- Requires-Dist: mlflow==2.1.1
18
- Requires-Dist: numpy==1.23.5
19
- Requires-Dist: optuna==3.1.0
20
- Requires-Dist: pandas==1.5.3
21
- Requires-Dist: plotly==5.15.0
22
- Requires-Dist: rsa==4.9
23
- Requires-Dist: scikit-learn==1.2.1
24
- Requires-Dist: scipy==1.10.0
25
- Requires-Dist: seaborn==0.12.2
26
- Requires-Dist: starlette==0.22.0
27
- Requires-Dist: statsmodels==0.13.5
28
- Requires-Dist: ta==0.10.2
29
- Requires-Dist: yfinance==0.2.9
30
- Requires-Dist: hmmlearn==0.3.0
31
- Requires-Dist: boto3
32
15
  Provides-Extra: dev
33
- Requires-Dist: pytest>=7.0; extra == "dev"
16
+ License-File: LICENSE
34
17
 
35
18
  # Virgo Package
36
19
 
@@ -51,3 +34,4 @@ obj = stock_eda_panel(stock_code = 'PEP', n_days = 20)
51
34
  obj.get_data()
52
35
  print(obj.df.shape)
53
36
  ```
37
+
File without changes
File without changes
File without changes