run_from_signals
| Name | Type | Default | Description |
|---|---|---|---|
data | vbt.Data | -- | Historical market data. |
signals | Signals | -- | Generated trading signals. |
metrics | str | None | Metrics to evaluate the portfolio, by default None. |
use_rolling | bool | False | Use rolling metrics. See metrics config. Defauts to False. |
metrics_kwargs | tp.Kwargs | None | Additional arguments for metric config. Parameters such as window of minp for rolling metrics should be specificed. Defaults to None. |
validate_metrics | bool | True | Check if metric is valid in the config. Might slow-down code if set to True. Defaults to True. |
to_numpy | bool | False | If True, returns a numpy ndarray. Defaults to False, which means returns a pandas SeriesFrame. |
portfolio_config | tp.Kwargs | -- | Additional arguments for portfolio simulation. |
| Type | Description |
|---|---|
vbt.PF | OrderedDict | pd.DataFrame | tp.Array | Simulated portfolio or requested metrics. |
run_from_signals_nb
| Name | Type | Default | Description |
|---|---|---|---|
close | Array1d | -- | Array of closing prices. |
signals | Signals | -- | Generated trading signals. |
size | int | 50 | Size of each order, default is 50. |
sl_stop | float | np.nan | Stop-loss level, default is np.nan (no stop-loss). |
tsl_stop | float | np.nan | Trailing stop-loss level, default is np.nan (no trailing stop-loss). |
tp_stop | float | np.nan | Take-profit level, default is np.nan (no take-profit). |
| Type | Description |
|---|---|
SimulationOutput | Simulated portfolio. |
<Note> | |
The output of this function is an instance of the type SimulationOutput, | |
which can be used to construct a new Portfolio instance for analysis: | |
</Note> |
run_from_optimize_func
| Name | Type | Default | Description |
|---|---|---|---|
data | vbt.Data | -- | Historical market data. |
returns | tp.Array | -- | Array of returns to be used for optimization. |
signals | Signals | -- | Generated trading signals. |
optimize_func | tp.Callable | -- | Custom optimization function that takes the returns and signals as input. This function should return a dictionary of optimized parameters or metrics. |
config | tp.Kwargs | None | Dictionary with optimization parameters. Defaults to None. |
| Type | Description |
|---|---|
vbt.PortfolioOptimizer | Configured portfolio optimizer instance ready for backtesting. |

