Wickra Gym — Python
A deterministic, Gymnasium-compatible backtest
environment. The whole candle dataset is precomputed once into a fixed feature
tensor, so each step() is a constant-time array index — and the same spec,
data, seed and actions produce a byte-identical trajectory across every language
binding.
Install
pip install wickra-gym # RawEnv (no Gymnasium dependency)
pip install "wickra-gym[gym]" # + the gymnasium.Env subclass
Use as a Gymnasium environment
import numpy as np
from wickra_gym import WickraGymEnv
spec = """{
"dataset_ref": "demo", "symbol": "BTCUSDT",
"observation": {"features": [
{"kind": "price", "field": "close"},
{"kind": "indicator", "name": "Rsi", "params": [14]}
]},
"action_space": {"type": "discrete", "n": 3},
"reward": "pnl",
"episode": {"max_steps": 256, "warmup": 14}
}"""
candles = [
{"ts": i, "open": 100 + i, "high": 100 + i, "low": 100 + i, "close": 100 + i}
for i in range(300)
]
env = WickraGymEnv(spec, candles)
obs, info = env.reset(seed=0)
done = False
while not done:
action = env.action_space.sample()
obs, reward, terminated, truncated, info = env.step(action)
done = terminated or truncated
The observation and action spaces are derived from the spec: unbounded
observation columns use ±np.inf; a discrete action space becomes
spaces.Discrete(n) and a continuous one becomes a 1-D spaces.Box.
Register it under a Gymnasium id:
from wickra_gym import register
register() # WickraGym-v0
The raw command surface
RawEnv is the thin, dependency-free wrapper over the native command JSON
surface — the same boundary every language binding forwards verbatim:
import json
from wickra_gym import RawEnv
env = RawEnv(spec)
env.command(json.dumps({"cmd": "load", "candles": candles}))
reset = json.loads(env.command(json.dumps({"cmd": "reset", "seed": 0})))
step = json.loads(env.command(json.dumps({"cmd": "step", "action": 2})))
Commands: load, reset, step, spec, version. Domain errors come back as
{"ok": false, "error": ...}; a bad spec raises ValueError at construction.
License
Dual-licensed under MIT or Apache-2.0, at your option.
Release files for wickra-gym 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wickra_gym-0.1.2.tar.gz | 71.3 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| wickra_gym-0.1.2-cp39-abi3-win_arm64.whl | CPython 3.9 | abi3 | Windows ARM64 | Details |
| wickra_gym-0.1.2-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| wickra_gym-0.1.2-cp39-abi3-musllinux_1_2_x86_64.whl | CPython 3.9 | abi3 | Linux musl 1.2+ x86-64 | Details |
| wickra_gym-0.1.2-cp39-abi3-musllinux_1_2_aarch64.whl | CPython 3.9 | abi3 | Linux musl 1.2+ ARM64 | Details |
| wickra_gym-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| wickra_gym-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| wickra_gym-0.1.2-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
| wickra_gym-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl | CPython 3.9 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 5.6 MB
Release files / wickra_gym-0.1.2.tar.gz
| Download URL | wickra_gym-0.1.2.tar.gz |
|---|---|
| Size | 71.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
24e64322c7f487e1848f4f40e41e0dfd7e376dbe988b1baa935bc9cbb12bcaf0
|
|
BLAKE2b-256 checksum How to use checksums |
f86d63bfe997d68489ec795242c7ac1421708d262da07d39efc73259287bb3ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_gym-0.1.2-cp39-abi3-win_arm64.whl
| Download URL | wickra_gym-0.1.2-cp39-abi3-win_arm64.whl |
|---|---|
| Size | 519.7 kB |
| Tags | CPython 3.9 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
5366a7b81b1f0adc89994d8f25416f4c90956b122dd89a1d7417abb6ef676cf4
|
|
BLAKE2b-256 checksum How to use checksums |
f8ed96a669b88a17df14f64d03f87f32c8a19ca2b6c163a9d97886da22638ee5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_gym-0.1.2-cp39-abi3-win_amd64.whl
| Download URL | wickra_gym-0.1.2-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 593.4 kB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4dce44973ffdce5e7bda150442bff5fdbc1f0791734311077fea9bcc84b95b99
|
|
BLAKE2b-256 checksum How to use checksums |
664928753127583a77eb9900f9a65a2f47e430eed800ce59d25da625063e3077
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_gym-0.1.2-cp39-abi3-musllinux_1_2_x86_64.whl
| Download URL | wickra_gym-0.1.2-cp39-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 933.4 kB |
| Tags | CPython 3.9 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a61efbf364ff113d36348814a2deb9429a63598a1919228fb795108e21148690
|
|
BLAKE2b-256 checksum How to use checksums |
21e6c3b1be4a8577a13261dfe871944b8d1ac0c07b619ae36dbbed186c40d445
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_gym-0.1.2-cp39-abi3-musllinux_1_2_aarch64.whl
| Download URL | wickra_gym-0.1.2-cp39-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 821.5 kB |
| Tags | CPython 3.9 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
51a2a494276ec4c06be53ddf2ad4f3f933482ecd6cea84b3683303ce4c504fed
|
|
BLAKE2b-256 checksum How to use checksums |
afd35ecdb172d8e3d7fc81b4322d4fca985f5344e7ca1c26e28f69592d2206ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_gym-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | wickra_gym-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 717.0 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
94df21ac90966b0ad417014b07c37d2bbe6d97c9732de9da896e25da6ce93ad4
|
|
BLAKE2b-256 checksum How to use checksums |
c684f70d1a3db27b8e4923ec3afb0182f39bd33c7ddaff198db2fae381c4e19f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_gym-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | wickra_gym-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 643.4 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
e8e10346da4ae3a431503fe0cd0d11e71778ba05610bd4cb434cde084855e9ed
|
|
BLAKE2b-256 checksum How to use checksums |
171d135f217f7f59741982d50f34bd22daa8ede1f66904e8d21d70e0d9235843
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_gym-0.1.2-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | wickra_gym-0.1.2-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 589.6 kB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
30dc2cdd9e2ee1ed08b0ea71a80eaaf5bf9e2daf28d711f500c6d507ec21f511
|
|
BLAKE2b-256 checksum How to use checksums |
3a0c412e143b06c3bf54033dd908f9b6d3d526926008a953d3d3162f734977a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_gym-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | wickra_gym-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 682.8 kB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
daa748fdc281e405ef403ef5cec7b1ba75e7fa5a982516b629d657f42bc0cdc6
|
|
BLAKE2b-256 checksum How to use checksums |
ae204d640c3a30f7604e8cb4e59fd8708c4e3d68ee8785f52a50c1ef3b72b676
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|