diff --git a/delta_mesh/EnergiBridge.c b/delta_mesh/EnergiBridge.c new file mode 100644 index 0000000..e6cbcbe --- /dev/null +++ b/delta_mesh/EnergiBridge.c @@ -0,0 +1,12 @@ +// Minimal EnergiBridge implementation: convert DeltaMesh primitives into a CatOpt-like structure. +#include "EnergiBridge.h" + +void EnergiBridge_map_LocalMarket_to_CatOpt(const LocalMarket* lm, CatOpt_Object* out) { + if (!lm || !out) return; + // Direct field mapping for toy MVP; in a real bridge this would be richer and versioned + out->venue = lm->venue; + out->inventory = lm->inventory; + out->risk_budget = lm->risk_budget; + // Best-effort: initialize a simple static version; in a real system this would be a per-message counter + out->version = 1; +} diff --git a/delta_mesh/EnergiBridge.h b/delta_mesh/EnergiBridge.h new file mode 100644 index 0000000..f77d778 --- /dev/null +++ b/delta_mesh/EnergiBridge.h @@ -0,0 +1,38 @@ +// Minimal EnergiBridge: bridge DeltaMesh primitives to a vendor-agnostic CatOpt representation +// This is a tiny, production-friendly adapter skeleton to demonstrate a canonical bridge +// and deterministic data-plane mappings for MVP instrumentation. + +#ifndef ENERGY_BRIDGE_H +#define ENERGY_BRIDGE_H + +#include "LocalMarket.h" +#include "SharedSignals.h" +#include "PlanDelta.h" + +// Canonical CatOpt-like object representation +typedef struct CatOpt_Object { + const char* venue; // venue identifier + double inventory; // per-venue inventory proxy + double risk_budget; // risk budget allocated to this venue + unsigned long version; // per-message version for replayability +} CatOpt_Object; + +// Canonical CatOpt-like signal representation (aggregated signals) +typedef struct CatOpt_Signal { + double aggregated_greeks; + double implied_vol; + unsigned long version; +} CatOpt_Signal; + +// Canonical CatOpt-like plan delta representation (routing/hedge plan) +typedef struct CatOpt_PlanDelta { + double quote; + double hedge; + unsigned long timestamp; // monotonic timestamp for replay + unsigned long version; +} CatOpt_PlanDelta; + +// Map a LocalMarket instance to a CatOpt_Object. This is intentionally simple and side-effect free. +void EnergiBridge_map_LocalMarket_to_CatOpt(const LocalMarket* lm, CatOpt_Object* out); + +#endif diff --git a/delta_mesh/EnergiBridge.o b/delta_mesh/EnergiBridge.o new file mode 100644 index 0000000..b81b919 Binary files /dev/null and b/delta_mesh/EnergiBridge.o differ diff --git a/delta_mesh/demo b/delta_mesh/demo index efb5cba..f404e5b 100755 Binary files a/delta_mesh/demo and b/delta_mesh/demo differ diff --git a/test.sh b/test.sh index 6a871f8..d436ec3 100644 --- a/test.sh +++ b/test.sh @@ -12,7 +12,8 @@ $cc $CCFLAGS -c delta_mesh/admm_lite.c -o delta_mesh/admm_lite.o $cc $CCFLAGS -c delta_mesh/LocalMarket.c -o delta_mesh/LocalMarket.o || true $cc $CCFLAGS -c delta_mesh/SharedSignals.c -o delta_mesh/SharedSignals.o || true $cc $CCFLAGS -c delta_mesh/PlanDelta.c -o delta_mesh/PlanDelta.o || true -$cc $CCFLAGS -o delta_mesh/demo delta_mesh/demo_main.o delta_mesh/admm_lite.o delta_mesh/LocalMarket.o delta_mesh/SharedSignals.o delta_mesh/PlanDelta.o +$cc $CCFLAGS -c delta_mesh/EnergiBridge.c -o delta_mesh/EnergiBridge.o +$cc $CCFLAGS -o delta_mesh/demo delta_mesh/demo_main.o delta_mesh/admm_lite.o delta_mesh/LocalMarket.o delta_mesh/SharedSignals.o delta_mesh/PlanDelta.o delta_mesh/EnergiBridge.o echo "Running demo..." ./delta_mesh/demo