KoNananachan
OpenPoly
Pythonโœจ New

openPoly by KoNananachan: open, news-driven, on-chain-verifiable live trading for Polymarket.

Last updated Jul 3, 2026
33
Stars
12
Forks
0
Issues
0
Stars/day
Attention Score
74
Language breakdown
Python 68.8%
TypeScript 30.7%
Shell 0.2%
CSS 0.2%
JavaScript 0.1%
HTML 0.0%
โ–ธ Files click to expand
README

openPoly

openPoly

Open, news-driven, on-chain-verifiable live trading for Polymarket.

Live demo MIT Python 3.12 Node >= 20 Paper mode by default
Powered by TradingNews API Powered by Polymarket API

Public release, deployment, and maintenance by KoNananachan.

Experimental live-trading system for Polymarket prediction markets. A single-process Python backend drives an event-driven strategy pipeline; a React Flow canvas lets you wire that pipeline up and tune it visually.

โš ๏ธ openPoly can place real orders with real money. It defaults to **paper
mode** and never touches funds until you explicitly switch to live. Prediction
markets are high risk and restricted in many jurisdictions. Read the
DISCLAIMER before going anywhere near live mode.

See the demo first (no backend, no setup)

openPoly strategy canvas โ€” the live-section pipeline with a node's config panel open

โ–ถ Live demo: โ€” the real frontend with mock data, running entirely in your browser. Click and look around; nothing connects to a backend and no funds are involved. All numbers, positions, and news are mock data; clicking a live action (Run/Pause, save keys, โ€ฆ) just pops a "demo mode" notice โ€” nothing real happens. For the full thing with a live paper-trading backend, use the Quickstart below.

What it is

openPoly trades one strategy at a time at grain-scale capital ($5โ€“$50), built to iterate fast and validate signal alpha on real markets. The strategy decision logic is atomized into pluggable "sections" โ€” typed, swappable modules (news source, market source, embedding, analyzer, entry, exit, โ€ฆ) that you can reconfigure on the canvas without touching the framework.

It is a deliberately single system: one process, one pipeline, one SQLite file โ€” zero infra to stand up. See docs/architecture/ for the design.

| Layer | Choice | |---|---| | Backend | Python + FastAPI, single process | | Storage | SQLite (single writer) | | Polymarket SDK | py-clob-client | | Frontend | React + React Flow (strategy canvas) |

Built on external APIs. openPoly is a thin orchestration layer over two
third-party services: news signals come from the TradingNews API, and all
market data and order placement go through the official Polymarket API
(via py-clob-client). It
ships no proprietary data or matching of its own โ€” you bring credentials for
each service (see .env.example) and openPoly wires them into the pipeline.

Features

  • Visual strategy canvas โ€” wire up and tune the whole decision pipeline on a
React Flow canvas. Each node is a section; edit its config inline, no redeploy.
  • Pluggable typed sections โ€” the decision logic is atomized into swappable
modules (news source, market source, embedding, analyzer, entry, exit, database). Each has a Pydantic Config, so its params are a single source of truth shared by backend and canvas.
  • Event-driven, single process โ€” one FastAPI process drives the pipeline; the
runtime owns scheduling, capability injection, audit, and timeouts.
  • Paper mode by default โ€” runs against real markets with no funds at risk;
live order placement is an explicit, deliberate opt-in.
  • Live activity monitoring โ€” equity curve, open positions, and the incoming
news feed update as the strategy runs.
  • Zero hardcoded secrets โ€” every credential resolves via *_ref indirection
(env: / local: / keychain); nothing sensitive lives in the repo.
  • Zero infra โ€” a single Python process and one SQLite file. Nothing to stand
up, nothing to orchestrate.

Early results โ€” a first read on the signal

openPoly has run live, on real money on Polymarket (Polygon mainnet) at grain scale ($1โ€“$10 per entry). One window โ€” 25 positions over ~6 days โ€” is a tiny sample, but it already says something useful about where the edge lives.

Equity curve โ€” realized + unrealized, marked to bid

| Live window ยท 2026-05-25 โ†’ 05-31 | Result | |---|---| | Realized return on notional, net of fees | +5.2% | | Mark-to-market return (snapshot) | +6.7% | | Closed win rate | 62% (13 / 21) | | Live fills / distinct positions | 46 / 25 | | Entry notional deployed | $229.42 | | On-chain settlement | 39 / 40 receipts 0x1 |

Every entry (25/25) was triggered by an incoming news item โ€” openPoly never trades on price alone. And after those news-triggered entries, **23 of 25 positions moved in the trade's favor** before exit, several sharply (post-entry peaks of +67%, +80%, +142%, +161% against entry price). The news, in other words, tended to arrive ahead of the market repricing. That is where the edge appears to live โ€” in the news signal itself (streamed in via the TradingNews API), not in anything clever downstream.

The realized number is deliberately modest next to those peaks, and that gap is the honest takeaway: the signal found the move; the exit logic gave most of it back (one position peaked +161% but booked +$1.68; another ran +142% then stopped out at โˆ’$2.90). Closed win rate was 13/21.

