file-styles-new-graph #1
17
finance.py
17
finance.py
@ -4,7 +4,7 @@ import dash_core_components as dcc
|
|||||||
import dash_table
|
import dash_table
|
||||||
import plotly.express as px
|
import plotly.express as px
|
||||||
import yfinance as yf
|
import yfinance as yf
|
||||||
from dash.dependencies import Input, Output
|
from dash.dependencies import Input, Output, State
|
||||||
import plotly.graph_objects as go
|
import plotly.graph_objects as go
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
@ -111,12 +111,15 @@ app.layout = html.Div(
|
|||||||
html.Div(
|
html.Div(
|
||||||
className='div-for-dropdown',
|
className='div-for-dropdown',
|
||||||
children=[
|
children=[
|
||||||
dcc.Dropdown(id='table_selector',
|
dcc.Dropdown(id='table_selector',
|
||||||
options=get_options(stock_list),
|
options=get_options(stock_list),
|
||||||
multi=False, value=selected_stock_in_table,
|
multi=False, value=selected_stock_in_table,
|
||||||
style={'backgroundColor': '#1E1E1E'},
|
style={'backgroundColor': '#1E1E1E'},
|
||||||
className='stockselector'
|
className='stockselector'
|
||||||
)
|
),
|
||||||
|
html.Button("Pobierz dane", id="btn_data"),
|
||||||
|
dcc.Download(id="download-data")
|
||||||
|
|
||||||
],
|
],
|
||||||
style={'color': '#1E1E1E'}),
|
style={'color': '#1E1E1E'}),
|
||||||
html.P('Wybierz przedział czasu by policzyć średnie i wachania'),
|
html.P('Wybierz przedział czasu by policzyć średnie i wachania'),
|
||||||
@ -147,6 +150,14 @@ app.layout = html.Div(
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@app.callback(
|
||||||
|
Output("download-data", "data"),
|
||||||
|
Input("btn_data", "n_clicks"),
|
||||||
|
prevent_initial_call=True,
|
||||||
|
)
|
||||||
|
def create_download_file(n_clicks):
|
||||||
|
global selected_stock_in_table_df
|
||||||
|
return dcc.send_data_frame(selected_stock_in_table_df.to_csv, "data.csv")
|
||||||
|
|
||||||
# Callback for timeseries price
|
# Callback for timeseries price
|
||||||
@app.callback(Output('timeseries', 'figure'), [Input('stockselector', 'value')])
|
@app.callback(Output('timeseries', 'figure'), [Input('stockselector', 'value')])
|
||||||
|
Loading…
Reference in New Issue
Block a user