  We present a timing analysis of the transitional millisecond pulsar PSR
J1023+0038 using observations taken between January 2018 and January 2020 with
the high time resolution photon counter Aqueye+ mounted at the 1.82 m
Copernicus telescope in Asiago. We report the first measurement of the timing
solution and the frequency derivative of PSR J1023+0038 based entirely on
optical data. The spin-down rate of the pulsar is $(-2.53 \pm 0.04) \times
10^{-15}$ Hz$^2$, which is $\sim$20% slower than that measured from the X-ray
observations taken in 2013-2016 and $\sim$5% faster than that measured in the
radio band during the rotation-powered state.