A tiny, early sample (n=25) on grain-scale capital โ€” suggestive of a real
directional edge, not a proven or repeatable return. Past results say nothing
about the future, and openPoly is not investment advice. Read the
DISCLAIMER before going near live mode.

How a trade gets decided

news_source โ†’ embedding โ†’ analyzer โ†’ entry โ†’ exit, each a swappable section: a news item arrives, the embedding narrows it to the markets it actually moves, the analyzer scores the directional signal, entry fires only past an edge threshold, and exit manages the position (take-profit / trailing-stop / stop-loss).

Where it improves next

The data points the work at exits and sizing, not the signal:

  • Let winners run โ€” trailing/stop exits surrendered large post-entry peaks;
conviction-scaled holds would keep more of the move the signal already found.
  • Size by conviction โ€” flat ~$5โ€“10 sizing treats a +161% setup like a coin
flip; weighting by analyzer confidence concentrates capital on the strongest signals.
  • Tighter entries โ€” a few stop-losses fired on positions that peaked sharply
in their favor first; better entry timing and slippage control would convert more of those into wins.

Strategy changelog

The strategy is a living thing โ€” entry gates, exit thresholds, and risk brakes have all changed as paper and live data came in, and each change is recorded with its reasoning (including the ideas that were considered and rejected). See CHANGELOG.md for the full decision-by-decision history.

Quickstart (paper mode, same machine)

Prerequisites: uv (Python toolchain) and Node.js + yarn.

# 1. Backend โ€” binds 127.0.0.1:8000, paper mode by default
uv run uvicorn openpoly.api.main:app

2. Frontend โ€” in another terminal, proxies to the local backend on :8000

cd frontend && yarn install && yarn dev

Open the Vite URL it prints and the strategy canvas loads. No environment variables, no funds, no live orders โ€” paper mode is the default. To configure secrets for later, copy .env.example to .env (gitignored) and fill it in.

Trading live from a Polymarket-geoblocked region? Order placement is region -blocked there, so the backend has to run from an allowed region while the frontend stays local. See docs/deploy/.

Repo layout

openpoly/                Python backend
โ”œโ”€โ”€ sections/            โ† pluggable strategy sections (the main extension point)
โ”‚   โ”œโ”€โ”€ _base.py         ยท   section contract / registry / contract-test (framework โ€” edit with care)
โ”‚   โ”œโ”€โ”€ entry/ exit/     ยท   trade-decision sections
โ”‚   โ”œโ”€โ”€ analyzer/        ยท   signal analysis (e.g. LLM)
โ”‚   โ”œโ”€โ”€ embedding/       ยท   text โ†’ vector
โ”‚   โ”œโ”€โ”€ news_source/     ยท   โ† section impl (โ‰  openpoly/news/)
โ”‚   โ”œโ”€โ”€ market_source/   ยท   โ† section impl (โ‰  openpoly/markets/)
โ”‚   โ””โ”€โ”€ database/        ยท   โ† section impl (โ‰  openpoly/db/)
โ”œโ”€โ”€ user_sections/       โ† drop your own section impls here (gitignored, runs locally)
โ”œโ”€โ”€ api/                 FastAPI routes
โ”œโ”€โ”€ db/                  SQLite engine + stores      (โ‰  sections/database/)
โ”œโ”€โ”€ news/  markets/      domain logic                (โ‰  sections/*_source/)
โ”œโ”€โ”€ execution/ wallet/   order dispatch + signing
โ”œโ”€โ”€ portfolio/ runtime/  position store + orchestrator/monitors
โ”œโ”€โ”€ llm/  embedding/     LLM client + embedding model
frontend/src/sections/   canvas UI, mirrors openpoly/sections/ by name
docs/architecture/       design decisions
docs/deploy/             deployment models (default same-machine + geoblock split)
tests/                   pytest suite

Two naming gotchas worth internalizing: openpoly/db/ (the SQLite engine) is not sections/database/ (a swappable database section), and openpoly/news/ ยท markets/ (domain logic) are not sections/newssource/ ยท marketsource/ (section impls).

Extending it

Strategy work happens in sections. To add your own, drop a class implementing the section contract (SECTIONTYPE, SECTIONVERSION, REQUIRES, Config, run) into openpoly/user_sections/ โ€” the registry discovers it at startup. That directory is gitignored, so your private strategies stay local. Full contract: docs/architecture/02-strategy-sections.md.

Ethos

  • MIT licensed โ€” open source is a mindset, not a future milestone.
  • Published and maintained by KoNananachan โ€” this public repo is the canonical
openPoly release.
  • Default paper mode โ€” live trading requires explicit opt-in.
  • Zero hardcoded secrets โ€” everything via *_ref indirection (env / keychain).
  • Cross-platform โ€” Linux / macOS first.

License

MIT ยฉ 2026 KoNananachan and openPoly contributors. No warranty โ€” see DISCLAIMER.

๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท KoNananachan/OpenPoly ยท Updated daily from GitHub