  We consider a univariate semimartingale model for (the logarithm of) an asset
price, containing jumps having possibly infinite activity (IA). The
nonparametric threshold estimator of the integrated variance IV proposed in
Mancini 2009 is constructed using observations on a discrete time grid, and
precisely it sums up the squared increments of the process when they are below
a threshold, a deterministic function of the observation step and possibly of
the coefficients of X. All the threshold functions satisfying given conditions
allow asymptotically consistent estimates of IV, however the finite sample
properties of the truncated realized variation can depend on the specific
choice of the threshold. We aim here at optimally selecting the threshold by
minimizing either the estimation mean square error (MSE) or the conditional
mean square error (cMSE). The last criterion allows to reach a threshold which
is optimal not in mean but for the specific volatility (and jumps paths) at
hand. A parsimonious characterization of the optimum is established, which
turns out to be asymptotically proportional to the L\'evy's modulus of
continuity of the underlying Brownian motion. Moreover, minimizing the cMSE
enables us to propose a novel implementation scheme for approximating the
optimal threshold. Monte Carlo simulations illustrate the superior performance
of the proposed method.
