本文介绍Bitfinex APi
Platform Status
Get the current status of the platform. Maintenance periods last for just few minutes and might be necessary from time to time during upgrades of core components of our infrastructure. Even if rare it is important to have a way to notify users. For a real-time notification we suggest to use websockets and listen to events 20060/20061
curl https://api.bitfinex.com/v2/platform/status
Response Details
Fields | Type | Description |
---|---|---|
OPERATIVE | int | 1=operative, 0=maintenance |
Maintenance mode
When the platform is marked in maintenance mode bots should stop trading activity. Cancelling orders will be still possible.
Tickers
The ticker is a high level overview of the state of the market. It shows you the current best bid and ask, as well as the last trade price. It also includes information such as daily volume and how much the price has moved over the last day.
curl https://api.bitfinex.com/v2/tickers?symbols=tBTCUSD,tLTCUSD,fUSD
curl https://api.bitfinex.com/v2/tickers?symbols=tBTCUSD
curl https://api.bitfinex.com/v2/tickers?symbols=ALL
QUERY PARAMS
Response Details
Fields | Type | Description |
---|---|---|
FRR | float | Flash Return Rate - average of all fixed rate funding over the last hour |
BID | float | Price of last highest bid |
BID_PERIOD | int | Bid period covered in days |
BID_SIZE | float | Sum of the 25 highest bid sizes |
ASK | float | Price of last lowest ask |
ASK_PERIOD | int | Ask period covered in days |
ASK_SIZE | float | Sum of the 25 lowest ask sizes |
DAILY_CHANGE | float | Amount that the last price has changed since yesterday |
DAILY_CHANGE_PERC | float | Amount that the price has changed expressed in percentage terms |
LAST_PRICE | float | Price of the last trade |
VOLUME | float | Daily volume |
HIGH | float | Daily high |
LOW | float | Daily low |
Ticker
The ticker is a high level overview of the state of the market. It shows you the current best bid and ask, as well as the last trade price. It also includes information such as daily volume and how much the price has moved over the last day.
curl https://api.bitfinex.com/v2/ticker/tBTCUSD
PATH PARAMS
Response Details
Fields | Type | Description |
---|---|---|
FRR | float | Flash Return Rate - average of all fixed rate funding over the last hour |
BID | float | Price of last highest bid |
BID_PERIOD | int | Bid period covered in days |
BID_SIZE | float | Sum of the 25 highest bid sizes |
ASK | float | Price of last lowest ask |
ASK_PERIOD | int | Ask period covered in days |
ASK_SIZE | float | Sum of the 25 lowest ask sizes |
DAILY_CHANGE | float | Amount that the last price has changed since yesterday |
DAILY_CHANGE_PERC | float | Amount that the price has changed expressed in percentage terms |
LAST_PRICE | float | Price of the last trade |
VOLUME | float | Daily volume |
HIGH | float | Daily high |
LOW | float | Daily low |
Trades
Trades endpoint includes all the pertinent details of the trade, such as price, size and time.
curl https://api.bitfinex.com/v2/trades/tBTCUSD/hist
PATH PARAMS
QUERY PARAMS
Response Details
Fields | Type | Description |
---|---|---|
MTS | int | millisecond time stamp |
±AMOUNT | float | How much was bought (positive) or sold (negative). |
PRICE | float | Price at which the trade was executed |
RATE | float | Rate at which funding transaction occurred |
PERIOD | int | Amount of time the funding transaction was for |
The order that causes the trade determines if it is a buy or a sell.
Books
The Order Books channel allow you to keep track of the state of the Bitfinex order book. It is provided on a price aggregated basis, with customizable precision.
curl https://api.bitfinex.com/v2/book/tBTCUSD/P0
PATH PARAMS
QUERY PARAMS
Response Details
Fields | Type | Description |
---|---|---|
PRICE | float | Price level |
RATE | float | Rate level |
PERIOD | float | Period level (Funding only) |
COUNT | int | Number of orders at that price level |
±AMOUNT | float | Total amount available at that price level. |
For Trading: if AMOUNT > 0 then bid else ask.
For Funding: if AMOUNT > 0 then ask else bid.
PATH PARAMS
QUERY PARAMS
Response Details
Fields | Type | Description |
---|---|---|
MTS | int | millisecond timestamp |
VALUE | float | Total amount |
Available Keys
Key | Description | Arguments | Example |
---|---|---|---|
pos.size | Total Open Position (long / short) | :1m :SYM_TRADING :SIDE | pos.size:1m:tBTCUSD:long , pos.size:1m:tBTCUSD:short |
funding.size | Total Active Funding | :1m :SYM_FUNDING | funding.size:1m:fUSD |
credits.size | Active Funding used in positions | :1m :SYM_FUNDING | credits.size:1m:fUSD |
credits.size.sym | Active Funding used in positions (per trading symbol) | :1m :SYM_FUNDING :SYM_TRADING | credits.size.sym:1m:fUSD:tBTCUSD |
PATH PARAMS
QUERY PARAMS
Response Details
Fields | Type | Description |
---|---|---|
MTS | int | millisecond time stamp |
OPEN | float | First execution during the time frame |
CLOSE | float | Last execution during the time frame |
HIGH | float | Highest execution during the time frame |
LOW | float | Lowest execution during the timeframe |
VOLUME | float | Quantity of symbol traded within the timeframe |
Available Keys
Key | Description | Arguments | Example |
---|---|---|---|
trade | Trading Candles | :TF :SYM_TRADING | trade :1m :tBTCUSD |
trade | Funding Candles | :TF :SYM_FUNDING:pPERIOD | trade :1m :fUSD :p30 |
trade | Aggregate Funding Candles (AGGR=[10,30]) | :TF :SYM_FUNDING :aAGGR :pPER_START :p :PER_END | trade :1m :fUSD :a10 :p2 :p10 , trade :1m :fUSD :a10 :p11 :p20 , trade :1m :fUSD :a10 :p21 :p30 , trade :1m :fUSD :a30 :p2 :p30 |
Market Average Price
Calculate the average execution rate for Trading or Margin funding.
curl --request POST
--url 'https://api.bitfinex.com/v2/calc/trade/avg?symbol=symbol'