Bitfinex Margin Long/Short Positions

Get the history of long and short position quantities in BTC and ETH margin (leveraged) trading on Bitfinex, returned per interval and measured in number of coins. Useful for observing the long/short direction of leveraged capital on Bitfinex.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Available on all API plans: Hobbyist Startup Standard Professional Enterprise

The data intervals you can query differ by API plan; see API Plans and Available Intervals below on this page.

Update frequencyReal-time

Response Data

data is an array; each element holds the data for one interval, sorted from oldest to newest. time is the start time of the interval, in seconds; the last element corresponds to an interval that has not yet closed. Long and short positions are returned as a number of coins (e.g., the number of BTC when symbol=BTC).

📘

The returned time is in seconds

time is a 10-digit timestamp in seconds (e.g., 1792465200), unlike the millisecond timestamps of most endpoints; multiply it by 1000 before converting it to a date.

🚧

Start and end time parameters

For now, please do not pass start_time or end_time; if they are omitted, the endpoint returns the most recent limit data points. When you need data for a specific period, control the number of data points with limit, then filter locally by the returned time.

200 · application/json · See the response example in the right panel.

FieldTypeAlways ReturnedDescription
codestringYesBusiness status code; "0" means success
msgstringNoResult message; not returned on success
dataarray of objectYesArray sorted by time; each element is one interval
data[].timeintegerYesInterval start time, timestamp in seconds (UTC)
data[].long_quantitynumberYesBitfinex margin long position quantity, in number of coins
data[].short_quantitynumberYesBitfinex margin short position quantity, in number of coins

API Plans and Available Intervals

All API plans can call this endpoint; they differ in the data intervals they can query: the lower the plan, the longer the shortest available interval. For the price of each plan, see API Plans.

API PlanAccessAvailable Data Intervals (interval Parameter)
Hobbyist✅ Yes4 hours and above: 4h, 6h, 8h, 12h, 1d
Startup✅ Yes30 minutes and above: 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d
Standard✅ YesAll intervals, minimum 1 minute (1m)
Professional✅ YesAll intervals, minimum 1 minute (1m)
Enterprise✅ YesAll intervals, minimum 1 minute (1m)

For how much historical data each interval can query, see Intervals.

Use This Endpoint with AI

Pick a task and click Open in ChatGPT or Open in Claude: the AI reads this page first and then gives you the result. You can also click Copy and paste the full prompt into the AI tool you use.

Calculate the long/short ratio
Have AI write a Python function that calculates the Bitfinex BTC margin long/short ratio.
Plot long/short position trends
Have AI write code that plots the trends of BTC and ETH margin long and short quantities.
Understand this endpoint
Have AI explain the response fields and what margin longs and shorts mean, in plain language.

This endpoint provides data through the REST API. Use the prompts above to have AI write the request code. For the tools available through MCP, see CoinGlass MCP.

Use Cases

ScenarioDescription
Track Leveraged Capital DirectionTrack increases and decreases in Bitfinex margin long and short positions, which the market often treats as a reference for the moves of large capital.
Long/Short Ratio CalculationDivide the long quantity by the short quantity to get the long/short ratio and observe how the balance between longs and shorts changes.
Short Squeeze RiskIf the price rises after short positions have increased rapidly, it may trigger short covering and amplify the rally.
Compare with PriceAlign by time with Spot Pair Price OHLC History to judge whether leveraged capital is trading with or against the trend. Note that time in this endpoint is in seconds.

Related Endpoints

EndpointHow It Differs
Borrow Interest RateInterest rate history of margin borrowing on exchanges
Coinbase Premium IndexBitcoin price gap between Coinbase and Binance
Top Trader Long/Short Position Ratio HistoryLong/short position ratio of top traders in the futures market
Global Long/Short Account Ratio HistoryRatio of long to short accounts in the futures market

FAQ

What unit is long_quantity in?

Number of coins. For example, when symbol=BTC, 89643.07 means a margin long position of about 89,600 BTC.

How do I get data for a specific period?

If you omit start_time and end_time, the endpoint returns the most recent limit data points, sorted from oldest to newest, with the last one being an interval that has not yet closed; for example, with interval=1h and limit=2, it returns data for the 2 most recent hourly intervals. For now, please do not pass start and end times; use limit to get enough data, then slice it locally by time.

Why is time a 10-digit number?

The time returned by this endpoint is a timestamp in seconds; multiply it by 1000 before converting it to a date. For how to convert, see Timestamps and Pagination.

Which coins are supported?

BTC and ETH. The endpoint combines symbol and quoteAsset (default USD) into a market code and queries the BTCUSD and ETHUSD markets on Bitfinex. symbol has no default value, so pass it every time.

Learn More: Bitfinex Margin Long/Short Positions

What Are Bitfinex Margin Long/Short Positions?

Bitfinex offers spot margin (leveraged) trading, where users can borrow money to go long or borrow coins to go short. This endpoint counts the quantities of long and short positions in this margin trading; the data comes from Bitfinex.

Why Does the Market Watch Bitfinex Long/Short Positions?

Bitfinex was one of the earlier exchanges to offer margin trading, and large changes in its margin long or short positions are often treated by the market as a reference for large capital changing direction.

How Is This Different from the Futures Long/Short Ratio?

This endpoint gives position quantities in spot margin trading, in coins; the long/short ratio in the futures market reflects the long/short proportion of futures accounts or positions, see Top Trader Long/Short Position Ratio History.

Query Params
string
required
Defaults to BTC

Coin; required; supports BTC and ETH. If omitted, the endpoint returns no error but an empty data list. The endpoint combines symbol and quoteAsset into a Bitfinex market code for the query; for example, BTC + USD gives BTCUSD.

int32
≤ 1000
Defaults to 1000

Number of data points to return; default 1000, maximum 1000.

string
required
Defaults to 1d

Data interval; required, e.g., 1d. Options: 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d. The shortest interval you can use depends on your API plan: 4h for Hobbyist, 30m for Startup, and 1m for Standard and above.

int64

Start time, timestamp in milliseconds (UTC); optional. For now, please do not pass it; use limit to get the most recent data (see the note below).

int64

End time, timestamp in milliseconds (UTC); optional; the same applies as for start_time.

string
Defaults to USD

Quote asset; optional, default USD. The endpoint combines symbol and quoteAsset into a Bitfinex market code for the query; for example, with symbol=BTC and this parameter omitted, the query is for BTCUSD.

Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json