from fxhnt.adapters.warehouse.duckdb_feature_store import DuckDbFeatureStore


def test_crypto_funding_panel_reads_funding_feature(tmp_path):
    st = DuckDbFeatureStore(str(tmp_path / "w.duckdb"))
    st.write_features("BTCUSDT", [(86400, {"funding": 0.0003}), (172800, {"funding": -0.0001})])
    st.write_features("ETHUSDT", [(86400, {"funding": 0.0005})])
    st.write_features("BTCUSDT", [(86400, {"close": 100.0})])     # close must NOT leak into funding panel
    p = st.crypto_funding_panel()
    assert p["BTCUSDT"] == {1: 0.0003, 2: -0.0001}                # ts//86400 = epoch_day
    assert p["ETHUSDT"] == {1: 0.0005}
