γGAMMABOTS

What Is GammaScript?

GammaScript is the language used to define trading strategies on Gammabots.

A GammaScript strategy describes when a bot should buy, sell, wait, exit, or shut down, based on market conditions and the bot's current state.

It is designed to be:

Every strategy on Gammabots runs using GammaScript.


What GammaScript Does

At a high level, a GammaScript strategy is a set of rules.

Each rule consists of:

  • a condition (when this rule applies)
  • one or more actions (what the bot should do)

On every evaluation cycle, the bot:

  1. checks each rule in order
  2. finds the first rule whose condition is true
  3. executes that rule's actions
  4. stops

Only one rule can execute per cycle.


Conditions

Conditions are logical expressions that determine when a rule applies.

They compare market data and bot state using:

  • numeric comparisons (>, <, >=, <=, ==, !=)
  • arithmetic (+, -, *, /)
  • logical AND (&&)

Conditions can reference values such as:

  • current price
  • price history and moving averages
  • volatility and momentum indicators
  • how long it's been since the last trade or buy
  • how many buys or sells have occurred
  • whether the bot is currently holding tokens

Conditions are evaluated continuously as market data updates.

GammaScript does not support or. Instead, rules are evaluated sequentially, and rule ordering is used to express branching or fallback logic.


Actions

Actions describe what the bot should do when a condition is met.

Supported actions include:

  • buy
    Enters a position using the bot's available ETH.
  • sell
    Sells a portion of the bot's current token position, subject to strategy-defined constraints.
  • liquidate
    Sells the entire token position without slippage constraints, exiting the position as quickly as possible. This is typically used to exit immediately.
  • deactivate
    Shuts down the bot and returns funds to the user. After deactivation, the bot becomes inactive and no longer trades.
  • skip
    Intentionally does nothing for this evaluation cycle.
  • reset
    Resets the bot's internal state after a sell trade, effectively starting the strategy over from the beginning.

Bots cannot perform any action outside this list.

This restriction is intentional — it keeps strategies predictable and safe.


Strategy Execution

GammaScript strategies are executed by the Gammabots engine.

Important properties of execution:

  • rules are evaluated in order
  • only the first matching rule executes
  • actions run atomically within a cycle
  • safeguards prevent repeated or conflicting actions

If no rule matches, the bot waits and re-evaluates on the next cycle.


Strategy Variables

GammaScript exposes a fixed set of variables that represent:

  • market prices
  • technical indicators
  • time since events
  • bot state (buys, sells, position size, profitability)

To keep strategies compact and efficient, variables are represented internally using short identifiers.

In the UI and Strategy Builder, these variables are displayed using human-readable names and labels.

You do not need to memorize variable codes unless you are writing GammaScript directly.


Writing vs Building Strategies

You can create GammaScript strategies in two ways.

Writing GammaScript Directly

Advanced users can write strategies directly using GammaScript syntax.

This offers:

  • maximum flexibility
  • precise control over rule ordering
  • full access to all supported variables and operators

All strategies are validated before being accepted to ensure they are safe and well-formed.

Using the Strategy Builder

Most users will use the Strategy Builder.

The builder:

  • generates valid GammaScript automatically
  • prevents invalid conditions or actions
  • makes strategies easier to reason about visually

Under the hood, the builder still produces GammaScript — you're just not required to write it yourself.


Strategies as NFTs

Every GammaScript strategy is minted as a Strategy NFT.

Key properties:

  • strategies are immutable
  • the logic cannot be changed once created
  • every bot using a strategy runs the exact same code

If you want to modify a strategy:

  • clone it
  • make changes
  • mint a new strategy NFT

This ensures transparency, trust, and reproducibility across all bots.


Why GammaScript Exists

GammaScript exists to strike a balance between:

  • expressiveness
  • safety
  • transparency

It is powerful enough to express sophisticated trading logic, while remaining constrained enough to:

  • prevent unexpected behavior
  • make strategies inspectable
  • ensure fair and consistent execution

GammaScript is what makes Gammabots predictable, composable, and trustworthy.


If you want to see how GammaScript strategies are used in practice, explore the Strategy Builder or inspect existing strategies on the dashboard.

← Back to How it Works