This commit is contained in:
teh_coderer
2023-03-15 15:15:44 -04:00
parent 3e5473a9e7
commit 3d457c4a0e
4 changed files with 46 additions and 10 deletions

View File

@@ -10,7 +10,6 @@ from typing import List, Tuple
import finviz
import pandas as pd
import praw
from pmaw import PushshiftAPI
from prawcore.exceptions import ResponseException
from requests import HTTPError
from sklearn.feature_extraction import _stop_words

View File

@@ -405,6 +405,13 @@ def is_streamlit_activated() -> bool:
if activate == 0:
_set_key()
return True
already_activated = console.input(
"\n[yellow]Was streamlit already activated? Y/n?[/]"
).lower()
if already_activated == "y":
_set_key()
return True
return _declined()
except Exception as err:

View File

@@ -18,8 +18,17 @@ st.set_page_config(
layout="wide",
page_title="Forecasting",
page_icon="📈",
initial_sidebar_state="collapsed",
initial_sidebar_state="expanded",
)
st.markdown(
"""
<style>
section[data-testid="stSidebar"] .css-ng1t4o {{width: 14rem;}}
</style>
""",
unsafe_allow_html=True,
)
css_container_style = """
<style>
.table_container {
@@ -77,11 +86,23 @@ EXPLAINABILITY_FIGURE: Union[OpenBBFigure, None] = None
PAST_COVERAGE_PRINT: str = "<br>"
# Rows and columns for the dashboard layout
st.title("OpenBB Forecasting") # Title does not like being in a column
r1c1, r1c2, r1c3, r1c4, r1c5 = st.columns([2, 1, 1, 1, 1])
r2c1, r2c2, r2c3 = st.columns([1, 1, 1])
st.markdown("""---""")
forecast_button = st.button("Get forecast")
st.sidebar.markdown(
"<h2 style='text-align: center;'>OpenBB Forecasting</h2>",
unsafe_allow_html=True,
)
r1c1 = st.sidebar.container()
(
r1c2,
r1c3,
) = st.sidebar.columns([1, 1])
r1c4, r1c5 = st.sidebar.columns([1, 1])
r2c1, r2c2 = st.sidebar.columns([1, 1])
r2c3 = st.sidebar.container()
st.sidebar.markdown("""---""")
forecast_button = st.sidebar.button("Get forecast")
plotly_chart, table_container = st.columns([4, 1])
explainability, past_cov_legend = st.columns([4, 1])

View File

@@ -161,11 +161,11 @@ async def plot_indicators(
y_max += y_range * 0.4
yaxis = "yaxis" if tickers else "yaxis2"
fig.update_layout(
{yaxis: dict(range=[y_min, y_max], autorange=False)},
title=dict(x=0.5, xanchor="center", yanchor="top", y=0.99, text=title),
showlegend=True,
margin=dict(t=40),
height=650,
)
@@ -280,6 +280,15 @@ class Handler:
filename = f"{dt_now}_{main_ticker}_technical_analysis"
fig.show(external=True)
if list(
set(indicators).intersection(
set(TA_CLASS.ma_mode + TA_CLASS.inchart)
)
):
margin = fig.layout.margin
margin.l += 30
fig.update_layout(margin=margin)
st.plotly_chart(
fig,
use_container_width=True,
@@ -409,12 +418,12 @@ class Handler:
async def run(self):
"""Run the app"""
page_title.markdown(
st.sidebar.markdown(
"<h2 style='text-align: center;'>OpenBB Technical Analysis</h2>",
unsafe_allow_html=True,
)
ticker = st.sidebar.text_input(
"Ticker (multiple possible, separated by comma)",
"Ticker(s) (comma separated)",
"",
key="indicators_ticker",
on_change=self.on_ticker_change,