Skip to content

VectrBT CheatSheet

David Brazda edited this page Jun 4, 2024 · 11 revisions

Plotly

  1. MAKE_SUBPLOT Definovat layout
fig = vbt.make_subplots(rows=2, cols=1, shared_xaxes=True, 
                            # specs=[[{"secondary_y": True}], [{"secondary_y": False}]], 
                            # vertical_spacing=0.02, subplot_titles=("Price and Indicators", "Volume"))
  1. ADD_TRACE_KWARGS - definuje umisteni do subpotu
add_trace_kwargs=dict(secondary_y=False,row=1, col=1)
  1. TRACE_KWARGS - ostatni stylujici atributy pro dany trace
trace_kwargs=dict(name="LONGS",
                  line=dict(color="#ffe476"),
                  marker=dict(color="limegreen"),
                  fill=None,
                  connectgaps=True)

Cely příklad

    fig = vbt.make_subplots(rows=2, cols=1, shared_xaxes=True, 
                            specs=[[{"secondary_y": True}], [{"secondary_y": False}]], 
                            vertical_spacing=0.02, subplot_titles=("Price and Indicators", "Volume"))

    # Plotting the close price
    close.vbt.plot(fig=fig, add_trace_kwargs=dict(secondary_y=False,row=1, col=1), trace_kwargs=dict(line=dict(color="blue")))
Clone this wiki locally