Bitfinex
CryptoExchangeAPIs.Bitfinex.BitfinexClient
— TypeBitfinexClient <: 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.
CryptoExchangeAPIs.Bitfinex.BitfinexAPIError
— TypeBitfinexAPIError{T} <: AbstractAPIsError
Exception thrown when an API method fails with code T
.
Optional fields
type::String
: Error type.code::Int64
: Error code.msg::String
: Error message.
Spot
CryptoExchangeAPIs.Bitfinex.Spot.public_client
— Constantpublic_client = BitfinexClient(; base_url = "https://api-pub.bitfinex.com")
CryptoExchangeAPIs.Bitfinex.Spot.Candle.candle
— Functioncandle(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:
Parameter | Type | Required | Description |
---|---|---|---|
timeframe | TimeInterval | true | m1 m5 m15 m30 h1 h3 h6 h12 d1 w1 d14 M1 |
symbol | String | true | |
section | Section | false | Default: hist , Available: last |
limit | Int64 | false | Default: 125 |
start | DateTime | false | |
_end | DateTime | false |
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
},
...
]
CryptoExchangeAPIs.Bitfinex.Spot.OrderBook.order_book
— Functionorder_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:
Parameter | Type | Required | Description |
---|---|---|---|
symbol | String | true | |
precision | Precision | true | P0 P1 P2 P3 P4 R0 |
len | OrderBookLength | false | Default: 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
},
...
]
CryptoExchangeAPIs.Bitfinex.Spot.Ticker.ticker
— Functionticker(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.
Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
symbols | String | false | Default: "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
}
]
CryptoExchangeAPIs.Bitfinex.Spot.TradePair.trade_pair
— Functiontrade_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.
Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
symbol | String | true | |
start | DateTime | false | |
_end | DateTime | false | |
limit | Int64 | false | Default: 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
},
...
]