PaperEx (PaperEx v0.8.0)

Copy Markdown View Source

Generic, exchange-agnostic paper-trading and simulated-execution engine for Elixir.

PaperEx is a pure functional core: plain structs and state transitions for portfolios, positions, orders, and execution attempts. There is no HTTP, no WebSocket, no database, and no exchange dependency. Consumers persist state however they like and connect their own market data through an adapter behaviour.

What's here

Two simulation modes — design constraint

The package was extracted from a Polymarket prediction-market trading bot that ran two paper layers on purpose:

  1. Research / idea simulation. Idealized fills, simplified exits. Answers "was the signal directionally good?".
  2. Live-mirror simulation. Realistic execution constraints — entry caps, slippage, GTC pending lifecycle, missed fills, skipped attempts. Answers "what would live execution have done?".

The engine keeps these modes separable through configuration, not separate code paths (see PaperEx.Engine). It shows up in PaperEx.Execution: :filled, :missed, :skipped, :pending, :cancelled, and :closed are peer status values, so a missed fill is recorded with the same first-class shape as a successful fill rather than being absorbed into "no trade".

Out of scope

PaperEx is not a complete trading platform. It does not own exchange specifics (Polymarket token/condition IDs, Gamma, CLOB, and RTDS live in polymarket_sdk), HTTP/WebSocket clients, Ecto schemas, Phoenix, or strategy rules. A ready-made Polymarket adapter lives in the paper_ex_polymarket package.

Summary

Functions

Returns the package version, read from the loaded application spec (so it always tracks mix.exs).

Functions

version()

@spec version() :: String.t()

Returns the package version, read from the loaded application spec (so it always tracks mix.exs).