sovai 0.2.26__tar.gz → 0.2.28__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.
Files changed (95) hide show
  1. {sovai-0.2.26 → sovai-0.2.28}/PKG-INFO +4 -1
  2. {sovai-0.2.26 → sovai-0.2.28}/pyproject.toml +18 -3
  3. {sovai-0.2.26 → sovai-0.2.28}/sovai/__init__.py +5 -3
  4. {sovai-0.2.26 → sovai-0.2.28}/sovai/get_data.py +17 -3
  5. {sovai-0.2.26 → sovai-0.2.28}/sovai/get_tools.py +5 -0
  6. sovai-0.2.28/sovai/tools/authentication/authentication.py +98 -0
  7. sovai-0.2.28/sovai/tools/sec/graphs.py +1490 -0
  8. sovai-0.2.28/sovai/utils/__init__.py +0 -0
  9. sovai-0.2.28/sovai/utils/client_side_s3.py +212 -0
  10. {sovai-0.2.26 → sovai-0.2.28}/LICENSE +0 -0
  11. {sovai-0.2.26 → sovai-0.2.28}/README.md +0 -0
  12. {sovai-0.2.26 → sovai-0.2.28}/sovai/api_config.py +0 -0
  13. {sovai-0.2.26 → sovai-0.2.28}/sovai/assets/dropdown.css +0 -0
  14. {sovai-0.2.26 → sovai-0.2.28}/sovai/assets/features_mapping.parq +0 -0
  15. {sovai-0.2.26 → sovai-0.2.28}/sovai/basic_auth.py +0 -0
  16. {sovai-0.2.26 → sovai-0.2.28}/sovai/computations/__init__.py +0 -0
  17. {sovai-0.2.26 → sovai-0.2.28}/sovai/computations/functions.py +0 -0
  18. {sovai-0.2.26 → sovai-0.2.28}/sovai/errors/__init__.py +0 -0
  19. {sovai-0.2.26 → sovai-0.2.28}/sovai/errors/sovai_errors.py +0 -0
  20. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/__init__.py +0 -0
  21. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/anomalies.py +0 -0
  22. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/ask_df_llm.py +0 -0
  23. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/change_point_generator.py +0 -0
  24. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/clustering.py +0 -0
  25. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/core_kshape.py +0 -0
  26. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/cum_sum_torch.py +0 -0
  27. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/cusum.py +0 -0
  28. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/dimensionality_reduction.py +0 -0
  29. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/feature_extraction.py +0 -0
  30. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/feature_importance.py +0 -0
  31. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/feature_neutralizer.py +0 -0
  32. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/filter_df.py +0 -0
  33. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/fractional_differencing.py +0 -0
  34. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/nowcasting.py +0 -0
  35. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/pairwise.py +0 -0
  36. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/pandas_extensions.py +0 -0
  37. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/parallel_functions.py +0 -0
  38. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/pfa_feature_selector.py +0 -0
  39. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/regime_change.py +0 -0
  40. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/regime_change_pca.py +0 -0
  41. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/shapley_global_importance.py +0 -0
  42. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/shapley_importance.py +0 -0
  43. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/signal_evaluation.py +0 -0
  44. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/technical_indicators.py +0 -0
  45. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/time_decomposition.py +0 -0
  46. {sovai-0.2.26 → sovai-0.2.28}/sovai/extensions/weight_optimization.py +0 -0
  47. {sovai-0.2.26 → sovai-0.2.28}/sovai/get_compute.py +0 -0
  48. {sovai-0.2.26 → sovai-0.2.28}/sovai/get_plots.py +0 -0
  49. {sovai-0.2.26 → sovai-0.2.28}/sovai/get_reports.py +0 -0
  50. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/__init__.py +0 -0
  51. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/accounting/__init__.py +0 -0
  52. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/accounting/accounting_plots.py +0 -0
  53. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/allocation/__init__.py +0 -0
  54. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/allocation/allocation_plots.py +0 -0
  55. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/bankruptcy/__init__.py +0 -0
  56. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/bankruptcy/bankruptcy_plots.py +0 -0
  57. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/breakout/__init__.py +0 -0
  58. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/breakout/breakout_plots.py +0 -0
  59. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/corp_risk/__init__.py +0 -0
  60. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/corp_risk/corp_risk_plots.py +0 -0
  61. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/earnings_surprise/__init__.py +0 -0
  62. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/earnings_surprise/earnings_surprise_plots.py +0 -0
  63. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/insider/__init__.py +0 -0
  64. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/insider/insider_plots.py +0 -0
  65. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/institutional/__init__.py +0 -0
  66. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/institutional/institutional_plots.py +0 -0
  67. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/news/__init__.py +0 -0
  68. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/news/news_plots.py +0 -0
  69. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/ratios/__init__.py +0 -0
  70. {sovai-0.2.26 → sovai-0.2.28}/sovai/plots/ratios/ratios_plots.py +0 -0
  71. {sovai-0.2.26 → sovai-0.2.28}/sovai/reports/accounting/__inti__.py +0 -0
  72. {sovai-0.2.26 → sovai-0.2.28}/sovai/reports/accounting/accounting_balance_sheet.py +0 -0
  73. {sovai-0.2.26 → sovai-0.2.28}/sovai/reports/bankruptcy/__inti__.py +0 -0
  74. {sovai-0.2.26 → sovai-0.2.28}/sovai/reports/bankruptcy/bankruptcy_monthly_top.py +0 -0
  75. {sovai-0.2.26 → sovai-0.2.28}/sovai/reports/general/__inti__.py +0 -0
  76. {sovai-0.2.26 → sovai-0.2.28}/sovai/reports/general/general_plots.py +0 -0
  77. {sovai-0.2.26 → sovai-0.2.28}/sovai/reports/news/__inti__.py +0 -0
  78. {sovai-0.2.26 → sovai-0.2.28}/sovai/reports/news/news_econometric_analysis.py +0 -0
  79. {sovai-0.2.26 → sovai-0.2.28}/sovai/studies/nowcasting.py +0 -0
  80. {sovai-0.2.26 → sovai-0.2.28}/sovai/token_auth.py +0 -0
  81. {sovai-0.2.26/sovai/tools/sec → sovai-0.2.28/sovai/tools/authentication}/__inti__.py +0 -0
  82. /sovai-0.2.26/sovai/utils/__init__.py → /sovai-0.2.28/sovai/tools/sec/__inti__.py +0 -0
  83. {sovai-0.2.26 → sovai-0.2.28}/sovai/tools/sec/llm_code_generator.py +0 -0
  84. {sovai-0.2.26 → sovai-0.2.28}/sovai/tools/sec/sec_10_k_8_k_filings.py +0 -0
  85. {sovai-0.2.26 → sovai-0.2.28}/sovai/tools/sec/sec_edgar_search.py +0 -0
  86. {sovai-0.2.26 → sovai-0.2.28}/sovai/utils/client_side.py +0 -0
  87. {sovai-0.2.26 → sovai-0.2.28}/sovai/utils/converter.py +0 -0
  88. {sovai-0.2.26 → sovai-0.2.28}/sovai/utils/datetime_formats.py +0 -0
  89. {sovai-0.2.26 → sovai-0.2.28}/sovai/utils/file_management.py +0 -0
  90. {sovai-0.2.26 → sovai-0.2.28}/sovai/utils/get_tickers.py +0 -0
  91. {sovai-0.2.26 → sovai-0.2.28}/sovai/utils/helpers.py +0 -0
  92. {sovai-0.2.26 → sovai-0.2.28}/sovai/utils/pandas_extensions copy.py +0 -0
  93. {sovai-0.2.26 → sovai-0.2.28}/sovai/utils/plot.py +0 -0
  94. {sovai-0.2.26 → sovai-0.2.28}/sovai/utils/port_manager.py +0 -0
  95. {sovai-0.2.26 → sovai-0.2.28}/sovai/utils/stream.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sovai
