Skip to content

Java ​

Java bindings for wickra-gym — a deterministic, Gymnasium-compatible backtest environment — over the C ABI using the Foreign Function & Memory API (FFM / Project Panama). A rollout is byte-identical to every other language binding.

xml
<dependency>
  <groupId>org.wickra</groupId>
  <artifactId>wickra-gym</artifactId>
  <version>0.2.0</version>
</dependency>
java
import org.wickra.gym.Env;

String spec = """
    {"dataset_ref":"demo","symbol":"BTCUSDT",
     "observation":{"features":[{"kind":"price","field":"close"}]},
     "action_space":{"type":"discrete","n":3},
     "reward":"pnl","episode":{"max_steps":256,"warmup":0}}
    """;

try (Env env = new Env(spec)) {
    // Build a candles JSON array and load it.
    env.command("{\"cmd\":\"load\",\"candles\":[/* ... */]}");
    String reset = env.command("{\"cmd\":\"reset\",\"seed\":0}");
    String step = env.command("{\"cmd\":\"step\",\"action\":2}");
    System.out.println(step);
}

More ​

Updated: