Skip to main content

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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wickra-gym 0.1.0
File Size Uploaded
wickra_gym-0.1.0.tar.gz 71.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for wickra-gym 0.1.0
File
wickra_gym-0.1.0-cp39-abi3-win_arm64.whl CPython 3.9 abi3 Windows ARM64 Details
wickra_gym-0.1.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
wickra_gym-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details
wickra_gym-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details
wickra_gym-0.1.0-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.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
wickra_gym-0.1.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
wickra_gym-0.1.0-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.0.tar.gz

Download URL wickra_gym-0.1.0.tar.gz
Size 71.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d0dd2b304e2a7f56fb8b79bc11811afc65fdacec8acfab2da89d8b36a4971cf1
BLAKE2b-256 checksum
How to use checksums
34238884c878b854a1d34229b918ddac4c9da7b428952625e9e3247bb71d9d55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / wickra_gym-0.1.0-cp39-abi3-win_arm64.whl

Download URL wickra_gym-0.1.0-cp39-abi3-win_arm64.whl
Size 519.7 kB
Tags CPython 3.9 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
355f0bd2715f7e365212931f01afa3a19c28035b9ccd25da88f801acecd71f51
BLAKE2b-256 checksum
How to use checksums
32c0d6d17d489210413a2b99dbe1e34bcf053064086106a0ac7559eba33ff72d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / wickra_gym-0.1.0-cp39-abi3-win_amd64.whl

Download URL wickra_gym-0.1.0-cp39-abi3-win_amd64.whl
Size 593.5 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f665d61b5a555f82113adc7b6f036184b45d32ba2e4a17ba62995f66b3fdec5b
BLAKE2b-256 checksum
How to use checksums
1756ae0826f68fe426126c9e045931e7b2fd9553d37c20f0dd3a8ef1d6fe9da6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / wickra_gym-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL wickra_gym-0.1.0-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
1aaeba895e8423542c65694f32209a43b9a7366561b228a855a567eb927dc060
BLAKE2b-256 checksum
How to use checksums
fb8319f972ce0ec3497afd59793f2cd05fbb1dab941e14afb0d007ce382a4409
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / wickra_gym-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL wickra_gym-0.1.0-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
a02157ba62edb4ae359553fcd62d8bea07519cc0c312b4153f3f8abce24b6ede
BLAKE2b-256 checksum
How to use checksums
6eb751f5d92db105da973004d2e77371d5778cca6bedff45b7a35b22603c6cc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / wickra_gym-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL wickra_gym-0.1.0-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
bb920caa1c56da5e44c486fe4b19515a03f124fe976fe999a0948088ca8908e6
BLAKE2b-256 checksum
How to use checksums
964b7f6ebd2201d95e9e08e83ba65157fcfaeb6d94b25adc4350ebefaf84620b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / wickra_gym-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL wickra_gym-0.1.0-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
ece837bf510e178d5bedd9cf3c8b02143094befd4603fe0f480b52d2bef7b622
BLAKE2b-256 checksum
How to use checksums
34877a597f10b4cc23d7663ad12862b0817a0ea98e7f16380f88ca6c97312fa2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / wickra_gym-0.1.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL wickra_gym-0.1.0-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
3cc8aab48b8c8167d7185eaa1cc4ac48609fbf16c49d71601a48d6df1f1a184a
BLAKE2b-256 checksum
How to use checksums
7a594b32a4cf38fdbe4beb1765a639b0ce11bf0412ea5b6dbb92c8a073cc5dac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / wickra_gym-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL wickra_gym-0.1.0-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
db897f7bd46c758c0700d63ce6eb62c77e9373339f438966a3a4aeb6970dd7ef
BLAKE2b-256 checksum
How to use checksums
257f38cd375ba618b74e7d1a5bf56c17640c0c2733c096c969f4e6bf839d0827
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release history Release notifications | RSS feed

0.1.5

9 release files

0.1.4

9 release files

0.1.3

9 release files

0.1.2

9 release files

0.1.1

9 release files

This release

0.1.0 This release

9 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page