virgo-modules 0.0.87__tar.gz → 0.0.88__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 (17) hide show
  1. {virgo_modules-0.0.87 → virgo_modules-0.0.88}/PKG-INFO +1 -1
  2. {virgo_modules-0.0.87 → virgo_modules-0.0.88}/setup.py +1 -1
  3. {virgo_modules-0.0.87 → virgo_modules-0.0.88}/virgo_app/virgo_modules/src/re_utils.py +5 -1
  4. {virgo_modules-0.0.87 → virgo_modules-0.0.88}/virgo_app/virgo_modules/src/ticketer_source.py +69 -1
  5. {virgo_modules-0.0.87 → virgo_modules-0.0.88}/virgo_app/virgo_modules.egg-info/PKG-INFO +1 -1
  6. {virgo_modules-0.0.87 → virgo_modules-0.0.88}/LICENSE +0 -0
  7. {virgo_modules-0.0.87 → virgo_modules-0.0.88}/README.md +0 -0
  8. {virgo_modules-0.0.87 → virgo_modules-0.0.88}/setup.cfg +0 -0
  9. {virgo_modules-0.0.87 → virgo_modules-0.0.88}/virgo_app/virgo_modules/__init__.py +0 -0
  10. {virgo_modules-0.0.87 → virgo_modules-0.0.88}/virgo_app/virgo_modules/src/__init__.py +0 -0
  11. {virgo_modules-0.0.87 → virgo_modules-0.0.88}/virgo_app/virgo_modules/src/aws_utils.py +0 -0
  12. {virgo_modules-0.0.87 → virgo_modules-0.0.88}/virgo_app/virgo_modules/src/edge_utils.py +0 -0
  13. {virgo_modules-0.0.87 → virgo_modules-0.0.88}/virgo_app/virgo_modules/src/pull_artifacts.py +0 -0
  14. {virgo_modules-0.0.87 → virgo_modules-0.0.88}/virgo_app/virgo_modules.egg-info/SOURCES.txt +0 -0
  15. {virgo_modules-0.0.87 → virgo_modules-0.0.88}/virgo_app/virgo_modules.egg-info/dependency_links.txt +0 -0
  16. {virgo_modules-0.0.87 → virgo_modules-0.0.88}/virgo_app/virgo_modules.egg-info/requires.txt +0 -0
  17. {virgo_modules-0.0.87 → virgo_modules-0.0.88}/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.0.87
3
+ Version: 0.0.88
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
@@ -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.0.87",
8
+ version="0.0.88",
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"),
@@ -700,7 +700,11 @@ def get_data(ticker_name:str, ticket_settings:dict, n_days:int = False, hmm_avai
700
700
  'stochastic_feature':'stochastic_feature',
701
701
  'william_feature':'william_feature',
702
702
  'vortex_feature':'vortex_feature',
703
- 'pair_index_feature':'pair_index_feature' # this has a diff structure!
703
+ 'pair_index_feature':'pair_index_feature', # this has a diff structure!
704
+ 'min_distance_pricefeature':'minmax_pricefeature',
705
+ 'min_relprice_pricefeature':'minmax_pricefeature',
706
+ 'max_distance_pricefeature':'minmax_pricefeature',
707
+ 'max_relprice_pricefeature':'minmax_pricefeature',
704
708
  }
705
709
  exceptions = ['pair_feature','pair_index_feature']
706
710
  ### standar feature
@@ -383,6 +383,8 @@ class stock_eda_panel(object):
383
383
  perfom fast stochastic oscilator or william indicator
384
384
  vortex_feature(window=int, threshold=float, plot=boolean, save_features=boolean):
385
385
  perform vortex oscilator
386
+ minmax_pricefeature(type_func=str, window=int, distance=bolean, save_features=boolean)
387
+ get relative price/ distance feature with respect to the min/max price in a given window
386
388
  pair_index_feature(pair_symbol=str, feature_label=str, window=int, threshold=float, plot=boolean, save_features=boolean):
387
389
  perform additional asset ROC feature, then a new feature is created in the main dataframe
388
390
  produce_order_features(feature_name=str, save_features=boolean):
@@ -1698,6 +1700,70 @@ class stock_eda_panel(object):
1698
1700
  if plot:
1699
1701
  self.signal_plotter(feature_name)
1700
1702
 
