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.1
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.1.tar.gz | 71.3 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| wickra_gym-0.1.1-cp39-abi3-win_arm64.whl | CPython 3.9 | abi3 | Windows ARM64 | Details |
| wickra_gym-0.1.1-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| wickra_gym-0.1.1-cp39-abi3-musllinux_1_2_x86_64.whl | CPython 3.9 | abi3 | Linux musl 1.2+ x86-64 | Details |
| wickra_gym-0.1.1-cp39-abi3-musllinux_1_2_aarch64.whl | CPython 3.9 | abi3 | Linux musl 1.2+ ARM64 | Details |
| wickra_gym-0.1.1-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.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| wickra_gym-0.1.1-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
| wickra_gym-0.1.1-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.1.tar.gz
| Download URL | wickra_gym-0.1.1.tar.gz |
|---|---|
| Size | 71.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6608874b56af58e369be6b85d024ff753a8e0abfa4160ef387a1e7a150442a4
|
|
BLAKE2b-256 checksum How to use checksums |
07e72996033269fcb241bf939575b4a391413994d224a1fcc72dd3e397905e21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_gym-0.1.1-cp39-abi3-win_arm64.whl
| Download URL | wickra_gym-0.1.1-cp39-abi3-win_arm64.whl |
|---|---|
| Size | 519.7 kB |
| Tags | CPython 3.9 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
09a310fd0c7bc2d4c385b0e67cbc12629a4eeac12ad2bc7b9bd860f39e554043
|
|
BLAKE2b-256 checksum How to use checksums |
16dc45237751dc84bb40c199dae6d34d55ab7698f41a08233553da689a583c81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_gym-0.1.1-cp39-abi3-win_amd64.whl
| Download URL | wickra_gym-0.1.1-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 593.5 kB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
0b71a32b5311db8bf1fbdc1f58f4d2bf5bba2757eaaa4ad451193cb6c690fb5e
|
|
BLAKE2b-256 checksum How to use checksums |
e443400d07ac126139ddb467d096bf292699134012cbc12f60dddea649c05c80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_gym-0.1.1-cp39-abi3-musllinux_1_2_x86_64.whl
| Download URL | wickra_gym-0.1.1-cp39-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 933.3 kB |
| Tags | CPython 3.9 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
1fa211c962ec47f89a961d14fe8ba5ba2f010668f1664bbad33b99ceebdad8da
|
|
BLAKE2b-256 checksum How to use checksums |
471f56bef47fe722ffdd8623501f6c027825aab54f6ffc909b6a567e949b4a44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_gym-0.1.1-cp39-abi3-musllinux_1_2_aarch64.whl
| Download URL | wickra_gym-0.1.1-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 |
ded7155d4b383d4182ef4e8f72445511c76a3c5c62793baed123a823dbbcedcb
|
|
BLAKE2b-256 checksum How to use checksums |
1a998fad859caa09be1f131bddd04c3383b49299a33fba149a0153a91841399f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_gym-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | wickra_gym-0.1.1-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 |
56ac34c87ab8d84ed82f8850679e8a6203e17d5b3deb5c603b11cb60e5f2f1dc
|
|
BLAKE2b-256 checksum How to use checksums |
dbd03660620851a0da06308766132b962e3b7c1a34b83ae5c63eb76ea292a89a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_gym-0.1.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | wickra_gym-0.1.1-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 |
e1890dc658bc0324f93518aa29dbe27caf0b6ee3babd920fac72ba02e95f3d77
|
|
BLAKE2b-256 checksum How to use checksums |
4038582fb3df2db256fc0190513d7994ddadfcbfd4f6a6e63f873e948ed87fac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_gym-0.1.1-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | wickra_gym-0.1.1-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 |
42877277b0b612af244ac77ae5a1f9874ef4befa106b7ac202d9edf46b27df66
|
|
BLAKE2b-256 checksum How to use checksums |
3e0d51693639fa667c5a2d0caa14a8aad2b2cf13b89f13d0d516cc922c0532e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_gym-0.1.1-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | wickra_gym-0.1.1-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 |
160cf3fd15998d4991b1fe7f3e6135020fb5a5d2b24642b9d26ed60b458add3a
|
|
BLAKE2b-256 checksum How to use checksums |
8bed2f00eee3639d3b49eacfac46592d07f80b917893b12ff2d51acf27c301cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|