3
- Version: 0.2.26
3
+ Version: 0.2.28
4
4
  Summary: python for asset management
5
5
  License: Proprietary License
6
6
  Author: Derek Snow
@@ -22,6 +22,7 @@ Requires-Dist: joblib (>=1.0)
22
22
  Requires-Dist: lightgbm (>=4.5.0) ; extra == "full"
23
23
  Requires-Dist: matplotlib (>=3.0) ; extra == "full"
24
24
  Requires-Dist: mfles (>=0.2) ; extra == "full"
25
+ Requires-Dist: networkx (>=3.3,<4.0)
25
26
  Requires-Dist: numba (>=0.50) ; extra == "full"
26
27
  Requires-Dist: numpy (>=1.20)
27
28
  Requires-Dist: openai (>=1.0) ; extra == "full"
@@ -33,6 +34,7 @@ Requires-Dist: polars-talib (==0.1.3) ; extra == "full"
33
34
  Requires-Dist: pyarrow (>=5.0)
34
35
  Requires-Dist: python-dateutil (>=2.8)
35
36
  Requires-Dist: python-dotenv (>=0.10)
37
+ Requires-Dist: pyvis (>=0.3.2,<0.4.0)
36
38
  Requires-Dist: rapidfuzz (>=3.9.7,<4.0.0)
