Fund Positions

Not for Longbridge US Accounts

This API requires an AP data-center account (HK / SG). US data-center accounts are not supported and have no equivalent API.

The API is used to obtain fund position information including account, fund code, holding share, cost net worth, current net worth, and currency.

>_ CLI
longbridge fund-positions

Request

HTTP MethodGET
HTTP URL/v1/asset/fund

Parameters

Content-Type: application/json; charset=utf-8

NameTypeRequiredDescription
symbolstring[]NOFund code, in ISIN format, E.g:HK0000676327 ISIN explain

Request Example

from longbridge.openapi import TradeContext, Config, OAuthBuilder

oauth = OAuthBuilder("your-client-id").build(lambda url: print("Visit:", url))
config = Config.from_oauth(oauth)
ctx = TradeContext(config)
resp = ctx.fund_positions()
print(resp)
import asyncio
from longbridge.openapi import AsyncTradeContext, 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 = AsyncTradeContext.create(config)
    resp = await ctx.fund_positions()
    print(resp)

if __name__ == "__main__":
    asyncio.run(main())
const { Config, TradeContext, 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 = TradeContext.new(config)
  const resp = await ctx.fundPositions()
  console.log(resp)
}
main().catch(console.error)
import com.longbridge.*;
import com.longbridge.trade.*;

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);
             TradeContext ctx = TradeContext.create(config)) {
            FundPositionsResponse resp = ctx.getFundPositions(null).get();
            System.out.println(resp);
        }
    }
}
use std::sync::Arc;
use longbridge::{oauth::OAuthBuilder, trade::TradeContext, Config};

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

#ifdef WIN32
#include <windows.h>
#endif

using namespace longbridge;
using namespace longbridge::trade;

static void
run(const OAuth& oauth)
{
    Config config = Config::from_oauth(oauth);
    TradeContext ctx = TradeContext::create(config);

    ctx.fund_positions(std::nullopt, [](auto res) {
        if (!res) { std::cout << "failed" << std::endl; return; }
        std::cout << "fund positions" << std::endl;
    });
}

int main(int argc, char const* argv[]) {
#ifdef WIN32
    SetConsoleOutputCP(CP_UTF8);
#endif

    const std::string client_id = "your-client-id";
    OAuthBuilder(client_id).build(
    [](const std::string& url) {
        std::cout << "Open this URL to authorize: " << url << std::endl;
    },
    [](auto res) {
        if (!res) {
            std::cout << "authorization failed: " << *res.status().message() << std::endl;
            return;
        }
        run(*res);
    });

    std::cin.get();
    return 0;
}
package main

import (
	"context"
	"fmt"
	"log"

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

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)
	}
	tctx, err := trade.NewFromCfg(conf)
	if err != nil {
		log.Fatal(err)
	}
	defer tctx.Close()
	positions, err := tctx.FundPositions(context.Background(), []string{"AAPL.US", "700.HK"})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", positions)
}

Response

Response Headers

  • Content-Type: application/json

Response Example

{
  "code": 0,
  "data": {
    "list": [
      {
        "account_channel": "lb",
        "fund_info": [
          {
            "counter_id": "UT/FD/HK0000447943",
            "symbol_name": "GAOTENG EMERGING MARKETS PLUS  LONG/SHORT FIXED INCOME ALPHA FUND",
            "currency": "USD",
            "holding_units": "5.000",
            "current_net_asset_value": "0",
            "cost_net_asset_value": "0.00",
            "net_asset_value_day": "1649865600"
          }
        ]
      }
    ]
  }
}

Response Status

StatusDescriptionSchema
200Successfund_rsp
400Internal ErrorNone

Schemas

fund_rsp

NameTypeRequiredDescription
listobject[]falsestock holding information
∟ account_channelstringtrueaccount type
∟ fund_infoobject[]falseFund Details
∟∟ counter_idstringtrueFund counter id (last /-segment is the ISIN)
∟∟ current_net_asset_valuestringtruecurrent Equity
∟∟ net_asset_value_daystringtruecurrent Equity time
∟∟ symbol_namestringtrueFund name
∟∟ currencystringtrueCurrency
∟∟ cost_net_asset_valuestringtrueNet Cost