You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Bitfinex API v1调用/v1/order/new报错“Key symbol was not present”求助

Fixing "Key symbol was not present." Error with Bitfinex API v1 /v1/order/new

Hey there, let's break down this issue clearly—this error is straightforward: your request to the /v1/order/new endpoint is missing the required symbol parameter, which is mandatory for creating any order on Bitfinex API v1.

What's the root cause?

Looking at your code snippet, you're only adding request and nonce to your JSON payload, but you haven't included the symbol key that tells the API which trading pair you want to trade (e.g., btcusd for Bitcoin/USD, ethusd for Ethereum/USD). Bitfinex's v1 API explicitly requires this parameter for order creation, so the server is throwing an error because it can't process the order without knowing the target pair.

How to fix it?

Add the symbol parameter to your JSONObject before generating the payload. Here's how to modify your code:

/** Create Header, Param */
JSONObject json = new JSONObject();
json.put("request", targetURL);
json.put("nonce", Long.toString(getNonce()));
// Add the required symbol parameter (replace with your target trading pair)
json.put("symbol", "btcusd"); 
String payload = ... // Rest of your payload generation logic

Extra checks to avoid future issues

  • Case sensitivity: Make sure the key is lowercase symbol—Bitfinex's API doesn't recognize uppercase variants like Symbol or SYMBOL.
  • Valid symbol format: For API v1, trading pairs are formatted as lowercase strings without separators (e.g., ltcusd, xrpusd). Avoid using v2-style symbols like tBTCUSD here.
  • Payload integrity: Double-check that your payload generation logic includes all key-value pairs from the JSONObject, including the newly added symbol. Sometimes issues happen if only a subset of the JSON is being sent to the API.

内容的提问来源于stack exchange,提问作者Tim

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 06:23:43