# FxPaul

Math in finance or vice versa

In physics, action is an attribute of system dynamics. By definition it is a functional over trajectory or history of the system:
$S = \int_0^T L\left(q(t),\dot{q}(t),t\right) dt$
where L is the Lagrangian. The real beauty of such description lies in developed and well studied mechanism of equation solutions.

Let’s link it with our trading problem of one security and define profit function in the same way as action:
$S = \int_0^T {L dt} = \int_0^T {q dp} = \int_0^T {q \dot{p} dt}$
where q is price (quote) and p is position, positive is long and negative is short. Therefore, the Lagrangian is:
$L = q \dot{p}$
As we can see it doesn’t depend on time and position itself, therefore, according to Noether’s theorem 2 conservation laws follow:
$\frac{\partial L}{\partial \dot{p}} = q = const$
$H = \dot{q}\frac{\partial L}{\partial \dot{q}} + \dot{p}\frac{\partial L}{\partial \dot{p}} - q \dot{p} = 0$
Ignoring the fact $q = const$ we obtain:
$\dot{p} = 0 \implies p = const$

## Control function

Let’s introduce control function which doesn’t depend on time elapsed:
$\dot{p} = r(q, \dot{q})$
In fact we state that position depends only on current price dynamics. Thus, the Lagrangian becomes:
$L = q \cdot r(q, \dot{q})$
The extremum of action is defined by Lagrange equations:
$\frac{\partial L}{\partial q} - \frac{d}{dt}\frac{\partial L}{\partial \dot{q}} = 0$
As the Lagrangian doesn’t depend on time the equation reduces to:
$\frac{\partial L}{\partial q} = q \frac{dr}{dq} + r(q,t) = 0$

### Time-independent solutions

If we assume that the control function doesn’t depend on time, then under this assumption energy is motion integral of the system:
$E = \dot{q} \frac{dL}{d\dot{q}} - L = \dot{q}\frac{\partial r}{\partial \dot{q}}(q, \dot{q})- q \cdot r(q, \dot{q}) = - E_0$
where $E_0$ is a constant, starting energy. Let’s simplify and say that control function doesn’t depend on price derivative:
$E = -q \cdot r(q) = - E_0$
By definition of control function:
$\dot{p} = r(q) = \frac{E_0}{q}$
$p(0) = 0$
We obtain the following solution
$p(t) = E_0 \int_0^t \frac{d\tau}{q(\tau)}$
In fact it is unsatisfactory solution as it is a continuous buying of the security, non-bounded at all.

In case if price change speed is taken into account, partial derivative equation becomes:
$\dot{q}\frac{\partial r}{\partial \dot{q}}(q, \dot{q})- q \cdot r(q, \dot{q}) + E_0 = 0$
And it has generic solution:
$r(q, \dot{q}) = \frac{E_0}{q}+\dot{q}^q \cdot F(q)$
where $F(q)$ is an arbitrary function of q. And this solution is in complex plane in general, thus contradicting the initial setup.

### Further ideas

It seems that continuous approach to the task is not productive. So, in next articles I’ll try to follow discrete formulation of the task.