How to get derivative of stochastic integral 
Random process $Y$ is specified for $0\leq t< T$ (strictly) as $$Y_t=a(1-\frac tT)+b\frac tT+(T-t)\int_{s=0}^t\frac{1}{T-s}\:dB_s,\quad Y_0=a$$Derive the SDE for $Y$.

If we let $Y=f(t,X_t)$ where $X_t=\int_{s=0}^t\frac{1}{T-s}\:dB_s$ then applying the Taylor's formula (Ito's formula),
$$
\begin{align}
df&=f_t\:dt+f_x\:dx+\frac12f_{xx}dx^2
\end{align}
$$
Now, I was confused how to get those derivatives, especially $f_x$ and $dx^2$ term. Because most of the example I saw use SDE to get the term $dx^2$. But here I need direct differentiation to get $dx^2$.
 A: Expanding the comment of @Kut G.,
$$
Y(t) \stackrel{\text { def }}{=} a\left(1-\frac{t}{T}\right)+b \frac{t}{T}+(T-t) \int_{s=0}^{t} \frac{1}{T-s} d B(s) \quad Y(0)=a
$$
Let the stochastic integral be denoted $Z(t), Z(t) \stackrel{\text { def }}{=} \int_{s=0}^{t}[1 /(T-s)]$ $d B(s)$, which in shorthand is $d Z(t)=[1 /(T-t) d B(t)$. Then
$$
Y(t) \stackrel{\text { def }}{=} a\left(1-\frac{t}{T}\right)+b \frac{t}{T}+(T-t) Z(t)
$$
is a function of $t$ and $Z(t)$. Ito's formula gives
$$
\begin{aligned}
d Y(t) &=\left[-a \frac{1}{T}+b \frac{1}{T}-Z(t)\right] d t+(T-t) \frac{1}{T-t} d B(t) \\
&=\left[-a \frac{1}{T}+b \frac{1}{T}-Z(t)\right] d t+d B(t)
\end{aligned}
$$
Write $Z(t)$ in terms of $Y(t)$. First rearrange $Y(t)$ as
$$
Y(t)=a \frac{T-t}{T}+b \frac{t}{T}+(T-t) Z(t)
$$
So
$$
Z(t)=\frac{Y(t)}{T-t}-a \frac{1}{T}-b \frac{t}{T} \frac{1}{T-t}
$$
Substituting gives
$$
\begin{aligned}
d Y(t) &=\left[-a \frac{1}{T}+b \frac{1}{T}-\frac{Y(t)}{T-t}+a \frac{1}{T}+b \frac{t}{T} \frac{1}{T-t}\right] d t+d B(t) \\
&=\frac{b-Y(t)}{T-t} d t+d B(t)
\end{aligned}
$$
