Initial commit: fx_quant_engine and options_quant_engine scaffold

This commit is contained in:
Pramit Dutta
2026-03-30 17:20:45 +05:30
commit bfd32becc7
114 changed files with 4974 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
import numpy as np
import pandas as pd
from fx_quant_engine.models.relative_value import RelativeValueModel
def test_relative_value_model_outputs_hedge_ratio_and_score() -> None:
idx = pd.date_range("2025-01-01", periods=120, freq="B")
base = np.linspace(100, 110, len(idx))
a = pd.Series(base + np.sin(np.arange(len(idx)) * 0.2), index=idx)
b = pd.Series(base * 0.8 + np.cos(np.arange(len(idx)) * 0.2), index=idx)
fa = pd.DataFrame({"momentum_multi_horizon": 0.2, "carry_proxy": 0.01}, index=idx)
fb = pd.DataFrame({"momentum_multi_horizon": -0.1, "carry_proxy": -0.02}, index=idx)
model = RelativeValueModel(lookback=60)
rv = model.generate("USDINR", "EURINR", a, b, fa, fb)
assert 0.0 <= rv.score <= 1.0
assert abs(rv.hedge_ratio) > 0.0
assert rv.long_asset in {"USDINR", "EURINR"}
assert rv.short_asset in {"USDINR", "EURINR"}
assert "hedge_ratio" in rv.drivers