Portfolios
If you have created and run a portfolio in the Exabel app, you can retrieve the allocations of the portfolio via the DSL. This can be used, for example, to visualise the allocations in the Signal Explorer or to download the allocations via the Export API. Some of the trading results like returns, turnover and exposures can also be retrieved from the DSL (as time series).
- allocations(*, portfolio: int = None, analysis: int = None, strategy: int = None, backtest: int = None, tracking: bool = False)
Retrieve the allocations of a portfolio.
- Parameters
portfolio – the id of the portfolio
analysis – the id of the alpha analysis
strategy – the id of the portfolio strategy (requires also tracking=True or the backtest number)
backtest – the backtest number (only if a strategy id is given)
tracking – if True, return the tracking of the portfolio strategy (only if a strategy id is given without a backtest number)
The portfolio can be identified in several different ways, by portfolio id, alpha analysis id or by strategy id. Use exactly one of the identification methods, and note that all the arguments are keyword-only arguments.
Examples:
Get the allocations of a portfolio:
allocations(portfolio=123)
Get the allocations of an alpha analysis:
allocations(analysis=123)
Get the allocations of a specific backtest of a portfolio strategy:
allocations(strategy=123, backtest=8)
Get the allocations of the tracking of a portfolio strategy:
allocations(strategy=123, tracking=True)
- portfolio_results(series: Sequence[str], *, analysis: int = None, strategy: int = None, backtest: int = None, tracking: bool = False)
Retrieve the results of a portfolio backtest.
- Parameters
series – which time series to retrieve (see below for options). A single time series or a list of time series may be given.
analysis – the id of the alpha analysis
strategy – the id of the portfolio strategy (requires also the backtest number)
backtest – the backtest number (only if a strategy id is given)
tracking – if True, return the results from the live tracking of the portfolio strategy (only if a strategy id is given without a backtest number)
The portfolio can be identified either by alpha analysis id or by strategy id and backtest number or by strategy id with tracking=True
.
Use exactly one of the identification methods, and note that these arguments are keyword-only arguments.
Time series name |
Description |
---|---|
returns |
The accumulated portfolio returns (daily). |
benchmark_returns |
The accumulated benchmark returns (daily). |
monthly_returns |
The monthly portfolio returns. |
monthly_excess_returns |
The monthly portfolio returns in excess of the benchmark’s returns. |
turnover |
Turnover at each rebalance date. |
long_exposure |
Total long position at each rebalance date. |
short_exposure |
Total short position at each rebalance date. |
total_position_count |
Total number of positions at each rebalance date. |
benchmark_deviation |
The total deviation from the benchmark at each rebalance date |
Examples:
Get the accumulated daily returns of a portfolio run with the given analysis ID:
portfolio_results("returns", analysis=123)
Get the accumulated daily returns of a portfolio run with the given strategy ID and backtest number:
portfolio_results("returns", strategy=123, backtest=5)
Get the monthly returns and excess returns of a portfolio strategy with a benchmark:
portfolio_results(["monthly_returns", "monthly_excess_returns"], analysis=123)
Get the long and short exposures and total position count at each rebalance date:
portfolio_results(["long_exposure", "short_exposure", "total_position_count"], strategy=123, backtest=8)
Get the accumulated daily returns from the live tracking of a portfolio with the given strategy ID:
portfolio_results("returns", strategy=123, tracking=True)