bullishpy 0.9.0__py3-none-any.whl → 0.11.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.
- bullish/analysis/analysis.py +23 -4
- bullish/analysis/filter.py +26 -1
- bullish/analysis/functions.py +46 -3
- bullish/analysis/indicators.py +89 -44
- bullish/analysis/predefined_filters.py +225 -41
- bullish/app/app.py +35 -16
- bullish/cli.py +3 -0
- bullish/database/alembic/versions/17e51420e7ad_.py +85 -0
- bullish/database/alembic/versions/d663166c531d_.py +56 -0
- bullish/database/crud.py +28 -1
- bullish/figures/figures.py +17 -4
- bullish/interface/interface.py +7 -0
- bullish/jobs/tasks.py +12 -3
- bullish/utils/checks.py +2 -0
- {bullishpy-0.9.0.dist-info → bullishpy-0.11.0.dist-info}/METADATA +2 -1
- {bullishpy-0.9.0.dist-info → bullishpy-0.11.0.dist-info}/RECORD +18 -16
- {bullishpy-0.9.0.dist-info → bullishpy-0.11.0.dist-info}/WHEEL +0 -0
- {bullishpy-0.9.0.dist-info → bullishpy-0.11.0.dist-info}/entry_points.txt +0 -0
bullish/figures/figures.py
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import datetime
|
|
2
|
+
from typing import Optional, List
|
|
2
3
|
|
|
3
4
|
import pandas as pd
|
|
4
5
|
import plotly.graph_objects as go
|
|
5
6
|
from plotly.subplots import make_subplots
|
|
6
7
|
|
|
7
8
|
from bullish.analysis.functions import add_indicators
|
|
9
|
+
from datetime import date
|
|
8
10
|
|
|
9
11
|
|
|
10
12
|
def plot(
|
|
11
13
|
data: pd.DataFrame,
|
|
12
14
|
symbol: str,
|
|
13
15
|
name: Optional[str] = None,
|
|
14
|
-
dates: Optional[
|
|
16
|
+
dates: Optional[List[date]] = None,
|
|
15
17
|
) -> go.Figure:
|
|
16
18
|
data = add_indicators(data)
|
|
17
19
|
fig = make_subplots(
|
|
@@ -125,10 +127,21 @@ def plot(
|
|
|
125
127
|
row=7,
|
|
126
128
|
col=1,
|
|
127
129
|
)
|
|
128
|
-
if dates is not None and
|
|
130
|
+
if dates is not None and dates:
|
|
129
131
|
for date in dates:
|
|
132
|
+
if (
|
|
133
|
+
data.first_valid_index().date() > date # type: ignore
|
|
134
|
+
or data.last_valid_index().date() + datetime.timedelta(days=31 * 3) # type: ignore
|
|
135
|
+
< date
|
|
136
|
+
):
|
|
137
|
+
continue
|
|
130
138
|
fig.add_vline(
|
|
131
|
-
x=date,
|
|
139
|
+
x=date,
|
|
140
|
+
line_dash="dashdot",
|
|
141
|
+
line_color="MediumPurple",
|
|
142
|
+
line_width=1,
|
|
143
|
+
row=1,
|
|
144
|
+
col=1,
|
|
132
145
|
)
|
|
133
146
|
|
|
134
147
|
# Layout tweaks
|
bullish/interface/interface.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import abc
|
|
2
2
|
import logging
|
|
3
|
+
from datetime import date
|
|
3
4
|
from typing import List, Optional
|
|
4
5
|
|
|
5
6
|
import pandas as pd
|
|
@@ -83,3 +84,9 @@ class BullishDbBase(BearishDbBase): # type: ignore
|
|
|
83
84
|
|
|
84
85
|
@abc.abstractmethod
|
|
85
86
|
def read_symbols(self) -> List[str]: ...
|
|
87
|
+
|
|
88
|
+
@abc.abstractmethod
|
|
89
|
+
def read_job_tracker(self, task_id: str) -> Optional[JobTracker]: ...
|
|
90
|
+
|
|
91
|
+
@abc.abstractmethod
|
|
92
|
+
def read_dates(self, symbol: str) -> List[date]: ...
|
bullish/jobs/tasks.py
CHANGED
|
@@ -10,7 +10,7 @@ from .app import huey
|
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
from huey.api import Task # type: ignore
|
|
12
12
|
|
|
13
|
-
from .models import JobTrackerStatus
|
|
13
|
+
from .models import JobTrackerStatus, JobTracker, JobType
|
|
14
14
|
from ..analysis.analysis import run_analysis
|
|
15
15
|
from ..database.crud import BullishDb
|
|
16
16
|
from bullish.analysis.filter import FilterUpdate
|
|
@@ -21,16 +21,22 @@ logger = logging.getLogger(__name__)
|
|
|
21
21
|
def job_tracker(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
22
22
|
@functools.wraps(func)
|
|
23
23
|
def wrapper(
|
|
24
|
-
database_path: Path,
|
|
24
|
+
database_path: Path,
|
|
25
|
+
job_type: JobType,
|
|
26
|
+
*args: Any,
|
|
27
|
+
task: Optional[Task] = None,
|
|
28
|
+
**kwargs: Any,
|
|
25
29
|
) -> None:
|
|
26
30
|
bullish_db = BullishDb(database_path=database_path)
|
|
27
31
|
if task is None:
|
|
28
32
|
raise ValueError("Task must be provided for job tracking.")
|
|
33
|
+
if bullish_db.read_job_tracker(task.id) is None:
|
|
34
|
+
bullish_db.write_job_tracker(JobTracker(job_id=str(task.id), type=job_type))
|
|
29
35
|
bullish_db.update_job_tracker_status(
|
|
30
36
|
JobTrackerStatus(job_id=task.id, status="Running")
|
|
31
37
|
)
|
|
32
38
|
try:
|
|
33
|
-
func(database_path, *args, task=task, **kwargs)
|
|
39
|
+
func(database_path, job_type, *args, task=task, **kwargs)
|
|
34
40
|
bullish_db.update_job_tracker_status(
|
|
35
41
|
JobTrackerStatus(job_id=task.id, status="Completed")
|
|
36
42
|
)
|
|
@@ -47,6 +53,7 @@ def job_tracker(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
|
47
53
|
@job_tracker
|
|
48
54
|
def update(
|
|
49
55
|
database_path: Path,
|
|
56
|
+
job_type: JobType,
|
|
50
57
|
symbols: List[str],
|
|
51
58
|
update_query: FilterUpdate,
|
|
52
59
|
task: Optional[Task] = None,
|
|
@@ -69,6 +76,7 @@ def update(
|
|
|
69
76
|
@job_tracker
|
|
70
77
|
def analysis(
|
|
71
78
|
database_path: Path,
|
|
79
|
+
job_type: JobType,
|
|
72
80
|
task: Optional[Task] = None,
|
|
73
81
|
) -> None:
|
|
74
82
|
bullish_db = BullishDb(database_path=database_path)
|
|
@@ -79,6 +87,7 @@ def analysis(
|
|
|
79
87
|
@job_tracker
|
|
80
88
|
def news(
|
|
81
89
|
database_path: Path,
|
|
90
|
+
job_type: JobType,
|
|
82
91
|
symbols: List[str],
|
|
83
92
|
headless: bool = True,
|
|
84
93
|
task: Optional[Task] = None,
|
bullish/utils/checks.py
CHANGED
|
@@ -40,6 +40,8 @@ def get_table_names_from_path(database_path: Path) -> List[str]:
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
def empty_analysis_table(database_path: Path) -> bool:
|
|
43
|
+
if "analysis" not in get_table_names_from_path(database_path):
|
|
44
|
+
return True
|
|
43
45
|
with get_sqlite_connection(database_path) as conn:
|
|
44
46
|
cursor = conn.cursor()
|
|
45
47
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: bullishpy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.0
|
|
4
4
|
Summary:
|
|
5
5
|
Author: aan
|
|
6
6
|
Author-email: andoludovic.andriamamonjy@gmail.com
|
|
@@ -8,6 +8,7 @@ Requires-Python: >=3.12,<3.13
|
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.12
|
|
10
10
|
Requires-Dist: bearishpy (>=0.20.0,<0.21.0)
|
|
11
|
+
Requires-Dist: click (>=7.0,<=8.1)
|
|
11
12
|
Requires-Dist: huey (>=2.5.3,<3.0.0)
|
|
12
13
|
Requires-Dist: pandas-ta (>=0.3.14b0,<0.4.0)
|
|
13
14
|
Requires-Dist: plotly (>=6.1.2,<7.0.0)
|
|
@@ -1,13 +1,13 @@
|
|
|
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=
|
|
4
|
-
bullish/analysis/filter.py,sha256=
|
|
5
|
-
bullish/analysis/functions.py,sha256=
|
|
6
|
-
bullish/analysis/indicators.py,sha256=
|
|
7
|
-
bullish/analysis/predefined_filters.py,sha256=
|
|
3
|
+
bullish/analysis/analysis.py,sha256=9ugJp2fGuA6xFUlGIJVIHWZ8d8E6TdbQHWjg5zWPIwY,18445
|
|
4
|
+
bullish/analysis/filter.py,sha256=S8TuxoTAUY0U8ARPjNHE0tSSE_ToWkfZazAgnfgswk4,18136
|
|
5
|
+
bullish/analysis/functions.py,sha256=KKz_0C7maQmcGu2tGwZvioxzmh-JcB-YNpPQGjyyheA,13825
|
|
6
|
+
bullish/analysis/indicators.py,sha256=hZgzTq-80XPP6x7dXGhxd-Zzgra-6D-g3pVxUBYOW44,20167
|
|
7
|
+
bullish/analysis/predefined_filters.py,sha256=3O244FCZkbnTSaReh6w6cwEIXdLzQZmbkBS0uRW-Y0M,12391
|
|
8
8
|
bullish/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
bullish/app/app.py,sha256=
|
|
10
|
-
bullish/cli.py,sha256=
|
|
9
|
+
bullish/app/app.py,sha256=E0H78LOODl1H6s308jXpQGTUoFPoLOJkPBXOLQGLCeA,13331
|
|
10
|
+
bullish/cli.py,sha256=uYLZmGDAolZKWzduZ58bP-xul1adg0oKfeUQtZMXTvA,1958
|
|
11
11
|
bullish/database/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
bullish/database/alembic/README,sha256=heMzebYwlGhnE8_4CWJ4LS74WoEZjBy-S-mIJRxAEKI,39
|
|
13
13
|
bullish/database/alembic/alembic.ini,sha256=VuwqBJV5ObTyyRNrqv8Xr-TDIRfqPjP9R1mqewYM_xE,3695
|
|
@@ -16,12 +16,14 @@ bullish/database/alembic/script.py.mako,sha256=MEqL-2qATlST9TAOeYgscMn1uy6HUS9NF
|
|
|
16
16
|
bullish/database/alembic/versions/037dbd721317_.py,sha256=U7EA4odH3t9w0-J4FmvBUt8HOuGDMn0rEAu_0vPUYaI,8595
|
|
17
17
|
bullish/database/alembic/versions/08ac1116e055_.py,sha256=zMEiCbraMEAZItT4ibc3evAH7-7mkXpdgnZy4tPVYeg,27263
|
|
18
18
|
bullish/database/alembic/versions/11d35a452b40_.py,sha256=j2PaU1RssLQ20OevGmBC7S9E9ocWiXpBue9SOS4AQoY,11521
|
|
19
|
+
bullish/database/alembic/versions/17e51420e7ad_.py,sha256=xeiVIm1YUZb08opE9rocHZP1__9WQWXsKsXgeFV9cvs,2960
|
|
19
20
|
bullish/database/alembic/versions/49c83f9eb5ac_.py,sha256=kCBItp7KmqpJ03roy5ikQjhefZia1oKgfZwournQDq8,3890
|
|
20
21
|
bullish/database/alembic/versions/4b0a2f40b7d3_.py,sha256=G0K7w7pOPYjPZkXTB8LWhxoxuWBPcPwOfnubTBtdeEY,1827
|
|
21
22
|
bullish/database/alembic/versions/73564b60fe24_.py,sha256=MTlDRDNHj3E9gK7IMeAzv2UxxxYtWiu3gI_9xTLE-wg,1008
|
|
23
|
+
bullish/database/alembic/versions/d663166c531d_.py,sha256=U92l6QXqPniAYrPeu2Bt77ReDbXveLj4aGXtgd806JY,1915
|
|
22
24
|
bullish/database/alembic/versions/ee5baabb35f8_.py,sha256=nBMEY-_C8AsSXVPyaDdUkwrFFo2gxShzJhmrjejDwtc,1632
|
|
23
25
|
bullish/database/alembic/versions/fc191121f522_.py,sha256=0sstF6TpAJ09-Mt-Vek9SdSWksvi4C58a5D92rBtuY8,1894
|
|
24
|
-
bullish/database/crud.py,sha256=
|
|
26
|
+
bullish/database/crud.py,sha256=6-Fb1AjGZqsrmwwl2Qay_leqQ9_-RAIjZ8D0efe8nKA,7022
|
|
25
27
|
bullish/database/schemas.py,sha256=bU-DW49NqpBp--1VN486LUdDmLeScrI8TF69afzjoTc,1507
|
|
26
28
|
bullish/database/scripts/create_revision.py,sha256=rggIf-3koPqJNth8FIg89EOfnIM7a9QrvL8X7UJsP0g,628
|
|
27
29
|
bullish/database/scripts/stamp.py,sha256=PWgVUEBumjNUMjTnGw46qmU3p221LeN-KspnW_gFuu4,839
|
|
@@ -29,16 +31,16 @@ bullish/database/scripts/upgrade.py,sha256=-Gz7aFNPEt9y9e1kltqXE76-j_8QeNtet_Vlw
|
|
|
29
31
|
bullish/database/settings.py,sha256=nMudufmF7iC_62_PHrGSMjlqDLN2I0qTbtz9JKZHSko,164
|
|
30
32
|
bullish/exceptions.py,sha256=4z_i-dD-CDz1bkGmZH9DOf1L_awlCPCgdUDPF7dhWAI,106
|
|
31
33
|
bullish/figures/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
|
-
bullish/figures/figures.py,sha256=
|
|
34
|
+
bullish/figures/figures.py,sha256=SWTTiEoVyWMZeIIxg0ERi23v7s4tySB5BLKyPu12jC4,4193
|
|
33
35
|
bullish/interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
|
-
bullish/interface/interface.py,sha256
|
|
36
|
+
bullish/interface/interface.py,sha256=-3V4M1J2VVn0ugwbaCKzMuBYRHH7eFmz9gij0hUTNUw,3013
|
|
35
37
|
bullish/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
38
|
bullish/jobs/app.py,sha256=5MJ5KXUo7JSNAvOPgkpIMasD11VTrjQvGzM7vmCY65E,77
|
|
37
39
|
bullish/jobs/models.py,sha256=ndrGTMP08S57yGLGEG9TQt8Uw2slc4HvbG-TZtEEuN0,744
|
|
38
|
-
bullish/jobs/tasks.py,sha256=
|
|
40
|
+
bullish/jobs/tasks.py,sha256=V_b0c8_GQC0-KIxaHDlLFhtkclQJOsck0gXaW6OlC_w,3055
|
|
39
41
|
bullish/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
|
-
bullish/utils/checks.py,sha256=
|
|
41
|
-
bullishpy-0.
|
|
42
|
-
bullishpy-0.
|
|
43
|
-
bullishpy-0.
|
|
44
|
-
bullishpy-0.
|
|
42
|
+
bullish/utils/checks.py,sha256=Va10_xDVVnxYkOD2hafvyQ-TFV8FQpOkr4huJ7XgpDM,2188
|
|
43
|
+
bullishpy-0.11.0.dist-info/METADATA,sha256=2eQfm9prQaZjTnRzLUDvRd0jjE8EapQ1RMhJtQ0CXjQ,745
|
|
44
|
+
bullishpy-0.11.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
45
|
+
bullishpy-0.11.0.dist-info/entry_points.txt,sha256=eaPpmL6vmSBFo0FBtwibCXGqAW4LFJ83whJzT1VjD-0,43
|
|
46
|
+
bullishpy-0.11.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|