Created
April 10, 2021 11:49
-
-
Save vnegi10/d27170c187145a24aca2a775854c75f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
callback!( | |
app, | |
Output("graph", "figure"), | |
Input("mode_ID", "value"), | |
Input("pair_ID", "value"), | |
Input("window_ID", "value"), | |
Input("duration_ID", "value"), | |
) do mode_ID, pair_ID, window_ID, duration_ID | |
t1, t2, t3, t4, t5, t6 = plot_price_vol_data(pair_ID, duration_ID, window_ID) | |
if mode_ID == 1 | |
layout1 = Layout(;title="Alpha Vantage daily average price data for $(currencies[pair_ID])", | |
xaxis = attr(title="Time", showgrid=true, zeroline=true, linewidth=1.0), | |
yaxis = attr(title="Price [euros]", showgrid=true, zeroline=true, linewidth=1.0), | |
height = 500, | |
width = 1000, | |
paper_bgcolor="white" | |
) | |
P1 = Plot([t1, t4, t5, t6], layout1) # plots daily average price and three diferent moving averages | |
return P1 | |
elseif mode_ID == 2 | |
layout1 = Layout(;title="Candlestick data for $(currencies[pair_ID])", | |
xaxis=attr(title="Time", showgrid=true, zeroline=true), | |
yaxis=attr(title="Price from Alpha Vantage [euros]", zeroline=true), | |
height = 500, | |
width = 1000, | |
) | |
layout2 = Layout(;title="Daily volume data for $(currencies[pair_ID])", | |
xaxis=attr(title="Time", showgrid=true, zeroline=true), | |
yaxis=attr(title="Volume from Alpha Vantage", zeroline=true), | |
height = 100, | |
width = 200 | |
) | |
P1 = Plot(t3, layout1) # plots candlestick data | |
P2 = Plot(t2, layout2) # plots daily volume | |
return [P1 P2] | |
elseif mode_ID == 3 | |
t7 = plot_fcas_data(pair_ID) | |
layout1 = Layout(;title="FCAS metrics data for $(currencies[pair_ID])", | |
xaxis = attr(title="Type of metric", showgrid=true, zeroline=true), | |
yaxis = attr(title="Score", showgrid=true, zeroline=true), | |
height = 500, | |
width = 1000, | |
paper_bgcolor="white" | |
) | |
P1 = Plot(t7, layout1) # plots FCAS metrics | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment