Skip to content

Why Max Gross Exposure higher than 100% in 'shortonly' mode? #799

@kdhoon2

Description

@kdhoon2

Hello. I just noticed that Max Gross Exposure was calculated as a higher value than 100% in 'shortonly' mode.
Could you please let me know how Max Gross Exposure is calculated numerically?
Many thanks for your help.

Attached file is the result of the following two line code.
df=portfolio.positions.records_readable
df.to_csv('short_test.csv')

short_test.csv

#### CODE ####

fixed_size=100_000

portfolio = vbt.Portfolio.from_signals(
close=price,
entries=entries,
exits=None,
direction='shortonly',
accumulate=False,
allow_partial=True,
freq='1min',
init_cash=100_000,
fees=0.0005,
slippage=0.001,
use_stops=True,
tp_stop=0.02,
# sl_trail=0.03,
sl_stop=0.01,
size_type='value',
size=fixed_size,

)

print(portfolio.stats(settings=dict(annualization_factor=525600)))

#### RESULT DATA ####

Start 2025-02-01 09:00:00
End 2025-05-01 08:59:00
Period 87 days 02:29:00
Start Value 100000.0
End Value 96486.552566
Total Return [%] -3.513447
Benchmark Return [%] -31.575295
Max Gross Exposure [%] 133.710473
Total Fees Paid 19871.920763
Max Drawdown [%] 24.691191
Max Drawdown Duration 30 days 10:05:00
Total Trades 199
Total Closed Trades 199
Total Open Trades 0
Open Trade PnL 0.0
Win Rate [%] 38.693467
Best Trade [%] 3.648078
Worst Trade [%] -2.17124
Avg Winning Trade [%] 2.049433
Avg Losing Trade [%] -1.322322
Avg Winning Trade Duration 0 days 02:41:17.142857142
Avg Losing Trade Duration 0 days 02:35:02.950819672
Profit Factor 0.978199
Expectancy -17.655515
Sharpe Ratio -0.086596
Calmar Ratio -0.563707
Omega Ratio 0.999282
Sortino Ratio -0.123526
dtype: object
CPU times: total: 62.5 ms
Wall time: 110 ms

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions