Api
Bitfinex 通過 API 獲取交易費用
下了市價單後,我得到了它的 order_id 並通過這個端點檢查了它的狀態
/v1/order/status
,我得到了以下資訊:Array ( [id] => 18141116927 [cid] => 43611135723 [cid_date] => 2018-10-17 [gid] => [symbol] => iotusd [exchange] => bitfinex [price] => 0.51251 [avg_execution_price] => 0.51234 [side] => sell [type] => market [timestamp] => 1539778090.0 [is_live] => [is_cancelled] => [is_hidden] => [oco_order] => [was_forced] => [original_amount] => 20.0 [remaining_amount] => 0.0 [executed_amount] => 20.0 [src] => api )
在這個數組中,我沒有看到這個訂單的兌換費用。此外,上述訂單正在關閉保證金頭寸,我預計會看到與保證金相關的費用,例如借貸成本等。
我如何通過 API 獲取這些資訊?
謝謝
這是包含交易費用以及 order_id 和 fee_currency 的端點
https://api.bitfinex.com/v1/mytrades
Array ( [0] => Array ( [price] => 0.53018 [amount] => 20.0 [timestamp] => 1539786993.0 [type] => Sell [fee_currency] => USD [fee_amount] => -0.0212072 [tid] => 301116948 [order_id] => 18151111432 ) [1] => Array ( [price] => 0.5317 [amount] => 20.0 [timestamp] => 1539786941.0 [type] => Buy [fee_currency] => IOT [fee_amount] => -0.04 [tid] => 301116560 [order_id] => 1815111391 ) )
該端點還可以接受
limit_trades
參數來限制返回的結果數量。然後使用foreach
循環獲取所需的 order_id 並檢索交易費用。不知道為什麼 bitfinex 選擇讓它變得複雜,這個資訊應該包含在“訂單狀態”端點中。