bullishpy 0.38.0__py3-none-any.whl → 0.40.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 +7 -1
- bullish/analysis/filter.py +1 -1
- bullish/app/app.py +5 -22
- bullish/database/crud.py +8 -1
- bullish/jobs/tasks.py +1 -0
- {bullishpy-0.38.0.dist-info → bullishpy-0.40.0.dist-info}/METADATA +1 -1
- {bullishpy-0.38.0.dist-info → bullishpy-0.40.0.dist-info}/RECORD +9 -9
- {bullishpy-0.38.0.dist-info → bullishpy-0.40.0.dist-info}/WHEEL +0 -0
- {bullishpy-0.38.0.dist-info → bullishpy-0.40.0.dist-info}/entry_points.txt +0 -0
bullish/analysis/analysis.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import logging
|
|
3
|
+
import re
|
|
3
4
|
import time
|
|
4
5
|
from datetime import date, datetime
|
|
5
6
|
from itertools import batched, chain
|
|
@@ -507,6 +508,11 @@ def json_loads(value: Any) -> Any:
|
|
|
507
508
|
return value
|
|
508
509
|
|
|
509
510
|
|
|
511
|
+
def scrub(text: str) -> str:
|
|
512
|
+
strip_markup = re.compile(r"[\\`*_{}\[\]()>#+\-.!|~:$;\"\'<>&]").sub
|
|
513
|
+
return strip_markup("", text)
|
|
514
|
+
|
|
515
|
+
|
|
510
516
|
class SubjectAnalysis(BaseModel):
|
|
511
517
|
high_price_target: Optional[float] = None
|
|
512
518
|
low_price_target: Optional[float] = None
|
|
@@ -525,7 +531,7 @@ class SubjectAnalysis(BaseModel):
|
|
|
525
531
|
return None
|
|
526
532
|
return "".join(
|
|
527
533
|
[
|
|
528
|
-
f"<p>{t.get('content')}</p>"
|
|
534
|
+
f"<p>{scrub(t.get('content').replace("\n",""))}</p>" # type: ignore
|
|
529
535
|
for t in self.news_summary
|
|
530
536
|
if t.get("content")
|
|
531
537
|
]
|
bullish/analysis/filter.py
CHANGED
|
@@ -256,7 +256,7 @@ class FilterQueryStored(FilterQuery): ...
|
|
|
256
256
|
|
|
257
257
|
|
|
258
258
|
class FilterUpdate(BaseModel):
|
|
259
|
-
window_size: SeriesLength = Field("
|
|
259
|
+
window_size: SeriesLength = Field("1m")
|
|
260
260
|
data_age_in_days: int = 1
|
|
261
261
|
update_financials: bool = False
|
|
262
262
|
update_analysis_only: bool = False
|
bullish/app/app.py
CHANGED
|
@@ -6,13 +6,13 @@ from typing import Optional, List, Type, Dict, Any
|
|
|
6
6
|
|
|
7
7
|
import pandas as pd
|
|
8
8
|
import streamlit as st
|
|
9
|
+
|
|
9
10
|
import streamlit_pydantic as sp
|
|
10
11
|
from bearish.models.base import Ticker # type: ignore
|
|
11
12
|
from bearish.models.price.prices import Prices # type: ignore
|
|
12
13
|
from bearish.models.query.query import AssetQuery, Symbols # type: ignore
|
|
13
14
|
from streamlit_file_browser import st_file_browser # type: ignore
|
|
14
15
|
|
|
15
|
-
from bullish.analysis.backtest import BacktestResults
|
|
16
16
|
from bullish.analysis.industry_views import get_industry_comparison_data
|
|
17
17
|
from bullish.analysis.predefined_filters import PredefinedFilters
|
|
18
18
|
from bullish.database.crud import BullishDb
|
|
@@ -27,7 +27,7 @@ from bullish.analysis.filter import (
|
|
|
27
27
|
GeneralFilter,
|
|
28
28
|
TechnicalAnalysisFilters,
|
|
29
29
|
)
|
|
30
|
-
from bullish.jobs.tasks import update, news, analysis
|
|
30
|
+
from bullish.jobs.tasks import update, news, analysis
|
|
31
31
|
from pydantic import BaseModel
|
|
32
32
|
|
|
33
33
|
from bullish.utils.checks import (
|
|
@@ -39,7 +39,7 @@ from bullish.utils.checks import (
|
|
|
39
39
|
CACHE_SHELVE = "user_cache"
|
|
40
40
|
DB_KEY = "db_path"
|
|
41
41
|
|
|
42
|
-
st.set_page_config(layout="wide")
|
|
42
|
+
st.set_page_config(page_title="Bullish", page_icon="💰", layout="wide")
|
|
43
43
|
logger = logging.getLogger(__name__)
|
|
44
44
|
|
|
45
45
|
|
|
@@ -100,7 +100,7 @@ def on_table_select() -> None:
|
|
|
100
100
|
st.session_state.ticker_news = subject
|
|
101
101
|
|
|
102
102
|
|
|
103
|
-
@st.dialog("🔑
|
|
103
|
+
@st.dialog("🔑 Select database file to continue")
|
|
104
104
|
def dialog_pick_database() -> None:
|
|
105
105
|
current_working_directory = Path.cwd()
|
|
106
106
|
event = st_file_browser(
|
|
@@ -216,17 +216,6 @@ def jobs() -> None:
|
|
|
216
216
|
|
|
217
217
|
st.success("Data update job has been enqueued.")
|
|
218
218
|
st.rerun()
|
|
219
|
-
with st.expander("Update analysis"):
|
|
220
|
-
if st.button("Update analysis"):
|
|
221
|
-
analysis(st.session_state.database_path, job_type="Update analysis")
|
|
222
|
-
st.success("Data update job has been enqueued.")
|
|
223
|
-
st.rerun()
|
|
224
|
-
with st.expander("Compute backtest signals"):
|
|
225
|
-
if st.button("Compute backtest signals"):
|
|
226
|
-
backtest_signals(
|
|
227
|
-
st.session_state.database_path, job_type="backtest signals"
|
|
228
|
-
)
|
|
229
|
-
st.rerun()
|
|
230
219
|
|
|
231
220
|
|
|
232
221
|
@st.dialog("📥 Load", width="large")
|
|
@@ -431,7 +420,7 @@ def main() -> None:
|
|
|
431
420
|
if st.session_state.database_path is None:
|
|
432
421
|
dialog_pick_database()
|
|
433
422
|
bearish_db_ = bearish_db(st.session_state.database_path)
|
|
434
|
-
charts_tab, jobs_tab
|
|
423
|
+
charts_tab, jobs_tab = st.tabs(["Charts", "Jobs"])
|
|
435
424
|
if "data" not in st.session_state:
|
|
436
425
|
st.session_state.data = load_analysis_data(bearish_db_)
|
|
437
426
|
|
|
@@ -482,12 +471,6 @@ def main() -> None:
|
|
|
482
471
|
use_container_width=True,
|
|
483
472
|
hide_index=True,
|
|
484
473
|
)
|
|
485
|
-
with backtests:
|
|
486
|
-
results = bearish_db_.read_many_backtest_results()
|
|
487
|
-
backtest_results = BacktestResults(results=results)
|
|
488
|
-
with st.container():
|
|
489
|
-
figure = backtest_results.figure()
|
|
490
|
-
st.plotly_chart(figure)
|
|
491
474
|
|
|
492
475
|
|
|
493
476
|
if __name__ == "__main__":
|
bullish/database/crud.py
CHANGED
|
@@ -13,7 +13,7 @@ from bearish.models.price.price import Price # type: ignore
|
|
|
13
13
|
from bearish.models.price.prices import Prices # type: ignore
|
|
14
14
|
from bearish.types import Sources # type: ignore
|
|
15
15
|
from pydantic import ConfigDict
|
|
16
|
-
from sqlalchemy import Engine, create_engine, insert, delete, update
|
|
16
|
+
from sqlalchemy import Engine, create_engine, insert, delete, update, inspect
|
|
17
17
|
from sqlalchemy import text
|
|
18
18
|
from sqlmodel import Session, select
|
|
19
19
|
|
|
@@ -34,6 +34,7 @@ from bullish.database.scripts.upgrade import upgrade
|
|
|
34
34
|
from bullish.exceptions import DatabaseFileNotFoundError
|
|
35
35
|
from bullish.interface.interface import BullishDbBase
|
|
36
36
|
from bullish.jobs.models import JobTracker, JobTrackerStatus
|
|
37
|
+
from tickermood.database.scripts.upgrade import upgrade as tickermood_upgrade # type: ignore
|
|
37
38
|
|
|
38
39
|
if TYPE_CHECKING:
|
|
39
40
|
from bullish.analysis.backtest import BacktestResult, BacktestResultQuery
|
|
@@ -65,6 +66,12 @@ class BullishDb(BearishDb, BullishDbBase): # type: ignore
|
|
|
65
66
|
"Skipping upgrade. "
|
|
66
67
|
)
|
|
67
68
|
engine = create_engine(database_url)
|
|
69
|
+
inspector = inspect(engine)
|
|
70
|
+
if "subject" not in inspector.get_table_names():
|
|
71
|
+
logger.info(
|
|
72
|
+
"Running tickermood upgrade to create the subject table in the database."
|
|
73
|
+
)
|
|
74
|
+
tickermood_upgrade(database_url=database_url, no_migration=True)
|
|
68
75
|
return engine
|
|
69
76
|
|
|
70
77
|
def model_post_init(self, __context: Any) -> None:
|
bullish/jobs/tasks.py
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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=
|
|
3
|
+
bullish/analysis/analysis.py,sha256=8FMEaDlgFERrgRPYq5zqIRgoeBvJVh3C91Zxl8eD7HU,23788
|
|
4
4
|
bullish/analysis/backtest.py,sha256=x91ek5kOzJHvYq0TmJh1Q8wBDDduIaieE0zDaoZFXew,14325
|
|
5
5
|
bullish/analysis/constants.py,sha256=X3oCyYNA6B-jsZSYJLeGQ94S453Z7jIVNPmv3lMPp8Q,9922
|
|
6
|
-
bullish/analysis/filter.py,sha256=
|
|
6
|
+
bullish/analysis/filter.py,sha256=zM1zeNqHtaLmk6QEmYQMcg_nfFU9MaUOUtaDpspBuJs,9285
|
|
7
7
|
bullish/analysis/functions.py,sha256=CuMgOjpQeg4KsDMUBdHRlxL1dRlos16KRyLhQe8PYUQ,14819
|
|
8
8
|
bullish/analysis/indicators.py,sha256=XsMHc4-hEZwxFpI3JI-s4C2hcg0eCQLWcAQ8P46dtL8,26812
|
|
9
9
|
bullish/analysis/industry_views.py,sha256=-B4CCAYz2arGQtWTXLLMpox0loO_MGdVQd2ycCRMOQQ,6799
|
|
10
10
|
bullish/analysis/predefined_filters.py,sha256=kx3vhtvGu_0ySWsWPzkqXONmB7COWgMowv3TEVrk1Uc,8198
|
|
11
11
|
bullish/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
bullish/app/app.py,sha256=
|
|
12
|
+
bullish/app/app.py,sha256=yYBfP1_VumcGnd2DsCLoyoDBvkCOg3x-rxgl2ChbcQo,16757
|
|
13
13
|
bullish/cli.py,sha256=azhVLwOUrmwrtFAJSgva8-UFgNgkepXhjp7DxQNc-yw,2427
|
|
14
14
|
bullish/database/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
bullish/database/alembic/README,sha256=heMzebYwlGhnE8_4CWJ4LS74WoEZjBy-S-mIJRxAEKI,39
|
|
@@ -37,7 +37,7 @@ bullish/database/alembic/versions/ec25c8fa449f_.py,sha256=8Yts74KEjK4jg20zIo90_0
|
|
|
37
37
|
bullish/database/alembic/versions/ee5baabb35f8_.py,sha256=nBMEY-_C8AsSXVPyaDdUkwrFFo2gxShzJhmrjejDwtc,1632
|
|
38
38
|
bullish/database/alembic/versions/fc191121f522_.py,sha256=0sstF6TpAJ09-Mt-Vek9SdSWksvi4C58a5D92rBtuY8,1894
|
|
39
39
|
bullish/database/alembic/versions/ff0cc4ba40ec_.py,sha256=74lxga54ig_LoNZYK9toJL9iRwGbNRezh1zvO1YI40U,2719
|
|
40
|
-
bullish/database/crud.py,sha256=
|
|
40
|
+
bullish/database/crud.py,sha256=69dq-vvhPQI3aopGIwaBSowBW37EGUnN0f7olVbOmEM,14180
|
|
41
41
|
bullish/database/schemas.py,sha256=fQ4RZeOjlFoIor7rjwpisbHRNDd7-zbyDdzNKaiNGQQ,3637
|
|
42
42
|
bullish/database/scripts/create_revision.py,sha256=rggIf-3koPqJNth8FIg89EOfnIM7a9QrvL8X7UJsP0g,628
|
|
43
43
|
bullish/database/scripts/stamp.py,sha256=PWgVUEBumjNUMjTnGw46qmU3p221LeN-KspnW_gFuu4,839
|
|
@@ -51,10 +51,10 @@ bullish/interface/interface.py,sha256=R2qVEMyBl9mBlPUO40zXp4vhfLKH7pgl_u2BmAVlD4
|
|
|
51
51
|
bullish/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
52
52
|
bullish/jobs/app.py,sha256=5MJ5KXUo7JSNAvOPgkpIMasD11VTrjQvGzM7vmCY65E,77
|
|
53
53
|
bullish/jobs/models.py,sha256=S2yvBf69lmt4U-5OU5CjXCMSw0s9Ubh9xkrB3k2qOZo,764
|
|
54
|
-
bullish/jobs/tasks.py,sha256=
|
|
54
|
+
bullish/jobs/tasks.py,sha256=XzA4p9mtXoZLhh_3LLa2SFy83F3yT2DHjNXg2Vufx8I,3752
|
|
55
55
|
bullish/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
56
56
|
bullish/utils/checks.py,sha256=Va10_xDVVnxYkOD2hafvyQ-TFV8FQpOkr4huJ7XgpDM,2188
|
|
57
|
-
bullishpy-0.
|
|
58
|
-
bullishpy-0.
|
|
59
|
-
bullishpy-0.
|
|
60
|
-
bullishpy-0.
|
|
57
|
+
bullishpy-0.40.0.dist-info/METADATA,sha256=BhShliBToQVQv0lK2a96dzV-ap98t6iFu8XLQ_ZM310,830
|
|
58
|
+
bullishpy-0.40.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
59
|
+
bullishpy-0.40.0.dist-info/entry_points.txt,sha256=eaPpmL6vmSBFo0FBtwibCXGqAW4LFJ83whJzT1VjD-0,43
|
|
60
|
+
bullishpy-0.40.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|