:seo_title: Hibachi Trading Bot in Python: AI Agent and Algorithmic Trading with LumiBot
.. Generated by scripts/generate_ccxt_exchange_pages.py from docsrc/_data/. Edit the data, not this page.
Hibachi Trading Bot in Python
=============================
.. meta::
:description: Build a Hibachi trading bot in Python with LumiBot and CCXT. Set up Hibachi API wallet keys, connect them, and run a regular or AI agent strategy.
:keywords: Hibachi trading bot, Hibachi API, Hibachi Python, agentic trading Hibachi, AI trading bot Hibachi, algorithmic trading Hibachi, ccxt hibachi
This guide shows how to build a Hibachi trading bot in Python with LumiBot, for both AI agent trading and algorithmic trading. LumiBot connects to Hibachi through CCXT, the open source library that talks to more than 100 crypto exchanges. You will create a Hibachi account and API wallet, connect it, and run two examples: a simple algorithmic trading bot and an agentic trading bot where an AI agent makes the calls.
Hibachi at a glance
-------------------
.. list-table::
:widths: 35 65
* - CCXT exchange id
- ``hibachi``
* - Markets
- Perpetual swaps
* - Testnet (sandbox)
- No
* - Credentials
- account id, API key, private key
* - Live data streams
- None listed; LumiBot uses REST
* - CCXT request spacing
- about 100 ms between requests
* - Official site
- https://www.hibachi.xyz/
What is Hibachi?
----------------
Hibachi is a privacy-first exchange for leveraged perpetual contracts on crypto (and some FX pairs), such as BTC/USDT-P. You can sign up with a crypto wallet or with an email address.
Sign up for Hibachi
-------------------
#. Go to the Hibachi website. Either click Connect Wallet and approve the connection in your wallet (MetaMask, Phantom, Trust Wallet and others), or click Create Account, enter your email address and finish the 6-digit code and two-factor setup.
#. Deposit funds. Hibachi takes USDT or USDC on the networks its docs list (Arbitrum and Base, for example). Only send a supported asset on the matching network.
#. Wait for your first deposit to land. Hibachi does not create your Account ID until then, and the API needs that ID.
`Open a Hibachi account `_
Set up a Hibachi API wallet
---------------------------
#. Log in on the Hibachi website, click the gear button in the top right corner and choose API Keys.
#. Click Create API Key and pick the account the key is for. A key only works for that one account.
#. Give the key a name and set API Restrictions to read-write with the Trading permission (see below), then click Generate.
#. Save the API Key and the Private Key right away. Hibachi shows the Private Key only once.
#. Click Next and note your Account ID, shown as ``ID: XXX`` under the key name.
**Which permissions to turn on:** Choose read-write and turn on Trading, which Hibachi says is required to place orders. Leave Withdraws off (it lets a key send funds outside the exchange) and leave Transfers off unless you move money between your own sub-accounts. New keys start as read-only.
.. warning::
A Hibachi private key is as powerful as the money it controls. Use a separate wallet or API wallet that holds only what you want the bot to trade, keep the key out of your code and out of Git, and move your funds if the key ever leaks.
Connect Hibachi to LumiBot
--------------------------
The simplest way: put these lines in a ``.env`` file next to your strategy. LumiBot loads the file, sees ``TRADING_BROKER=hibachi`` and connects to Hibachi for you, so your strategy needs no broker code.
.. code-block:: bash
TRADING_BROKER=hibachi
HIBACHI_ACCOUNT_ID=your_accountId
HIBACHI_API_KEY=your_apiKey
HIBACHI_PRIVATE_KEY=your_privateKey
LumiBot reads exactly the fields CCXT needs for Hibachi (``accountId``, ``apiKey``, ``privateKey``). 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 Hibachi:
.. code-block:: python
import os
HIBACHI_CONFIG = {
"exchange_id": "hibachi",
"accountId": os.environ.get("HIBACHI_ACCOUNT_ID"),
"apiKey": os.environ.get("HIBACHI_API_KEY"),
"privateKey": os.environ.get("HIBACHI_PRIVATE_KEY"),
"sandbox": False, # no sandbox for this exchange
}
from lumibot.brokers import Ccxt
broker = Ccxt(HIBACHI_CONFIG)
# then: MyStrategy(broker=broker, ...)
Either way, LumiBot turns on CCXT's built-in rate limiting for you.
Testing on Hibachi
------------------
Hibachi has no sandbox. Test with a very small amount, leave ``HIBACHI_SANDBOX`` unset, and in a code config set ``"sandbox": False``.
Algorithmic trading example: a simple Hibachi bot
-------------------------------------------------
CCXT lists no spot market for Hibachi, so this example trades a perpetual contract. It opens one small long BTC position worth about 50 USDT 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. If your account uses hedge mode, add ``position_side="long"`` to ``create_order``. Hibachi accepts only limit orders through CCXT, so the example places a limit order just above the last price.
.. code-block:: python
from lumibot.entities import Asset
from lumibot.strategies import Strategy
class HibachiOpenOneLong(Strategy):
"""Open one small long BTC perpetual position, 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):
# The full CCXT symbol keeps the settlement currency clear.
contract = self.broker.get_asset("BTC/USDT:USDT")
if self.get_position(contract) is not None:
return # already holding the position
price = self.get_last_price(contract)
if price:
# Each contract covers contract.multiplier BTC; size the order to about 50 USDT.
quantity = round(50 / (price * contract.multiplier), 6)
# This exchange takes only limit orders through CCXT.
order = self.create_order(contract, quantity, "buy", limit_price=price * 1.002)
self.submit_order(order)
if __name__ == "__main__":
# LumiBot reads TRADING_BROKER and the keys from your .env file.
strategy = HibachiOpenOneLong(quote_asset=Asset("USDT", asset_type=Asset.AssetType.CRYPTO))
strategy.run_live()
Agentic trading example: an AI agent that trades on Hibachi
-----------------------------------------------------------
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 Hibachi 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.
.. code-block:: python
from lumibot.entities import Asset
from lumibot.strategies import Strategy
class HibachiAITrader(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 Hibachi. "
"You may trade the BTC/USDT:USDT perpetual contract (asset_type 'crypto_future'), long or short, or stay flat. "
"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/USDT:USDT prices and your current position, then decide whether to buy, sell or hold.",
context={"exchange": "Hibachi", "quote": "USDT", "date": self.get_datetime().isoformat()},
)
if __name__ == "__main__":
# LumiBot reads TRADING_BROKER and the keys from your .env file.
strategy = HibachiAITrader(quote_asset=Asset("USDT", asset_type=Asset.AssetType.CRYPTO))
strategy.run_live()
The agent needs a model key such as ``OPENAI_API_KEY`` in your environment. See the :doc:`AI agents quickstart ` for models, tools and memory.
What you can trade on Hibachi through CCXT
------------------------------------------
.. list-table::
:header-rows: 1
:widths: 40 60
* - Market
- Listed by CCXT
* - Spot
- No
* - Margin
- No
* - Perpetual swaps
- Yes
* - Dated futures
- No
* - Options
- No
CCXT lists these order features for Hibachi: limit orders, editing open orders, canceling orders.
For perpetual contracts, use the full CCXT symbol so the settlement currency is clear, for example ``BTC/USDT:USDT``. See :doc:`the CCXT guide ` for contract quantities, position modes and leverage.
Hibachi tips
------------
* Hibachi needs three values: ``HIBACHI_ACCOUNT_ID`` (the Account ID), ``HIBACHI_API_KEY`` and ``HIBACHI_PRIVATE_KEY``. In a code config these are ``"accountId"``, ``"apiKey"`` and ``"privateKey"``.
* The Private Key from the API key page is not your crypto wallet's private key. Never use your wallet key here. Wallet (trustless) accounts get a key that signs with ECDSA, and email accounts get an HMAC secret; CCXT handles both.
* CCXT's Hibachi adapter places limit orders only (no market orders), so give your orders a price.
* Hibachi writes its perpetual markets like ``BTC/USDT-P``. In CCXT and LumiBot the same market is ``BTC/USDT:USDT``.
Frequently asked questions
--------------------------
**Can I build a Hibachi trading bot in Python?**
Yes. Install LumiBot (``pip install lumibot``), set your Hibachi keys and use the ``hibachi`` CCXT exchange id as shown above.
**Does Hibachi have a testnet?**
No testnet is set up for Hibachi in LumiBot. Start with a small amount, and in a code config set ``"sandbox": False``.
**Which keys does a Hibachi bot need?**
Choose read-write and turn on Trading, which Hibachi says is required to place orders. Leave Withdraws off (it lets a key send funds outside the exchange) and leave Transfers off unless you move money between your own sub-accounts. New keys start as read-only.
**Can an AI agent trade on Hibachi 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 Hibachi perpetual futures with LumiBot?**
CCXT lists perpetual swaps for this exchange. Use the full contract symbol, such as ``BTC/USDT:USDT``.
**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 Hibachi 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 `_
Related guides
--------------
* :doc:`CCXT crypto trading with LumiBot `
* :doc:`AI agents quickstart `
* :doc:`AftermathFinance trading bot `
* :doc:`Apex trading bot `
* :doc:`BloFin trading bot `
* :doc:`dYdX trading bot `
Sources
-------
* `Hibachi API documentation: Getting Started and Key Definitions `_ (read 2026-10-23)
* `Hibachi Docs: Signing Up `_ (read 2026-10-23)
* `Hibachi Docs: About Hibachi `_ (read 2026-10-23)
* `Hibachi Docs: Trading (leverage by market) `_ (read 2026-10-23)
* Exchange id, URLs, markets, credentials and stream support: CCXT 4.5.64 metadata, generated 2026-10-23