Bybit EU Trading Bot in Python

This guide shows how to build a Bybit EU trading bot in Python with LumiBot, for both AI agent trading and algorithmic trading. LumiBot connects to Bybit EU through CCXT, the open source library that talks to more than 100 crypto exchanges. You will create a Bybit EU account and API key, connect it, and run two examples: a simple algorithmic trading bot and an agentic trading bot where an AI agent makes the calls.

Bybit EU at a glance

CCXT exchange id

bybiteu

Markets

Spot, Margin

Testnet (sandbox)

Yes

Credentials

API key, API secret

Live data streams

prices, order book, trades, candles, your orders, your balance, your positions

CCXT request spacing

about 20 ms between requests

Official site

https://www.bybit.com

API docs

https://bybit-exchange.github.io/docs/inverse/

Fees

https://help.bybit.com/hc/en-us/articles/360039261154

What is Bybit EU?

Bybit EU (bybit.eu) is Bybit’s separate exchange site, run by Bybit EU GmbH. It offers spot trading in hundreds of cryptocurrencies, spot margin, EUR deposits and Earn products.

Sign up for Bybit EU

  1. Register on the Bybit EU website or app with an email address or phone number. One email or phone number can open only one account.

  2. Finish identity verification (ID document and a selfie) and set up Google Authenticator 2FA, which is required to create an API key.

  3. For practice, register a separate account on the Bybit EU testnet at https://testnet.bybit.eu/App/register (PC browser only) and request test coins from Assets.

Open a Bybit EU account

Create a Bybit EU API key

  1. On the Bybit EU website (keys cannot be made in the app), hover over your profile icon and click API to open API Management.

  2. Click Create New Key and pick System-generated API Key (Bybit EU gives you a key and secret).

  3. Choose API Transaction, give the key a clear name, and choose Read-Write.

  4. Add your bot’s IP address and select the permissions (see below).

  5. Confirm with the email code and your Google Authenticator 2FA code.

  6. Copy the API secret right away. Bybit EU shows it only once.

Which permissions to turn on: Choose Read-Write. Under Unified Trading, turn on Spot Trading (view, submit and cancel spot orders). Leave withdrawals off, and leave the Assets permissions (Account Transfer, Subaccount Transfer) off unless your bot needs them.

Warning

Never turn on withdrawals for a Bybit EU trading bot key. Bind the key to your server’s IP address when Bybit EU lets you, keep the secret out of your code and out of Git, and delete the key if it ever leaks.

Connect Bybit EU to LumiBot

The simplest way: put these lines in a .env file next to your strategy. LumiBot loads the file, sees TRADING_BROKER=bybiteu and connects to Bybit EU for you, so your strategy needs no broker code.

TRADING_BROKER=bybiteu
BYBITEU_API_KEY=your_apiKey
BYBITEU_API_SECRET=your_secret
BYBITEU_SANDBOX=true   # testnet; remove this line for your live account

LumiBot reads exactly the fields CCXT needs for Bybit EU (apiKey, secret). If one is missing, LumiBot stops at start-up and names the variable you still need.

You can also build the broker in code. This is handy when one script talks to more than one exchange, or when you need extra CCXT options. The keys in the config are CCXT’s own credential names for Bybit EU:

import os

BYBITEU_CONFIG = {
    "exchange_id": "bybiteu",
    "apiKey": os.environ.get("BYBITEU_API_KEY"),
    "secret": os.environ.get("BYBITEU_API_SECRET"),
    "sandbox": True,  # testnet first; set False for your live account
}

from lumibot.brokers import Ccxt

broker = Ccxt(BYBITEU_CONFIG)
# then: MyStrategy(broker=broker, ...)

Either way, LumiBot turns on CCXT’s built-in rate limiting for you.

Practice on the Bybit EU testnet

Bybit EU runs a testnet at https://testnet.bybit.eu with its API at https://api-testnet.bybit.eu. Testnet keys are made in the testnet account, and you can request test coins once every 24 hours. Set BYBITEU_SANDBOX=true (or "sandbox": True in a code config) to use it. Bybit EU’s demo trading mode is a different system with its own keys.

CCXT sends sandbox requests to: https://api-testnet.bybit.eu. Testnet and live accounts use different keys.

Algorithmic trading example: a simple Bybit EU bot

This bot buys about 45 EUR of BTC on Bybit EU once and then holds it. It is a starting point to check that your keys, balances and orders work. If the exchange’s minimum order is larger, raise the amount.

from lumibot.entities import Asset
from lumibot.strategies import Strategy


class BybiteuBuyOnce(Strategy):
    """Buy a small amount of BTC once, then hold it."""

    def initialize(self):
        self.sleeptime = "1H"
        self.set_market("24/7")  # crypto trades all day, every day

    def on_trading_iteration(self):
        coin = Asset("BTC", asset_type=Asset.AssetType.CRYPTO)
        if self.get_position(coin) is not None:
            return  # already holding BTC
        price = self.get_last_price(coin, quote=self.quote_asset)
        if price:
            quantity = round(45 / price, 6)  # about 45 EUR worth
            order = self.create_order(coin, quantity, "buy", quote=self.quote_asset)
            self.submit_order(order)


if __name__ == "__main__":
    # LumiBot reads TRADING_BROKER and the keys from your .env file.
    strategy = BybiteuBuyOnce(quote_asset=Asset("EUR", asset_type=Asset.AssetType.CRYPTO))
    strategy.run_live()

Agentic trading example: an AI agent that trades on Bybit EU

Agentic trading means an AI agent reads the market and decides what to do. In this example one LumiBot agent looks at prices and your Bybit EU account, then places the orders itself. There is no Python logic in between: you set the rules in plain English in the prompt, such as what it may trade and how big each order can be. This follows the same pattern as LumiBot’s AI trading team examples.

from lumibot.entities import Asset
from lumibot.strategies import Strategy


class BybiteuAITrader(Strategy):
    """One AI agent researches the market and places the trades itself."""

    def initialize(self):
        self.sleeptime = "4H"
        self.set_market("24/7")
        self.agents.create(
            name="trader",
            model="openai/gpt-6-luna",
            reasoning_effort="high",
            allow_trading=True,
            system_prompt=(
                "You manage a small crypto account on Bybit EU. "
                "You may trade BTC and ETH against EUR (asset_type 'crypto', quote_symbol 'EUR'), or hold cash. "
                "Before every order, call account_portfolio, account_positions and "
                "market_last_price for that exact symbol in the same run. "
                "Keep each order under 10% of the account value. "
                "Explain each decision in one short paragraph."
            ),
        )

    def on_trading_iteration(self):
        self.agents["trader"].run(
            task_prompt="Review recent BTC/EUR and ETH/EUR prices and your current holdings, then decide whether to buy, sell or hold.",
            context={"exchange": "Bybit EU", "quote": "EUR", "date": self.get_datetime().isoformat()},
        )


if __name__ == "__main__":
    # LumiBot reads TRADING_BROKER and the keys from your .env file.
    strategy = BybiteuAITrader(quote_asset=Asset("EUR", asset_type=Asset.AssetType.CRYPTO))
    strategy.run_live()

The agent needs a model key such as OPENAI_API_KEY in your environment. See the AI agents quickstart for models, tools and memory.

What you can trade on Bybit EU through CCXT

Market

Listed by CCXT

Spot

Yes

Margin

Yes

Perpetual swaps

No

Dated futures

No

Options

Not listed by CCXT

CCXT lists these order features for Bybit EU: market orders, limit orders, stop orders, stop-loss orders, take-profit orders, reduce-only orders, editing open orders, canceling orders.

Bybit EU tips

  • Use bybiteu only if your account is on bybit.eu. Accounts on bybit.com use the separate bybit exchange id, and keys from one site do not work on the other.

  • A key with no IP address bound to it expires after 90 days. Adding your bot’s IP address removes that expiry, and one key can hold up to 100 IP addresses.

  • New accounts may not be able to create API keys for the first 48 hours after registration.

  • Bybit EU has spot pairs in EUR and USDC (for example BTC/EUR and BTC/USDC), but no USDT pairs in CCXT’s market list.

Frequently asked questions

Can I build a Bybit EU trading bot in Python?

Yes. Install LumiBot (pip install lumibot), set your Bybit EU keys and use the bybiteu CCXT exchange id as shown above.

Does Bybit EU have a testnet?

Yes. Set BYBITEU_SANDBOX=true and use keys from the Bybit EU testnet.

Which API permissions does a Bybit EU bot need?

Choose Read-Write. Under Unified Trading, turn on Spot Trading (view, submit and cancel spot orders). Leave withdrawals off, and leave the Assets permissions (Account Transfer, Subaccount Transfer) off unless your bot needs them.

Can an AI agent trade on Bybit EU by itself?

Yes. The agentic example above gives one agent permission to trade. You control what it may trade and how much through its prompt.

Can I trade Bybit EU perpetual futures with LumiBot?

CCXT does not list perpetual swaps for Bybit EU, so use spot markets.

Is LumiBot free?

Yes. LumiBot is open source on GitHub at https://github.com/Lumiwealth/lumibot. You pay only your exchange’s trading fees and, for AI agents, your model provider.

Run it in the cloud with BotSpot

Do not want to keep a computer running for your Bybit EU bot? BotSpot is the hosted home for LumiBot strategies and AI trading agents: build with AI, backtest, connect a broker, and watch every trade with logs and alerts.

Try BotSpot

Sources