1703
+ def minmax_pricefeature(self, type_func, window, distance = False, save_features = False):
1704
+ """
1705
+ perform relative price/distance with respect to the min/max price in a given time scope
1706
+
1707
+ Parameters
1708
+ ----------
1709
+ type_func (str): either min or max
1710
+ window (int): window scope
1711
+ distance (boolean): if true, get distance feature else relative feature
1712
+ save_features (boolean): True to save feature configuration and feature names
1713
+
1714
+ Returns
1715
+ -------
1716
+ None
1717
+ """
1718
+ if type_func == 'min':
1719
+ self.df['Price_ref'] = self.df[['Open','High', 'Low','Close']].min(axis = 1)
1720
+ elif type_func == 'max':
1721
+ self.df['Price_ref'] = self.df[['Open','High', 'Low','Close']].max(axis = 1)
1722
+
1723
+ init_shape = self.df.shape[0]
1724
+ df_date = self.df[['Date','Price_ref']].rename(columns = {'Date':'Date_ref'}).copy()
1725
+
1726
+ self.df = self.df.rename(columns = {'Price_ref':'Price_to_use'})
1727
+
1728
+ if type_func == 'min':
1729
+ self.df[f'window_price'] = (self.df.sort_values("Date")["Price_to_use"].transform(lambda x: x.rolling(window, min_periods=1).min()))
1730
+ elif type_func == 'max':
1731
+ self.df[f'window_price'] = (self.df.sort_values("Date")["Price_to_use"].transform(lambda x: x.rolling(window, min_periods=1).max()))
1732
+
1733
+
1734
+ self.df = self.df.merge(df_date, left_on = 'window_price', right_on = 'Price_ref', how = 'left')
1735
+ self.df['date_span'] = self.df['Date'] - self.df['Date_ref']
1736
+
1737
+ self.df['RN'] = self.df.sort_values(['date_span'], ascending=False).groupby(['Date']).cumcount() + 1
1738
+ self.df = self.df[self.df['RN'] == 1]
1739
+
1740
+ if distance:
1741
+ self.df[f'{type_func}_distance_to_price'] = pd.to_numeric(self.df['date_span'].dt.days, downcast='integer')
1742
+
1743
+ if not distance:
1744
+ if type_func == 'min':
1745
+ self.df[f'{type_func}_relprice'] = self.df['Price_to_use']/self.df['window_price']-1
1746
+
1747
+ if type_func == 'max':
1748
+ self.df[f'{type_func}_relprice'] = self.df['window_price']/self.df['Price_to_use']-1
1749
+
1750
+ self.df = self.df.drop(columns = ['RN', 'date_span', 'Price_to_use', 'window_price', 'Date_ref','Price_ref'])
1751
+
1752
+ end_shape = self.df.shape[0]
1753
+
1754
+ if init_shape != end_shape:
1755
+ raise Exception("shapes are not the same")
1756
+
1757
+ if save_features:
1758
+ if distance:
1759
+ self.features.append(f'{type_func}_distance_to_price')
1760
+ name_attr = f'{type_func}_distance'
1761
+ if not distance:
1762
+ self.features.append(f'{type_func}_relprice')
1763
+ name_attr = f'{type_func}_relprice'
1764
+
1765
+ setattr(self,f'settings_{name_attr}_pricefeature' , {'type_func': type_func, 'window': window, 'distance': distance})
1766
+
1701
1767
  def pair_index_feature(self, pair_symbol, feature_label, window, threshold, plot = False, save_features = False):
1702
1768
  """
1703
1769
  perform additional asset ROC feature, then a new feature is created in the main dataframe
@@ -2297,7 +2363,9 @@ class stock_eda_panel(object):
2297
2363
  ## for now this is hard coded
2298
2364
  feature_list = ['spread_ma','relative_spread_ma','pair_feature','count_features','bidirect_count_features','price_range','relative_price_range','rsi_feature',
2299
2365
  'rsi_feature_v2', 'days_features','days_features_v2', 'volume_feature','smooth_volume', 'roc_feature', 'stoch_feature', 'stochastic_feature',
2300
- 'william_feature', 'vortex_feature', 'pair_index_feature','hmm']
2366
+ 'william_feature', 'vortex_feature', 'pair_index_feature','hmm',
2367
+ 'min_distance_pricefeature', 'min_relprice_pricefeature', 'max_distance_pricefeature','max_relprice_pricefeature'
2368
+ ]
2301
2369
 
2302
2370
  for feature in feature_list:
2303
2371
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: virgo-modules
3
- Version: 0.0.87
3
+ Version: 0.0.88
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
File without changes
File without changes
File without changes