Example use cases
The easiest way to use the Bitnxs AI agent is to type plain-language requests in the in-app chat; for automation, an external bot (written by you or an AI like Claude or ChatGPT) calls the Bitnxs API at https://api.bitnxs.com. Below are copyable prompts that match what the in-app agent can actually do, and Python that matches the real API.
Prompts for the in-app agent
Section titled “Prompts for the in-app agent”Get a decisive market view
Should I go long or short BTC right now? Pick a direction, with entry and invalidation.Check your account
What is my current position and best quote?Place one limit order
Based on your call, buy 0.01 BTC at 65000.Ladder entries (one batch, up to 20 orders)
Place 3 limit buys on BTC: 0.01 at 64000, 0.01 at 63000 and 0.02 at 62000.Use a built-in trading style (Conservative preset, verbatim from the app)
From now on, trade for me in a "conservative" style:- Trade BTC only- Use at most 15% of my wallet balance per position- Hold at most 1 position at a time- Keep leverage at its current setting — do not change itWhenever you spot an opportunity, explain your reasoning first, then let me confirm before placing the order.Python: your own agent or bot
Section titled “Python: your own agent or bot”These snippets use the documented API (Authentication, Endpoint reference). Install pip install requests eth-account eth-utils and set BITNXS_USER (main wallet address) and BITNXS_API_KEY (a scoped API key) as environment variables.
import os, requestsfrom eth_account import Accountfrom eth_utils import keccak
BASE = "https://api.bitnxs.com"USER = os.environ["BITNXS_USER"] # main wallet addressAPI_KEY = os.environ["BITNXS_API_KEY"] # never hard-code or paste into a prompt
def info(body): return requests.post(f"{BASE}/info", json=body).json()
def open_session(): chal = requests.post(f"{BASE}/session/start", json={"user": USER}).json() sig = Account.unsafe_sign_hash(keccak(chal["challenge"].encode()), private_key=API_KEY) return requests.post(f"{BASE}/session/complete", json={ "challengeId": chal["challengeId"], "signature": {"r": hex(sig.r), "s": hex(sig.s), "v": sig.v - 27}, }).json()["sessionId"]
meta = info({"type": "meta"}) # asset ids, decimals, max leverageScheduled entry: buy at a limit once per hour
Section titled “Scheduled entry: buy at a limit once per hour”import timeSID = open_session() # refresh before the 1-hour session TTLBTC = 1 # numeric asset id from meta
for i in range(3): r = requests.post(f"{BASE}/session/order", json={ "sessionId": SID, "requestId": int(time.time() * 1000), # idempotency key "asset": BTC, "isBuy": True, "limitPx": "65000", "sz": "0.001", "reduceOnly": False, "orderType": {"type": "limit", "tif": "Gtc"}, }).json() print(r) time.sleep(3600)TP/SL management for an open long
Section titled “TP/SL management for an open long”Needs the set_triggers permission. Triggers fire as reduce-only market orders when the oracle price crosses triggerPx (rules). TP and SL are two separate calls.
for is_tp, px in [(True, "72000"), (False, "61000")]: print(requests.post(f"{BASE}/session/trigger", json={ "sessionId": SID, "asset": BTC, "isTp": is_tp, "triggerPx": px, "sz": "0.001", "positionSide": 1, # 1 = long, -1 = short }).json())Simple strategy loop: let an LLM decide, you keep the limits
Section titled “Simple strategy loop: let an LLM decide, you keep the limits”A safe pattern for agents built with Claude, ChatGPT or any LLM:
- Read state with
info({"type": "clearinghouseState", "user": USER})andinfo({"type": "allMids"}). - Send that state to your LLM and ask for a JSON decision (
long/short/wait, price, size). - Validate in code before sending: maximum size, maximum orders per hour, allowed markets, price within a band of the mid.
- Place a limit order, then attach TP and SL triggers.
- Log everything; stop on repeated errors.