bullishpy 0.42.0__tar.gz → 0.44.0__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 bullishpy might be problematic. Click here for more details.
- {bullishpy-0.42.0 → bullishpy-0.44.0}/PKG-INFO +1 -1
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/app/app.py +2 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/jobs/tasks.py +62 -8
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/utils/checks.py +14 -1
- {bullishpy-0.42.0 → bullishpy-0.44.0}/pyproject.toml +1 -1
- {bullishpy-0.42.0 → bullishpy-0.44.0}/README.md +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/__init__.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/analysis/__init__.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/analysis/analysis.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/analysis/backtest.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/analysis/constants.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/analysis/filter.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/analysis/functions.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/analysis/indicators.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/analysis/industry_views.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/analysis/predefined_filters.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/app/__init__.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/cli.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/__init__.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/README +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/alembic.ini +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/env.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/script.py.mako +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/037dbd721317_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/040b15fba458_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/08ac1116e055_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/11d35a452b40_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/12889a2cbd7d_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/17e51420e7ad_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/49c83f9eb5ac_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/4b0a2f40b7d3_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/5b10ee7604c1_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/6d252e23f543_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/73564b60fe24_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/79bc71ec6f9e_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/ae444f338124_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/b76079e9845f_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/bf6b86dd5463_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/d0e58e050845_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/d663166c531d_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/ec25c8fa449f_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/ee5baabb35f8_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/fc191121f522_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/alembic/versions/ff0cc4ba40ec_.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/crud.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/schemas.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/scripts/create_revision.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/scripts/stamp.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/scripts/upgrade.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/database/settings.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/exceptions.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/figures/__init__.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/figures/figures.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/interface/__init__.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/interface/interface.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/jobs/__init__.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/jobs/app.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/jobs/models.py +0 -0
- {bullishpy-0.42.0 → bullishpy-0.44.0}/bullish/utils/__init__.py +0 -0
|
@@ -34,6 +34,7 @@ from bullish.utils.checks import (
|
|
|
34
34
|
compatible_bearish_database,
|
|
35
35
|
compatible_bullish_database,
|
|
36
36
|
empty_analysis_table,
|
|
37
|
+
DataBaseSingleTon,
|
|
37
38
|
)
|
|
38
39
|
|
|
39
40
|
CACHE_SHELVE = "user_cache"
|
|
@@ -420,6 +421,7 @@ def main() -> None:
|
|
|
420
421
|
if st.session_state.database_path is None:
|
|
421
422
|
dialog_pick_database()
|
|
422
423
|
bearish_db_ = bearish_db(st.session_state.database_path)
|
|
424
|
+
DataBaseSingleTon(path=st.session_state.database_path)
|
|
423
425
|
charts_tab, jobs_tab = st.tabs(["Charts", "Jobs"])
|
|
424
426
|
if "data" not in st.session_state:
|
|
425
427
|
st.session_state.data = load_analysis_data(bearish_db_)
|
|
@@ -8,15 +8,16 @@ from tickermood.types import DatabaseConfig # type: ignore
|
|
|
8
8
|
|
|
9
9
|
from .app import huey
|
|
10
10
|
from pathlib import Path
|
|
11
|
-
from huey.api import Task # type: ignore
|
|
11
|
+
from huey.api import Task, crontab # type: ignore
|
|
12
12
|
|
|
13
13
|
from .models import JobTrackerStatus, JobTracker, JobType
|
|
14
14
|
from ..analysis.analysis import run_analysis, run_signal_series_analysis
|
|
15
15
|
from ..analysis.backtest import run_many_tests, BackTestConfig
|
|
16
16
|
from ..analysis.industry_views import compute_industry_view
|
|
17
|
-
from ..analysis.predefined_filters import predefined_filters
|
|
17
|
+
from ..analysis.predefined_filters import predefined_filters, NEXT_EARNINGS_DATE
|
|
18
18
|
from ..database.crud import BullishDb
|
|
19
19
|
from bullish.analysis.filter import FilterUpdate
|
|
20
|
+
from ..utils.checks import DataBaseSingleTon
|
|
20
21
|
|
|
21
22
|
logger = logging.getLogger(__name__)
|
|
22
23
|
|
|
@@ -52,9 +53,7 @@ def job_tracker(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
|
52
53
|
return wrapper
|
|
53
54
|
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
@job_tracker
|
|
57
|
-
def update(
|
|
56
|
+
def _base_update(
|
|
58
57
|
database_path: Path,
|
|
59
58
|
job_type: JobType,
|
|
60
59
|
symbols: Optional[List[str]],
|
|
@@ -75,6 +74,28 @@ def update(
|
|
|
75
74
|
compute_industry_view(bullish_db)
|
|
76
75
|
|
|
77
76
|
|
|
77
|
+
@huey.task(context=True) # type: ignore
|
|
78
|
+
@job_tracker
|
|
79
|
+
def update(
|
|
80
|
+
database_path: Path,
|
|
81
|
+
job_type: JobType,
|
|
82
|
+
symbols: Optional[List[str]],
|
|
83
|
+
update_query: FilterUpdate,
|
|
84
|
+
task: Optional[Task] = None,
|
|
85
|
+
) -> None:
|
|
86
|
+
_base_update(database_path, job_type, symbols, update_query, task)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@huey.periodic_task(crontab(minute="0", hour="1"), context=True) # type: ignore
|
|
90
|
+
def cron_update(
|
|
91
|
+
task: Optional[Task] = None,
|
|
92
|
+
) -> None:
|
|
93
|
+
database = DataBaseSingleTon()
|
|
94
|
+
job_tracker(_base_update)(
|
|
95
|
+
database.path, "Update data", [], FilterUpdate(), task=task
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
|
|
78
99
|
@huey.task(context=True) # type: ignore
|
|
79
100
|
@job_tracker
|
|
80
101
|
def analysis(
|
|
@@ -99,9 +120,7 @@ def backtest_signals(
|
|
|
99
120
|
run_many_tests(bullish_db, predefined_filters(), BackTestConfig())
|
|
100
121
|
|
|
101
122
|
|
|
102
|
-
|
|
103
|
-
@job_tracker
|
|
104
|
-
def news(
|
|
123
|
+
def base_news(
|
|
105
124
|
database_path: Path,
|
|
106
125
|
job_type: JobType,
|
|
107
126
|
symbols: List[str],
|
|
@@ -112,3 +131,38 @@ def news(
|
|
|
112
131
|
database_config = DatabaseConfig(database_path=database_path, no_migration=True)
|
|
113
132
|
get_news(symbols, database_config, headless=headless, model_name="qwen3:4b")
|
|
114
133
|
run_analysis(bullish_db)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
@huey.task(context=True) # type: ignore
|
|
137
|
+
@job_tracker
|
|
138
|
+
def news(
|
|
139
|
+
database_path: Path,
|
|
140
|
+
job_type: JobType,
|
|
141
|
+
symbols: List[str],
|
|
142
|
+
headless: bool = True,
|
|
143
|
+
task: Optional[Task] = None,
|
|
144
|
+
) -> None:
|
|
145
|
+
base_news(
|
|
146
|
+
database_path=database_path,
|
|
147
|
+
job_type=job_type,
|
|
148
|
+
symbols=symbols,
|
|
149
|
+
headless=headless,
|
|
150
|
+
task=task,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
@huey.periodic_task(crontab(minute="0", hour="3"), context=True) # type: ignore
|
|
155
|
+
def cron_news(
|
|
156
|
+
task: Optional[Task] = None,
|
|
157
|
+
) -> None:
|
|
158
|
+
earnings_date = NEXT_EARNINGS_DATE[1]
|
|
159
|
+
database = DataBaseSingleTon()
|
|
160
|
+
bullish_db = BullishDb(database_path=database.path)
|
|
161
|
+
data = bullish_db.read_filter_query(earnings_date)
|
|
162
|
+
job_tracker(base_news)(
|
|
163
|
+
database_path=database.path,
|
|
164
|
+
job_type="Fetching news",
|
|
165
|
+
symbols=data["symbol"].unique().tolist(),
|
|
166
|
+
headless=False,
|
|
167
|
+
task=task,
|
|
168
|
+
)
|
|
@@ -2,7 +2,7 @@ import sqlite3
|
|
|
2
2
|
from contextlib import contextmanager
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
from sqlite3 import Connection
|
|
5
|
-
from typing import List, Generator
|
|
5
|
+
from typing import List, Generator, Optional, Any
|
|
6
6
|
|
|
7
7
|
from bearish.database.schemas import * # type: ignore # noqa: F403
|
|
8
8
|
from bullish.database.schemas import * # noqa: F403
|
|
@@ -64,3 +64,16 @@ def compatible_bearish_database(database_path: Path) -> bool:
|
|
|
64
64
|
|
|
65
65
|
def compatible_bullish_database(database_path: Path) -> bool:
|
|
66
66
|
return _compatible_table(database_path, "bullish.database.schemas")
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class DataBaseSingleTon:
|
|
70
|
+
_instance = None
|
|
71
|
+
|
|
72
|
+
def __new__(cls, *args: Any, **kwargs: Any) -> Any:
|
|
73
|
+
if cls._instance is None:
|
|
74
|
+
cls._instance = super().__new__(cls)
|
|
75
|
+
return cls._instance
|
|
76
|
+
|
|
77
|
+
def __init__(self, path: Optional[Path] = None) -> None:
|
|
78
|
+
if not hasattr(self, "path"): # Only set once
|
|
79
|
+
self.path = path
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|