Longbridge Developers
Get Started

Short Positions (US & HK)

Get short interest data for US or HK securities. Market is auto-detected from the symbol suffix: .HK → HKEX short position data (daily); others → US FINRA short interest data (bi-monthly).

>_ CLI
longbridge short-positions TSLA.US
longbridge short-positions 700.HK
longbridge short-positions AAPL.US --count 50

Parameters

SDK method parameters.

NameTypeRequiredDescription
symbolstringYESSecurity symbol, e.g. TSLA.US or 700.HK
countintegerNONumber of records to return (1–100, default: 20)

Request Example

>_ CLI
longbridge short-positions TSLA.US
longbridge short-positions 700.HK
longbridge short-positions AAPL.US --count 50
from longbridge.openapi import QuoteContext, Config, OAuthBuilder

oauth = OAuthBuilder("your-client-id").build(lambda url: print("Visit:", url))
config = Config.from_oauth(oauth)
ctx = QuoteContext(config)

# US example
resp = ctx.short_positions("TSLA.US", 20)
print(resp)

# HK example
resp = ctx.short_positions("700.HK", 20)
print(resp)
import asyncio
from longbridge.openapi import AsyncQuoteContext, Config, OAuthBuilder

async def main() -> None:
    oauth = await OAuthBuilder("your-client-id").build_async(lambda url: print("Visit:", url))
    config = Config.from_oauth(oauth)
    ctx = AsyncQuoteContext.create(config)

    # US example
    resp = await ctx.short_positions("TSLA.US", 20)
    print(resp)

    # HK example
    resp = await ctx.short_positions("700.HK", 20)
    print(resp)

if __name__ == "__main__":
    asyncio.run(main())
const { Config, QuoteContext, OAuth } = require('longbridge')

async function main() {
  const oauth = await OAuth.build('your-client-id', (_, url) => {
    console.log('Open this URL to authorize: ' + url)
  })
  const config = Config.fromOAuth(oauth)
  const ctx = QuoteContext.new(config)
  const resp = await ctx.shortPositions('TSLA.US', 20)
  console.log(resp)
}
main().catch(console.error)
import com.longbridge.*;
import com.longbridge.quote.*;

class Main {
    public static void main(String[] args) throws Exception {
        try (OAuth oauth = new OAuthBuilder("your-client-id").build(url -> System.out.println("Open to authorize: " + url)).get();
             Config config = Config.fromOAuth(oauth);
             QuoteContext ctx = QuoteContext.create(config)) {
            var resp = ctx.getShortPositions("TSLA.US", 20).get();
            System.out.println(resp);
        }
    }
}
use std::sync::Arc;
use longbridge::{oauth::OAuthBuilder, quote::QuoteContext, Config};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let oauth = OAuthBuilder::new("your-client-id").build(|url| println!("Open: {url}")).await?;
    let config = Arc::new(Config::from_oauth(oauth));
    let (ctx, _) = QuoteContext::new(config);
    let resp = ctx.short_positions("TSLA.US", 20).await?;
    println!("{:?}", resp);
    Ok(())
}
#include &lt;iostream&gt;
#include <longbridge.hpp>

using namespace longbridge;
using namespace longbridge::quote;

int main() {
    OAuthBuilder("your-client-id").build(
        [](const std::string& url) { std::cout << "Open: " << url << std::endl; },
        [](auto res) {
            if (!res) return;
            Config config = Config::from_oauth(*res);
            QuoteContext ctx = QuoteContext::create(config);
            ctx.short_positions("TSLA.US", 20, [](auto resp) {
                if (resp) std::cout << resp->size() << std::endl;
            });
        });
    std::cin.get();
}
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/longbridge/openapi-go/config"
	"github.com/longbridge/openapi-go/oauth"
	"github.com/longbridge/openapi-go/quote"
)

func main() {
	o := oauth.New("your-client-id").
		OnOpenURL(func(url string) { fmt.Println("Open this URL to authorize:", url) })
	if err := o.Build(context.Background()); err != nil {
		log.Fatal(err)
	}
	conf, err := config.New(config.WithOAuthClient(o))
	if err != nil {
		log.Fatal(err)
	}
	qctx, err := quote.NewFromCfg(conf)
	if err != nil {
		log.Fatal(err)
	}
	defer qctx.Close()
	resp, err := qctx.ShortPositions(context.Background(), "TSLA.US", 20)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", resp)
}

Response

Response Example

{
  "code": 0,
  "message": "success",
  "data": [
    {
      "timestamp": "2022-03-15T04:00:00Z",
      "current_shares_short": "111286790",
      "avg_daily_share_volume": "95077016",
      "days_to_cover": "1.17",
      "rate": "0.0068",
      "close": ""
    }
  ]
}
{
  "code": 0,
  "message": "success",
  "data": [
    {
      "timestamp": "2024-06-13T16:00:00Z",
      "amount": "53677721",
      "balance": "20386798436",
      "cost": "379.800",
      "rate": "0.0057"
    }
  ]
}

Response Status

StatusDescriptionSchema
200SuccessSee schemas below
400Bad requestNone

Schemas

US Response (.US symbols)

NameTypeRequiredDescription
dataobject[]falseShort position records
∟ timestampstringfalseSettlement date (RFC 3339, e.g. 2022-03-15T04:00:00Z)
∟ current_shares_shortstringfalseNumber of shares sold short
∟ avg_daily_share_volumestringfalseAverage daily share volume
∟ days_to_coverstringfalseDays to cover (short shares ÷ avg daily vol)
∟ ratestringfalseShort ratio
∟ closestringfalseClosing price for the day

HK Response (.HK symbols)

NameTypeRequiredDescription
dataobject[]falseShort position records
∟ timestampstringfalseTrade date (RFC 3339, e.g. 2022-03-15T04:00:00Z)
∟ amountstringfalseShort selling amount (HKD)
∟ balancestringfalseShort position balance
∟ coststringfalseClosing price for the day
∟ ratestringfalseShort ratio