Bitfinex API

本文介绍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

 
gethttps://api.bitfinex.com/v2/platform/status
curl https://api.bitfinex.com/v2/platform/status

Response Details

FieldsTypeDescription
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.

SUGGEST EDITS

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.

 
gethttps://api.bitfinex.com/v2/tickers
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
 200 OK 400 Bad Request
[ // on trading pairs (ex. tBTCUSD) [ SYMBOL, BID, BID_SIZE, ASK, ASK_SIZE, DAILY_CHANGE, DAILY_CHANGE_PERC, LAST_PRICE, VOLUME, HIGH, LOW ], // on funding currencies (ex. fUSD) [ SYMBOL, FRR, BID, BID_SIZE, BID_PERIOD, ASK, ASK_SIZE, ASK_PERIOD, DAILY_CHANGE, DAILY_CHANGE_PERC, LAST_PRICE, VOLUME, HIGH, LOW ], ... ]

QUERY PARAMS

The symbols you want information about as a comma separated list, or ALL for every symbol. Ex:

Response Details

FieldsTypeDescription
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
SUGGEST EDITS

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.

 
gethttps://api.bitfinex.com/v2/ticker/Symbol
curl https://api.bitfinex.com/v2/ticker/tBTCUSD
 200 OK 400 Bad Request
// on trading pairs (ex. tBTCUSD) [ BID, BID_SIZE, ASK, ASK_SIZE, DAILY_CHANGE, DAILY_CHANGE_PERC, LAST_PRICE, VOLUME, HIGH, LOW ] // on funding currencies (ex. fUSD) [ FRR, BID, BID_SIZE, BID_PERIOD, ASK, ASK_SIZE, ASK_PERIOD, DAILY_CHANGE, DAILY_CHANGE_PERC, LAST_PRICE, VOLUME, HIGH, LOW ]

PATH PARAMS

The symbol you want information about. You can find the list of valid symbols by calling the /symbols endpoint.

Response Details

FieldsTypeDescription
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
SUGGEST EDITS

Trades

Trades endpoint includes all the pertinent details of the trade, such as price, size and time.

 
gethttps://api.bitfinex.com/v2/trades/Symbol/hist
curl https://api.bitfinex.com/v2/trades/tBTCUSD/hist
 200 OK 400 Bad Request
// on trading pairs (ex. tBTCUSD) [ [ ID, MTS, AMOUNT, PRICE ] ] // on funding currencies (ex. fUSD) [ [ ID, MTS, AMOUNT, RATE, PERIOD ] ]

PATH PARAMS

The symbol you want information about.

QUERY PARAMS

Number of records

Millisecond start time

Millisecond end time

if = 1 it sorts results returned with old > new

Response Details

FieldsTypeDescription
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.

SUGGEST EDITS

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.

 
gethttps://api.bitfinex.com/v2/book/Symbol/Precision
curl https://api.bitfinex.com/v2/book/tBTCUSD/P0
 200 OK 400 Bad Request
// on trading pairs (ex. tBTCUSD) [ [ PRICE, COUNT, AMOUNT ] ] // on funding currencies (ex. fUSD) [ [ RATE, PERIOD, COUNT, AMOUNT ] ]

PATH PARAMS

The symbol you want information about. You can find the list of valid symbols by calling the /symbols endpoint.

Level of price aggregation (P0, P1, P2, P3, P4, R0)

QUERY PARAMS

Number of price points ("25", "100")

Response Details

FieldsTypeDescription
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.

SUGGEST EDITS

Stats

Various statistics about the requested pair.

 
gethttps://api.bitfinex.com/v2/stats1/Key:Size:Symbol/Section
 200 OK 400 Bad Request
// response with Section = "last" [ MTS, VALUE ] // response with Section = "hist" [ [ MTS, VALUE ], ... ]

PATH PARAMS

Allowed values: "funding.size", "credits.size", "credits.size.sym", "pos.size"

Available values: '1m'

The symbol you want information about.

Available values: "long", "short"

Available values: "last", "hist"

QUERY PARAMS

if = 1 it sorts results returned with old > new

Response Details

FieldsTypeDescription
MTS int millisecond timestamp
VALUE float Total amount

Available Keys

KeyDescriptionArgumentsExample
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
SUGGEST EDITS

Candles

Provides a way to access charting candle info

 
gethttps://api.bitfinex.com/v2/candles/trade:TimeFrame:Symbol/Section
 200 OK 400 Bad Request
// response with Section = "last" [ MTS, OPEN, CLOSE, HIGH, LOW, VOLUME ] // response with Section = "hist" [ [ MTS, OPEN, CLOSE, HIGH, LOW, VOLUME ], ... ]

PATH PARAMS

Available values: '1m', '5m', '15m', '30m', '1h', '3h', '6h', '12h', '1D', '7D', '14D', '1M'

The symbol you want information about.

Available values: "last", "hist"

QUERY PARAMS

Number of candles requested

Filter start (ms)

Filter end (ms)

if = 1 it sorts results returned with old > new

Response Details

FieldsTypeDescription
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

KeyDescriptionArgumentsExample
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
SUGGEST EDITS

Market Average Price

Calculate the average execution rate for Trading or Margin funding.

 
posthttps://api.bitfinex.com/v2/calc/trade/avg
curl --request POST 
  --url 'https://api.bitfinex.com/v2/calc/trade/avg?symbol=symbol'
 200 OK 400 Bad Request
[RATE_AVG, AMOUNT]

QUERY PARAMS

The symbol you want information about.

Amount. Positive for buy, negative for sell (ex. "1.123")

(optional) Maximum period for Margin Funding

Limit rate/price (ex. "1000.5")

 
原文地址:https://www.cnblogs.com/bitquant/p/bitfinex-api.html