Optimal nonparametric estimation for some semimartingale stochastic differential equations