mirror of
https://github.com/QuantEngines/fx_quant_engine.git
synced 2026-08-05 06:47:44 +00:00
Initial commit: fx_quant_engine and options_quant_engine scaffold
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user