bullishpy 0.46.0__py3-none-any.whl → 0.48.0__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 bullishpy might be problematic. Click here for more details.

@@ -496,6 +496,7 @@ class AnalysisView(BaseModel):
496
496
  yearly_growth: Optional[float] = None
497
497
  weekly_growth: Optional[float] = None
498
498
  monthly_growth: Optional[float] = None
499
+ upside: Optional[float] = None
499
500
 
500
501
 
501
502
  def json_loads(value: Any) -> Any:
@@ -525,6 +526,13 @@ class SubjectAnalysis(BaseModel):
525
526
  Optional[List[Dict[str, Any]]], BeforeValidator(json_loads)
526
527
  ] = None
527
528
  summary: Annotated[Optional[Dict[str, Any]], BeforeValidator(json_loads)] = None
529
+ upside: Optional[float] = None
530
+
531
+ def compute_upside(self, last_price: float) -> None:
532
+ if self.high_price_target is not None:
533
+ self.upside = (float(self.high_price_target) - float(last_price)) / float(
534
+ last_price
535
+ )
528
536
 
529
537
  def to_news(self) -> Optional[str]:
530
538
  if not self.news_summary:
@@ -556,6 +564,8 @@ class Analysis(SubjectAnalysis, AnalysisEarningsDate, AnalysisView, BaseEquity,
556
564
  technical_analysis = TechnicalAnalysis.from_data(prices.to_dataframe(), ticker)
557
565
  next_earnings_date = bearish_db.read_next_earnings_date(ticker.symbol)
558
566
  subject = bearish_db.read_subject(ticker.symbol)
567
+ if subject:
568
+ subject.compute_upside(technical_analysis.last_price)
559
569
 
560
570
  return cls.model_validate(
561
571
  equity.model_dump()
@@ -0,0 +1,35 @@
1
+ """
2
+
3
+ Revision ID: 4ee82b171449
4
+ Revises: ae444f338124
5
+ Create Date: 2025-08-10 12:16:03.791151
6
+
7
+ """
8
+
9
+ from typing import Sequence, Union
10
+
11
+ from alembic import op
12
+ import sqlalchemy as sa
13
+ from sqlalchemy.dialects import sqlite
14
+
15
+ # revision identifiers, used by Alembic.
16
+ revision: str = "4ee82b171449"
17
+ down_revision: Union[str, None] = "ae444f338124"
18
+ branch_labels: Union[str, Sequence[str], None] = None
19
+ depends_on: Union[str, Sequence[str], None] = None
20
+
21
+
22
+ def upgrade() -> None:
23
+ # ### commands auto generated by Alembic - please adjust! ###
24
+ with op.batch_alter_table("analysis", schema=None) as batch_op:
25
+ batch_op.add_column(sa.Column("upside", sa.Float(), nullable=True))
26
+ batch_op.create_index("ix_analysis_upside", ["upside"], unique=False)
27
+
28
+ # ### end Alembic commands ###
29
+
30
+
31
+ def downgrade() -> None:
32
+ # ### commands auto generated by Alembic - please adjust! ###
33
+ with op.batch_alter_table("analysis", schema=None) as batch_op:
34
+ batch_op.drop_index("ix_analysis_upside")
35
+ batch_op.drop_column("upside")
bullish/jobs/tasks.py CHANGED
@@ -1,8 +1,8 @@
1
1
  import functools
2
2
  import logging
3
- import random
4
3
  from typing import Optional, Any, Callable, List
5
4
 
5
+ import pandas as pd
6
6
  from bearish.main import Bearish # type: ignore
7
7
  from tickermood.main import get_news # type: ignore
8
8
  from tickermood.types import DatabaseConfig # type: ignore
@@ -15,7 +15,7 @@ from .models import JobTrackerStatus, JobTracker, JobType
15
15
  from ..analysis.analysis import run_analysis, run_signal_series_analysis
16
16
  from ..analysis.backtest import run_many_tests, BackTestConfig
17
17
  from ..analysis.industry_views import compute_industry_view
18
- from ..analysis.predefined_filters import predefined_filters
18
+ from ..analysis.predefined_filters import predefined_filters, load_custom_filters
19
19
  from ..database.crud import BullishDb
20
20
  from bullish.analysis.filter import FilterUpdate
21
21
  from ..utils.checks import DataBaseSingleTon
@@ -157,11 +157,11 @@ def news(
157
157
  def cron_news(
158
158
  task: Optional[Task] = None,
159
159
  ) -> None:
160
- filter = random.choice(predefined_filters()) # noqa: S311
160
+ filters = load_custom_filters()
161
161
  database = DataBaseSingleTon()
162
- if database.valid():
162
+ if database.valid() and filters:
163
163
  bullish_db = BullishDb(database_path=database.path)
164
- data = bullish_db.read_filter_query(filter)
164
+ data = pd.concat([bullish_db.read_filter_query(f) for f in filters])
165
165
  if not data.empty and "symbol" in data.columns:
166
166
  job_tracker(base_news)(
167
167
  database_path=database.path,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bullishpy
3
- Version: 0.46.0
3
+ Version: 0.48.0
4
4
  Summary:
5
5
  Author: aan
6
6
  Author-email: andoludovic.andriamamonjy@gmail.com
@@ -1,6 +1,6 @@
1
1
  bullish/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  bullish/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- bullish/analysis/analysis.py,sha256=8FMEaDlgFERrgRPYq5zqIRgoeBvJVh3C91Zxl8eD7HU,23788
3
+ bullish/analysis/analysis.py,sha256=cEINJjuBqwm-wp5YrRbMiVAMv0k9JBjCjlbrjq_RQzM,24177
4
4
  bullish/analysis/backtest.py,sha256=x91ek5kOzJHvYq0TmJh1Q8wBDDduIaieE0zDaoZFXew,14325
5
5
  bullish/analysis/constants.py,sha256=X3oCyYNA6B-jsZSYJLeGQ94S453Z7jIVNPmv3lMPp8Q,9922
6
6
  bullish/analysis/filter.py,sha256=LKmsO3ei7Eo_SJsEVbZqETyIdOpW55xVheO6_GNoA0s,9286
@@ -24,6 +24,7 @@ bullish/database/alembic/versions/12889a2cbd7d_.py,sha256=LT_-dM-UstatA1xloCAQnv
24
24
  bullish/database/alembic/versions/17e51420e7ad_.py,sha256=xeiVIm1YUZb08opE9rocHZP1__9WQWXsKsXgeFV9cvs,2960
25
25
  bullish/database/alembic/versions/49c83f9eb5ac_.py,sha256=kCBItp7KmqpJ03roy5ikQjhefZia1oKgfZwournQDq8,3890
26
26
  bullish/database/alembic/versions/4b0a2f40b7d3_.py,sha256=G0K7w7pOPYjPZkXTB8LWhxoxuWBPcPwOfnubTBtdeEY,1827
27
+ bullish/database/alembic/versions/4ee82b171449_.py,sha256=QtPy5VyZPyZxS7MVkk_wGi3C44PVDoHyJ-9m9fWdqqc,1047
27
28
  bullish/database/alembic/versions/5b10ee7604c1_.py,sha256=YlqaagPasR3RKASv7acME1jPS8p26VoTE2BvpOwdCpY,1463
28
29
  bullish/database/alembic/versions/6d252e23f543_.py,sha256=izF-ejdXk733INkAokGqjA2U_M0_c1f_ruihZ-cgP7s,1525
29
30
  bullish/database/alembic/versions/73564b60fe24_.py,sha256=MTlDRDNHj3E9gK7IMeAzv2UxxxYtWiu3gI_9xTLE-wg,1008
@@ -51,10 +52,10 @@ bullish/interface/interface.py,sha256=R2qVEMyBl9mBlPUO40zXp4vhfLKH7pgl_u2BmAVlD4
51
52
  bullish/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
53
  bullish/jobs/app.py,sha256=5MJ5KXUo7JSNAvOPgkpIMasD11VTrjQvGzM7vmCY65E,77
53
54
  bullish/jobs/models.py,sha256=S2yvBf69lmt4U-5OU5CjXCMSw0s9Ubh9xkrB3k2qOZo,764
54
- bullish/jobs/tasks.py,sha256=XO8Pa6MoYeJQ4uvD3OYStEOh7l5zTK7hUFKvZksvpOM,5346
55
+ bullish/jobs/tasks.py,sha256=HN3AD-WW84XSa8MHyYO3yD_YkWjbRb62Y78EArhSVIU,5383
55
56
  bullish/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
57
  bullish/utils/checks.py,sha256=jolHOnxkc5GvVuvVzlwHhM6EO-Y-eC0q3rXlHE-UG9Y,2633
57
- bullishpy-0.46.0.dist-info/METADATA,sha256=Q_g58-6l-nKyulwuC8HfMF-fS6VN5_kZY1MM8me7nSU,830
58
- bullishpy-0.46.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
59
- bullishpy-0.46.0.dist-info/entry_points.txt,sha256=eaPpmL6vmSBFo0FBtwibCXGqAW4LFJ83whJzT1VjD-0,43
60
- bullishpy-0.46.0.dist-info/RECORD,,
58
+ bullishpy-0.48.0.dist-info/METADATA,sha256=FIJqBRIkHwxnkoHMwp8b87NATTefEBZxLkBE8_OAVso,830
59
+ bullishpy-0.48.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
60
+ bullishpy-0.48.0.dist-info/entry_points.txt,sha256=eaPpmL6vmSBFo0FBtwibCXGqAW4LFJ83whJzT1VjD-0,43
61
+ bullishpy-0.48.0.dist-info/RECORD,,