I'm trying to integrate with the Bitunix API (https://openapidoc.bitunix.com/doc/common/introduction.html) using Python and aiohttp. I implemented authentication and signature generation as per the documentation, but when I try to place an order, the API always responds with: { "code": 10007, "data": null, "msg": "Signature Error" } Code (Relevant Part) import aiohttp, hashlib, uuid, time, json import logging logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) class BitunixClient: def __init__(self, api_key, secret_key, base_url="https://fapi.bitunix.com"): self.api_key = api_key self.secret_key = secret_key self.base_url = base_url self.session = aiohttp.ClientSession() async def place_order(self, order_data): method = "POST" endpoint = "/api/v1/futures/trade/place_order" url = f"{self.base_url}{endpoint}" nonce = uuid.uuid4().hex[:32] timestamp = str(int(time.time() * 1000)) # Signature step 1: sorted params (none here) query_params = "" # Signature step 2: sorted, no-whitespace body body = json.dumps(order_data, separators=(',', ':'), sort_keys=True) # Signature step 3: double SHA256 digest_input = f"{nonce}{timestamp}{self.api_key}{query_params}{body}" digest = hashlib.sha256(digest_input.encode()).hexdigest() sign_input = digest + self.secret_key sign = hashlib.sha256(sign_input.encode()).hexdigest() headers = { "api-key": self.api_key, "nonce": nonce, "timestamp": timestamp, "sign": sign, "Content-Type": "application/json" } logger.debug(f"Request URL: {url}") logger.debug(f"Headers: {headers}") logger.debug(f"Body: {body}") logger.debug(f"Digest Input: {digest_input}") logger.debug(f"Signature: {sign}") async with self.session.request(method, url, data=body, headers=headers) as resp: resp_json = await resp.json() logger.info(f"Response: {resp_json}") return resp_json Test Case import asyncio async def test_order(): client = BitunixClient("YOUR_API_KEY", "YOUR_SECRET_KEY") order_data = { "symbol": "BTCUSDT", "side": "BUY", "orderType": "LIMIT", "qty": "0.001", "price": "50000", "tradeSide": "OPEN", "effect": "GTC" } result = await client.place_order(order_data) print(result) asyncio.run(test_order()) ❌ What I’ve Tried Double-checked api_key and secret_key Sorted and compacted body correctly with sort_keys=True Switched from json=data to data=body Ensured system time sync Logs (Excerpt) Request URL: https://fapi.bitunix.com/api/v1/futures/trade/place_order Headers: {'api-key': '...', 'nonce': '...', 'timestamp': '...', 'sign': '...', 'Content-Type': 'application/json'} Body: {"effect":"GTC","orderType":"LIMIT","price":"50000","qty":"0.001","side":"BUY","symbol":"BTCUSDT","tradeSide":"OPEN"} Signature: ... Response: {'code': 10007, 'data': None, 'msg': 'Signature Error'} What am I missing in the signature generation for Bitunix API? Is there any undocumented quirk with how the request body or headers should be constructed? Has anyone successfully placed an order using Bitunix's futures API and aiohttp? There are same issues like this in other questions. Is there probality of the issue is about the exchage api not our codes? Continue reading...