NUS-ECON320 Currency Arbitrage
Last edited: August 8, 2025Let’s import some tools.
import pandas as pd
from scipy.optimize import minimize
import numpy as np
from datetime import datetime
from tqdm import tqdm
import torch
tqdm.pandas()
And load our data:
df = pd.read_csv("./currency_signal.csv", index_col=0, header=None, parse_dates=[0])
df
Let’s rename the headers
df.index.rename("date", True)
df.columns = ["value"]
Awesome. For the rest of the calculations, we will hide the 2020 data from the model:
data = df[df.index < datetime(2020, 1,1)]
data
value
date
2006-03-01 0.000050
2006-03-02 0.001778
2006-03-03 0.000116
2006-03-06 -0.001038
2006-03-07 -0.001197
... ...
2019-12-25 -0.010659
2019-12-26 -0.000869
2019-12-27 0.000075
2019-12-30 0.000033
2019-12-31 0.000944
[3610 rows x 1 columns]
we will add a column of randomness to this, to serve as the seed of our epsilon:
NUS-ECON320 Inter-Temporal Choice
Last edited: August 8, 2025We want to construct a combined agent
\begin{equation} (k_1+k_2)x^{*}(k_1+k_2, \gamma^{*}) = x^{*}(k_1,\gamma_{1})k_1+x^{*}(k_2, \gamma_{2})k_2 \end{equation}
which combines the relative risk of \(\gamma_{1}, \gamma_{2}\) into some new \(\gamma^{*}\), which produces the same combined consumption of both agents \(k_1+k_2\).
Let us create some CAS tools to solve the inter-temporal choice problem generically for 10 steps in the past.
We do this by solving backwards. We will create a variable \(k\) to measure asset, and \(k_{t}\) the remaining asset at time \(t\).
NUS-ECON320 Stochastic Integration
Last edited: August 8, 2025The code created for this problem can be found here.
Problem 1
Let’s begin with a normal function:
\begin{equation} f(x) = (\sqrt{x}-1)^{2} \end{equation}
Taking just a normal Riemann sum, we see that, as expected, it converges to about \(0.167\) by the following values between bounds \([0,1]\) at different \(N\):
| N | Value |
|---|---|
| 10 | 0.23 |
| 100 | 0.172 |
| 1000 | 0.167 |
| 10000 | 0.167 |
| 100000 | 0.167 |
Problem 2
First, as we are implementing a discrete random walk, here’s a fun example; \(p=0.51\), \(\epsilon=0.001\).
NUS-ENG401 Childbirth
Last edited: August 8, 2025The doctor-patient ratio in Haiti is 1 out of 67,000; a combination of malnutrition and malpractice results in a fatality rate of 47%.
In Breath, Eyes, Memory, the high rate of fatalities from birth is included as a part of a proverb in Sophie’s village. Ife tells that, of “three children” conceived by an old woman, “one dies in her body.” (Danticat 118)
Next Steps
Token: s_6285_15
Follow this link for the next step. You maybe able to continue to the next phrase of the game; it is also possible that you may have died during birth and would have to restart.
NUS-ENG401 Death
Last edited: August 8, 2025Apart from Russia, Central Africa and the Caribbeans have the highest average death rates of regions on Earth. Death is a pretty common occurrence, and—it appears—through the vicissitudes of the game you have died.
Better luck next time!
