Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chipax

Trade crypto perpetuals from Python — starting with $100,000 of practice money.

pip install chipax
chipax login
from chipax import ChipaX

cx = ChipaX()

cx.market.price("BTC")                       # live price, no account needed
cx.demo.buy("BTC", 0.01, leverage=10)        # paper trade, real prices
cx.demo.account().equity                     # 100_000.0 to start
cx.demo.close("BTC")

No deposit. No KYC to paper trade. The demo account exists the first time you touch it.


Why the paper account matters

Most "paper trading" lies to you — it fills at the price you wanted, ignores fees, and lets you use leverage the real venue would refuse. Then your bot loses money live and you can't work out why.

ChipaX's demo account runs the same rules as the live exchange: per-market leverage caps, cross margin, maker/taker fees, and liquidation when equity falls below maintenance margin. A strategy that survives here has been tested against the arithmetic it will actually meet.

Behind both accounts is Hyperliquid — an on-chain order book with real depth. The prices your bot sees are the prices real money trades at.

The API

Market data — no login required

from chipax import ChipaX
cx = ChipaX()

cx.market.price("ETH")                       # 3120.5
cx.market.prices()                           # every market at once
cx.market.candles("BTC", "5m")               # OHLCV, list of dicts
cx.market.orderbook("BTC")                   # L2 book
cx.market.markets()                          # leverage caps, size steps

Candle intervals: 1m 3m 5m 15m 30m 1h 2h 4h 8h 12h 1d 3d 1w.

Paper trading

cx.demo.buy("BTC", 0.05, leverage=10)                 # market long
cx.demo.sell("ETH", 1.0, price=3200, leverage=5)      # resting limit short
cx.demo.buy("SOL", 10, tp=200, sl=150)                # with exits attached

cx.demo.account()          # balance, equity, margin, positions
cx.demo.positions()        # open positions
cx.demo.orders()           # resting orders + armed triggers
cx.demo.fills()            # trade history
cx.demo.close("BTC")       # flatten one market
cx.demo.reset()            # back to $100,000

Live trading

Identical verbs — only the account changes.

cx.live.buy("BTC", 0.01, leverage=5, sl=60000)
cx.live.positions()
cx.live.close("BTC", 0.01)

Live trading needs a funded account. Deposit USDC on Arbitrum once through the app and the rest — bridging, trading agent approval — happens on its own.

A complete bot, start to finish

import time
from chipax import ChipaX

cx = ChipaX()
COIN, SIZE = "BTC", 0.01

while True:
    candles = cx.market.candles(COIN, "5m")
    closes = [float(c["c"]) for c in candles[-50:]]
    fast, slow = sum(closes[-10:]) / 10, sum(closes) / len(closes)

    holding = any(p["coin"] == COIN for p in cx.demo.positions())

    if fast > slow and not holding:
        cx.demo.buy(COIN, SIZE, leverage=5)
    elif fast < slow and holding:
        cx.demo.close(COIN)

    time.sleep(60)

Run it against the demo account for a week before it touches real money. Then change cx.demo to cx.live — nothing else.

Errors

Failures raise ChipaXError with the exchange's own reason attached, so a refused trade explains itself:

from chipax import ChipaXError

try:
    cx.demo.buy("BTC", 1000, leverage=50)
except ChipaXError as e:
    print(e.detail)     # "BTC allows at most 40x leverage"

Authentication

chipax login opens a browser, you approve, and a token is saved to ~/.chipax/credentials.json. Nothing is typed into your terminal and no password reaches this library.

For servers and CI, set the token as an environment variable instead:

export CHIPAX_TOKEN="eyJ..."

Or pass it directly: ChipaX(token="eyJ..."). Tokens last a year; chipax whoami checks one.

CLI

chipax login          # link this machine
chipax whoami         # who the saved token belongs to
chipax price BTC      # current price
chipax demo           # paper account summary
chipax logout         # forget the token

Fees

Taker 0.045%, maker 0.015% (Hyperliquid), plus a 0.1% ChipaX builder fee on perps. The demo account charges the same, so paper results and live results are comparable.

Links

MIT licensed. Trading perpetual futures with leverage can lose you more than you put in — practise on the demo account first, and never risk money you need.

About

Trade crypto perpetuals from Python — with a free $100,000 paper account that follows the same rules as live.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages