Skip to content

C / C++

The C ABI hub. A single wickra_exchange.h header + prebuilt library links from C, C++, or any C-capable language. Events are drained through the same pull loop the native bindings use.

bash
# prebuilt wickra_exchange.h + library per platform:
# github.com/wickra-lib/wickra-exchange/releases
c
#include "wickra_exchange.h"

// A recorded tape drives a paper account behind the same pull-based API.
const double tape[] = {100.0, 101.0, 102.0, 110.0, 112.0};
const char *assets[] = {"USDT"};
const double amounts[] = {100000.0};

WickraExchange *ex =
    wickra_replay_new("BTC/USDT", tape, 5, assets, amounts, 1, 1.0, 5.0, 10.0);

char name[32];
wickra_exchange_name(ex, name, sizeof(name));   // "replay"

for (;;) {
    WickraEvent events[8];
    int count = wickra_exchange_poll(ex, events, 8);
    if (count <= 0) break;
    for (int i = 0; i < count; i++) {
        if (events[i].kind == WICKRA_EVENT_TRADE) {
            printf("trade %f\n", events[i].price);
        }
    }
}

wickra_exchange_free(ex);

The header is generated by cbindgen and is the same ABI the C#, Go, Java and R bindings link against.

More