You have N assets with end-of-day prices over T trading days. Let prices[i][t] be the closing price of asset i on day t (i = 0..N−1, t = 0..T−1). You start with total capital C in cash at the close of day 0. Fractional shares and zero transaction costs are allowed.
At each day t ≥ 1:
Let V_t denote portfolio value at the close of day t. The daily log return for period t→t+1 is ln(V_{t+1}/V_t). Note:
Task: Compute and return [mean_log_return, stddev_log_return] over all T−1 daily log returns L_t = ln(V_{t+1}/V_t), for t = 0..T−2.
Assume prices are positive. If T < 2, return [0.0, 0.0].
Login required