Bitfinex

CryptoExchangeAPIs.Bitfinex.BitfinexClientType
BitfinexClient <: AbstractAPIsClient

Client info.

Required fields

  • base_url::String: Base URL for the client.

Optional fields

  • public_key::String: Public key for authentication.
  • secret_key::String: Secret key for authentication.
  • interface::String: Interface for the client.
  • proxy::String: Proxy information for the client.
  • account_name::String: Account name associated with the client.
  • description::String: Description of the client.
source

Spot

CryptoExchangeAPIs.Bitfinex.Spot.Candle.candleFunction
candle(client::BitfinexClient, query::CandleQuery)
candle(client::BitfinexClient = Bitfinex.Spot.public_client; kw...)

The Candles endpoint provides OCHL (Open, Close, High, Low) and volume data for the specified funding currency or trading pair. The endpoint provides the last 100 candles by default, but a limit and a start and/or end timestamp can be specified.

GET v2/candles/{candle}/{section}

Parameters:

ParameterTypeRequiredDescription
timeframeTimeIntervaltruem1 m5 m15 m30 h1 h3 h6 h12 d1 w1 d14 M1
symbolStringtrue
sectionSectionfalseDefault: hist, Available: last
limitInt64falseDefault: 125
startDateTimefalse
_endDateTimefalse

Code samples:

using Serde
using CryptoExchangeAPIs.Bitfinex

result = Bitfinex.Spot.candle(;
    timeframe = CryptoExchangeAPIs.Bitfinex.Spot.Candle.m5,
    symbol = "tBTCUSD",
    start = now(UTC) - Minute(100),
    _end = now(UTC) - Minute(10),
)

to_pretty_json(result.result)

Result:

[
  {
    "timestamp":"2024-05-19T14:35:00",
    "open":67089.0,
    "close":67032.0,
    "high":67089.0,
    "low":67032.0,
    "volume":0.32812637
  },
  ...
]
source
CryptoExchangeAPIs.Bitfinex.Spot.OrderBook.order_bookFunction
order_book(client::BitfinexClient, query::OrderBookQuery)
order_book(client::BitfinexClient = Bitfinex.Spot.public_client; kw...)

The Public Books endpoint allows you to keep track of the state of Bitfinex order books on a price aggregated basis with customizable precision. Raw books can be retrieved by using precision R0.

GET v2/book/{symbol}/{precision}

Parameters:

ParameterTypeRequiredDescription
symbolStringtrue
precisionPrecisiontrueP0 P1 P2 P3 P4 R0
lenOrderBookLengthfalseDefault: ONE (1), Available: TWENTY_FIVE (25), ONE_HUNDRED (100).

Code samples:

using Serde
using CryptoExchangeAPIs.Bitfinex

result = Bitfinex.Spot.order_book(;
    symbol = "tBTCUSD",
    precision = CryptoExchangeAPIs.Bitfinex.Spot.OrderBook.P1,
    len = CryptoExchangeAPIs.Bitfinex.Spot.OrderBook.TWENTY_FIVE,
)

to_pretty_json(result.result)

Result:

[
  {
    "price":67070.0,
    "count":4,
    "amount":0.16776825
  },
  ...
]
source
CryptoExchangeAPIs.Bitfinex.Spot.Ticker.tickerFunction
ticker(client::BitfinexClient, query::TickerQuery)
ticker(client::BitfinexClient = Bitfinex.Spot.public_client; kw...)

The tickers endpoint provides a high level overview of the state of the market. It shows the current best bid and ask, the last traded price, as well as information on the daily volume and price movement over the last day. The endpoint can retrieve multiple tickers with a single query.

GET v2/tickers

Parameters:

ParameterTypeRequiredDescription
symbolsStringfalseDefault: "ALL"

Code samples:

using Serde
using CryptoExchangeAPIs.Bitfinex

result = Bitfinex.Spot.ticker(;
    symbols = "tBTCUSD"
)

to_pretty_json(result.result)

Result:

[
  {
    "symbol":"tBTCUSD",
    "bid":67071.0,
    "bidSize":5.38418309,
    "ask":67072.0,
    "askSize":8.43368794,
    "dailyChange":194.0,
    "dailyChangeRelative":0.00290133,
    "lastPrice":67060.0,
    "volume":220.21828778,
    "high":67801.0,
    "low":66677.0
  }
]
source
CryptoExchangeAPIs.Bitfinex.Spot.TradePair.trade_pairFunction
trade_pair(client::BitfinexClient, query::TradePairQuery)
trade_pair(client::BitfinexClient = Bitfinex.Spot.public_client; kw...)

The trades endpoint allows the retrieval of past public trades and includes details such as price, size, and time. Optional parameters can be used to limit the number of results; you can specify a start and end timestamp, a limit, and a sorting method.

GET v2/trades/{symbol}/hist

Parameters:

ParameterTypeRequiredDescription
symbolStringtrue
startDateTimefalse
_endDateTimefalse
limitInt64falseDefault: 125

Code samples:

using Serde
using CryptoExchangeAPIs.Bitfinex

result = Bitfinex.Spot.trade_pair(;
    symbol = "tBTCUSD",
    start = DateTime("2024-03-17T12:00:00"),
)

to_pretty_json(result.result)

Result:

[
  {
    "ID":1610094512,
    "timestamp":"2024-05-19T14:40:03.928",
    "amount":0.00093888,
    "price":67041.0
  },
  ...
]
source