# Portfolio duration

What is the correct way to calculate duration of a fixed income portfolio with long and short bond positions? And how to calculate portfolio YTM with long and short positions. For long only (or short only) we use weighted average duration and yield but how to calculate with long and short position?

long/short with respect to a benchmark: then take as basis the dollar value of your portfolio P USD, set the benchmark to the same dollar value and calculate each weight as fraction of the position $w_i = P_i/P$ and long/short can be deviations from the benchmark. The sum of these weights is zero.
long/short with derivatives: So I assume you are long derivatives and bonds and short derivatives. Then you can again use the sum of your bonds as portfolio value in P USD. Then long derivatives have weights $w_i = MV_i/P$ and short derivatives have $w_i = -MV_i/P$. The sum of these weights (bonds + derivatives) can be positive, zero or negative depending on your position.