How to calculate exposure?

I want to calculate the exposure (percentage of days the strategy is invested in the market) of a strategy and analyze it after the strategy ran.
I am quite new to backtrader, so I am not sure what the best way to achieve this is.
I would go about it like that:

Create a custom analyzer

Access the Strategies
self.position
inside the analyzer 
Calculate exposure
My question is it possible to access
self.position
in an analyzer? If yes, how? If no, what are good alternatives?Thanks


@phlpp Backtrader already has an analyzer that provides length in market information for the backtest. It is called trade analyzer. Here is a description of details tracked:
Length (bars in the market)
Total/Average/Max/Min
Won/Lost Total/Average/Max/Min
Long/Short Total/Average/Max/Min
Won/Lost Total/Average/Max/Min
Here is a sample with a backtest with two long trades, one winning, one losing.
len_total 8280 len_average 4140 len_max 5236 len_min 3044 len_won_total 5236 len_won_average 5236 len_won_max 5236 len_won_min 5236 len_lost_total 3044 len_lost_average 3044 len_lost_max 3044 len_lost_min 3044 len_long_total 8280 len_long_average 4140 len_long_max 5236 len_long_min 3044 len_long_won_total 5236 len_long_won_average 5236 len_long_won_max 5236 len_long_won_min 5236 len_long_lost_total 3044 len_long_lost_average 3044 len_long_lost_max 3044 len_long_lost_min 3044 len_short_total 0 len_short_average 0 len_short_max 0 len_short_min 0 len_short_won_total 0 len_short_won_average 0 len_short_won_max 0 len_short_won_min 0 len_short_lost_total 0 len_short_lost_average 0 len_short_lost_max 0 len_short_lost_min 0

@runout Thanks I must have missed that.