-
Notifications
You must be signed in to change notification settings - Fork 4
VectrBT CheatSheet
David Brazda edited this page Jun 4, 2024
·
11 revisions
- 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"))
- ADD_TRACE_KWARGS - definuje umisteni do subpotu
add_trace_kwargs=dict(secondary_y=False,row=1, col=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)
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")))
h4_h1_open = h4_open.resample("1h")
h4_close.vbt.realign_closing("1h") #realign resmapled series to given resolution (1h) - it can be compared
h4_open.vbt.realign_opening("1h")
t2dataclose = t2data.close.rename("15MIN - realigned").vbt.realign_closing("1T")
fig = t1data.close.rename("1MIN").vbt.plot()
t2data.close.rename("15MIN").vbt.plot(fig=fig)
t2dataclose.vbt.plot(fig=fig)
basic_data.to_parquet(partition_by="day", compression="gzip")
day_data = vbt.ParquetData.pull("BAC", filters=[("group", "==", "2024-05-03")])
vbt.print_dir_tree("BTC-USD")#overeni directory structure
vbt.phelp(vbt.talib(“atr”).run) #parameters it accepts
vbt.pdir(pf) - get available properties and methods
vbt.pprint(basic_data) #to get correct shape, info about instance