37
39
  Requires-Dist: requests (>=2.20)
38
40
  Requires-Dist: ruptures (>=1.0) ; extra == "full"
@@ -42,6 +44,7 @@ Requires-Dist: shap (>=0.40) ; extra == "full"
42
44
  Requires-Dist: skfolio (>=0.3) ; extra == "full"
43
45
  Requires-Dist: statsforecast (>=1.0) ; extra == "full"
44
46
  Requires-Dist: tensorly (>=0.6) ; extra == "full"
47
+ Requires-Dist: yachalk (>=0.1.6,<0.2.0)
45
48
  Description-Content-Type: text/markdown
46
49
 
47
50
  [![Sovai Python SDK package](https://github.com/sovai-research/SovAI/actions/workflows/main.yml/badge.svg)](https://github.com/sovai-research/SovAI/actions/workflows/main.yml)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "sovai"
3
- version = "0.2.26"
3
+ version = "0.2.28"
4
4
  description = "python for asset management"
5
5
  authors = ["Derek Snow <d.snow@outlook.com>"]
6
6
  license = "Proprietary License"
@@ -40,6 +40,8 @@ python-dotenv = ">=0.10"
40
40
  polars = ">=0.20.30"
41
41
  boto3 = ">=1.20"
42
42
  joblib = ">=1.0"
43
+ rapidfuzz = "^3.9.7"
44
+ edgar-tool = "^1.3.3"
43
45
  scipy = {version = ">=1.0", optional = true}
44
46
  matplotlib = {version = ">=3.0", optional = true}
45
47
  plotly = {version = ">=5.0", optional = true}
@@ -59,8 +61,10 @@ lightgbm = {version = ">=4.5.0", optional = true}
59
61
  ipywidgets = {version = ">=8.1.3", optional = true}
60
62
  polars-talib = {version = "0.1.3", optional = true}
61
63
  dash-bootstrap-components = {version = ">=1.6.0", optional = true}
62
- rapidfuzz = "^3.9.7"
63
- edgar-tool = "^1.3.3"
64
+ yachalk = "^0.1.6"
65
+ pyvis = "^0.3.2"
66
+ networkx = "^3.3"
67
+
64
68
 
65
69
  [tool.poetry.extras]
66
70
  full = [
@@ -85,6 +89,17 @@ full = [
85
89
  "dash-bootstrap-components"
86
90
  ]
87
91
 
92
+ [tool.poetry.group.dev]
93
+ optional = true
94
+
95
+ [tool.poetry.group.dev.dependencies]
96
+ jinja2 = "^3.1.4"
97
+ traitlets = "^5.14.3"
98
+ jupyterlab = "^4.2.5"
99
+ pytest = "^7.0"
100
+ black = "^22.0"
101
+
102
+
88
103
  [build-system]
89
104
  requires = ["poetry-core"]
90
105
  build-backend = "poetry.core.masonry.api"
@@ -6,8 +6,10 @@ from .get_data import data
6
6
  from .basic_auth import basic_auth
7
7
  from .token_auth import token_auth
8
8
  from .utils.file_management import save_or_update_tickers, save_or_update_codes
9
+
10
+
9
11
  import warnings
10
- warnings.filterwarnings("ignore", category=FutureWarning)
12
+ warnings.filterwarnings("ignore")
11
13
 
12
14
 
13
15
  __version__ = "0.1.25"
@@ -23,7 +25,7 @@ try:
23
25
  from .get_compute import compute
24
26
  from .studies.nowcasting import nowcast
25
27
  from .extensions.pandas_extensions import CustomDataFrame as extension
26
- from .get_tools import sec_search, sec_filing, code
28
+ from .get_tools import sec_search, sec_filing, code, sec_graph
27
29
  HAS_FULL_INSTALL = True
28
30
  except ImportError:
29
31
  HAS_FULL_INSTALL = False
@@ -31,4 +33,4 @@ except ImportError:
31
33
  __all__ = ['read_key', 'save_key', 'ApiConfig', 'data', 'basic_auth', 'token_auth']
32
34
 
33
35
  if HAS_FULL_INSTALL:
34
- __all__ += ['plot', 'report', 'compute', 'nowcast', 'extension', 'sec_search', 'sec_filing', 'code']
36
+ __all__ += ['plot', 'report', 'compute', 'nowcast', 'extension', 'sec_search', 'sec_filing', 'code', 'sec_graph']
@@ -21,6 +21,7 @@ from sovai.utils.converter import convert_data2df
21
21
  from sovai.utils.stream import stream_data, stream_data_pyarrow
22
22
  from sovai.utils.datetime_formats import datetime_format
23
23
  from sovai.utils.client_side import client_side_frame
24
+ from sovai.utils.client_side_s3 import load_frame_s3
24
25
 
25
26
  ## Note run these for TEST - IT COULD BE HERE some silent problems
26
27
  try:
@@ -281,7 +282,7 @@ def normalize_endpoint(endpoint):
281
282
  return endpoint.strip("/").strip()
282
283
 
283
284
 
284
- client_side_endpoints = {
285
+ client_side_endpoints_gcs = {
285
286
  "ratios/relative",
286
287
  "market/prices",
287
288
  "market/closeadj",
@@ -291,6 +292,10 @@ client_side_endpoints = {
291
292
  "lobbying/public",
292
293
  }
293
294
 
295
+ client_side_endpoints_s3 = {
296
+ "sec/10k"
297
+ }
298
+
294
299
  # In your main function or wherever this logic is implemented:
295
300
 
296
301
 
@@ -577,16 +582,25 @@ def data(
577
582
  normalized_endpoint = normalize_endpoint(endpoint)
578
583
 
579
584
  if (
580
- normalized_endpoint in client_side_endpoints
585
+ normalized_endpoint in client_side_endpoints_gcs
581
586
  and tickers is not None
582
587
  and frequency is None
583
588
  ):
584
- verbose_mode.vprint("Grabbing client side")
589
+ verbose_mode.vprint("Grabbing gcs client side")
585
590
  _query_cache[cache_key] = client_side_frame(
586
591
  normalized_endpoint, tickers, columns, start_date, end_date
587
592
  )
588
593
  return _query_cache[cache_key]
589
594
 
595
+ elif (
596
+ normalized_endpoint in client_side_endpoints_s3
597
+ # and tickers is not None
598
+ and frequency is None
599
+ ):
600
+ verbose_mode.vprint("Grabbing s3 client side")
601
+ _query_cache[cache_key] = load_frame_s3(
602
+ normalized_endpoint, tickers, columns, start_date, end_date)
603
+ return _query_cache[cache_key]
590
604
  try:
591
605
  if tickers is not None and not is_all(tickers):
592
606
  params = ticker_mapper(params,verbose)
@@ -4,6 +4,8 @@ from .tools.sec.sec_10_k_8_k_filings import large_filing_module
4
4
 
5
5
  from .tools.sec.llm_code_generator import generate_sovai_code
6
6
 
7
+ from .tools.sec.graphs import analyze_10k_graph
8
+
7
9
 
8
10
 
9
11
  def sec_search(search="CFO Resgination"):
@@ -25,3 +27,6 @@ def code(prompt="get bankruptcy data for Tesla", verbose=False, run=False):
25
27
 
26
28
 
27
29
 
30
+ def sec_graph(ticker="AAPL", date_input="2024-Q3", verbose=False, ontology_type="causal", oai_model="gpt-4o-mini", batch=True, batch_size=10, sentiment_filter=None, output_dir="./docs", use_cache=True):
31
+
32
+ return analyze_10k_graph(ticker, date_input, section_select=True, ontology_type=ontology_type, oai_model=oai_model, batch=batch, batch_size=batch_size, sentiment_filter=sentiment_filter, output_dir=output_dir, use_cache=use_cache, verbose=verbose)
@@ -0,0 +1,98 @@
1
+ import sovai as sov
2
+ from sovai.api_config import ApiConfig
3
+ import requests
4
+ import pickle
5
+ import base64
6
+ from pyarrow.fs import S3FileSystem
7
+
8
+ def get_s3_filesystem_pickle(storage_provider: str, verbose: bool = False):
9
+ """
10
+ Retrieve the S3FileSystem for the specified storage provider using pickle.
11
+
12
+ :param storage_provider: Either 'wasabi' or 'digitalocean'
13
+ :param verbose: If True, print additional information about the request
14
+ :return: S3FileSystem object, or None if the request fails
15
+ """
16
+ if storage_provider.lower() not in ['wasabi', 'digitalocean']:
17
+ raise ValueError("storage_provider must be either 'wasabi' or 'digitalocean'")
18
+
19
+ url = f"{ApiConfig.base_url}/credentials/get_s3_filesystem_pickle"
20
+ headers = {
21
+ "Authorization": f"Bearer {ApiConfig.token}",
22
+ "Content-Type": "application/json"
23
+ }
24
+ params = {"storage_provider": storage_provider.lower()}
25
+
26
+ try:
27
+ response = requests.get(url, headers=headers, params=params)
28
+ response.raise_for_status()
29
+
30
+ encoded = response.content
31
+ pickled = base64.b64decode(encoded)
32
+ s3fs = pickle.loads(pickled)
33
+
34
+ return s3fs
35
+
36
+ except requests.RequestException as e:
37
+ if verbose:
38
+ print(f"Failed to retrieve S3FileSystem for {storage_provider}: {e}")
39
+ return None
40
+
41
+ def get_s3_filesystem_json(storage_provider: str, verbose: bool = False):
42
+ """
43
+ Retrieve the S3FileSystem for the specified storage provider using JSON.
44
+
45
+ :param storage_provider: Either 'wasabi' or 'digitalocean'
46
+ :param verbose: If True, print additional information about the request
47
+ :return: S3FileSystem object, or None if the request fails
48
+ """
49
+ if storage_provider.lower() not in ['wasabi', 'digitalocean']:
50
+ raise ValueError("storage_provider must be either 'wasabi' or 'digitalocean'")
51
+
52
+ url = f"{ApiConfig.base_url}/credentials/get_s3_filesystem_json"
53
+ headers = {
54
+ "Authorization": f"Bearer {ApiConfig.token}",
55
+ "Content-Type": "application/json"
56
+ }
57
+ params = {"storage_provider": storage_provider.lower()}
58
+
59
+ try:
60
+ response = requests.get(url, headers=headers, params=params)
61
+ response.raise_for_status()
62
+
63
+ cred = response.json()
64
+
65
+ if verbose:
66
+ print(f"Successfully retrieved S3 credentials for {storage_provider}")
67
+
68
+ s3fs = S3FileSystem(
69
+ access_key=cred['access_key'],
70
+ secret_key=cred['secret_key'],
71
+ endpoint_override=cred['endpoint']
72
+ )
73
+
74
+ try:
75
+ s3fs.ls('/')
76
+ if verbose:
77
+ print(f"Successfully verified S3FileSystem for {storage_provider}")
78
+ return s3fs
79
+ except Exception as e:
80
+ if verbose:
81
+ print(f"Failed to verify S3FileSystem: {str(e)}")
82
+ return None
83
+
84
+ except requests.RequestException as e:
85
+ if verbose:
86
+ print(f"Failed to retrieve S3 credentials for {storage_provider}: {e}")
87
+ return None
88
+
89
+ # Usage example:
90
+ # s3fs = get_s3_filesystem_pickle('wasabi', verbose=True)
91
+ # or
92
+ # s3fs = get_s3_filesystem_json('wasabi', verbose=True)
93
+ # if s3fs:
94
+ # # Use s3fs in your operations
95
+ # files = s3fs.ls('/')
96
+ # print(files)
97
+ # else:
98
+ # print("Failed to get S3FileSystem")