DEV Community

Emil Nielsen
Emil Nielsen

Posted on

Building a No-Code Trading Bot Builder for Prediction Markets (Raven)

Today I worked on Raven, a no-code trading bot builder for prediction markets. The goal is to improve usability, fix some bugs in the beta system, and experiment with a new strategy creation experience.

Raven is inspired by tools like n8n, but instead of automating APIs, it lets users visually design and deploy trading strategies for platforms like Polymarket.


Why Raven Exists

Right now, creating a trading strategy in Raven requires connecting multiple nodes visually.

While powerful, this approach can feel overwhelming for new users:

  • You must understand how nodes interact
  • You essentially "program visually"
  • Even simple strategies require multiple components

This is great for advanced users, but not ideal for beginners.

So the question became:

How do we keep the power of a node-based system while making it more accessible?


Introducing a Strategy Creation Wizard

To solve this, I’m working on a step-by-step strategy creation wizard.

Instead of starting with a blank canvas full of nodes, users go through guided steps:

Step 1: Select Venue

Choose where to trade:

  • Polymarket (and potentially others later)

Step 2: Market Scope

Define what kind of market strategy you want:

  • Single market
  • Event-based selection
  • Recurring series

Step 3: Market Selection

Users choose or paste a market (e.g. Polymarket URL), and the system extracts relevant options automatically.

This is one of the harder UX problems today, so simplifying input here is a big focus.

Step 4: Entry Strategy

This is where the actual trading logic is defined.

Users can select templates like:

  • Crossover strategy
  • Mean reversion
  • Market making
  • Custom strategy

And configure parameters like:

  • Position size
  • EMA periods
  • Price offsets

Step 5: Exit & Risk Management

Users define how trades close:

  • Exit on reverse signal
  • Exit on target conditions
  • Max hold time
  • Stop-loss / take-profit rules

We also introduce lifecycle hooks, such as:

  • Order filled
  • Order partially filled
  • Order failed or rejected
  • Timeout events

These allow post-trade automation like hedging or follow-up actions.


The Final Idea: From Wizard → Canvas

After completing the wizard:

  • A full strategy is generated automatically
  • It is converted into a node-based canvas
  • Users can still fine-tune everything manually

This keeps both worlds:

  • Beginner-friendly onboarding
  • Advanced flexibility for power users

Current Engineering Work

While building this, I also worked on several backend issues:

1. Stalled Bots Problem

Some bots:

  • Remain marked as “running”
  • But stop producing updates
  • Or lose WebSocket state

This required debugging heartbeat tracking and event queue behavior.

A possible improvement:

  • Auto-detect stalled bots
  • Restart or mark them as failed after a timeout window

2. S3 Session Loading Bug

I investigated an issue where:

  • A bot session shows as running
  • But loading historical data from S3 fails or returns incorrect state

This pointed to inconsistencies between:

  • Live session state
  • Archived session storage

3. P&L Calculation Issues

Another important bug:

  • Some users had incorrect leaderboard balances
  • P&L was not always consistent with closed trades

The system should compute:

P&L = sum(all closed trades in session)

But some cases still relied on snapshots instead of full recomputation.

This is being fixed by validating:

  • Trade history integrity
  • Session carry-over logic between bots in a season
  • Leaderboard correctness

Idea: Telegram Bot Monitoring

One interesting idea that came up:

Instead of only using the web UI, users could:

  • Monitor bots via Telegram
  • Start/stop bots remotely
  • Get status updates and alerts

The UI would still be used for building strategies, but Telegram becomes a lightweight control layer.


Real Trading vs Simulation

One major observation:

Simulation differs from real execution in one key way:

  • Simulation fills are instant
  • Real markets (e.g. Polymarket) have delays of seconds

That delay affects:

  • Stop-loss behavior
  • Take-profit accuracy
  • Market timing strategies

This is unavoidable and part of real-world trading systems.


Testing a Polymarket Bot Strategy

I also tested a simple strategy setup involving:

  • Market selection
  • Signal comparison
  • Entry condition triggers

Goal: verify that signals behave consistently across live execution.


Relevant Resources

Here are some useful references if you’re interested in similar systems:


Closing Thoughts

Raven is still in beta, and a lot of the current work is about:

  • Reducing friction for new users
  • Stabilizing long-running bots
  • Improving correctness of financial state (P&L, leaderboards)
  • Making strategy design more intuitive

The long-term goal is simple:

Make building and testing trading strategies as easy as dragging nodes and answering a few structured questions.

Top comments (0)