How to test Strategy using VectorBT?

74 views Asked by At

I have pandas dataframe containing OHLCV for a given ticker. Along with these columns I also have column named Signal. This column is already generated using results from a ML model. I want to test out this strategy using VectorBT. Use code below to generate a sample dataframe.

import pandas as pd
import numpy as np
import vectorbt as vbt

data = {
    'Date': pd.date_range('2022-01-01', '2022-12-31'),
    'Close': np.random.rand(365) * 100,
    'Signal': np.random.choice([-1, 0, 1], size=365)
}

df = pd.DataFrame(data)
df.set_index('Date', inplace=True)

How would I test out this strategy using VectorBT?

0

There are 0 answers