Longbridge OpenAPI SDK
    Preparing search index...

    Class AssetContext

    Asset context

    Index
    • Get the linked bank cards, with their verification, binding and authorization (eDDA, bank securities account, FPS) status

      AP accounts only: US data-center accounts get a region error.

      const { OAuth, Config, AssetContext } = require('longbridge')

      const oauth = await OAuth.build('your-client-id', (_, url) => console.log('Visit:', url));
      const ctx = AssetContext.new(Config.fromOAuth(oauth));
      const resp = await ctx.bankCards();
      console.log(resp);

      Returns Promise<BankCard[]>

    • Get the eDDA authorization applications of a bank card in one currency

      cardId is BankCard.id; currency is e.g. HKD or USD. The card id must be all digits; any other value fails with an error before anything is sent.

      AP accounts only: US data-center accounts get a region error.

      const { OAuth, Config, AssetContext } = require('longbridge')

      const oauth = await OAuth.build('your-client-id', (_, url) => console.log('Visit:', url));
      const ctx = AssetContext.new(Config.fromOAuth(oauth));
      const resp = await ctx.eddaApplications('12345', 'HKD');
      console.log(resp);

      Parameters

      • cardId: string
      • currency: string

      Returns Promise<EddaApplication[]>

    • Get stock transfer-in applications (another broker to this account)

      AP accounts only: US data-center accounts get a region error.

      const { OAuth, Config, AssetContext } = require('longbridge')

      const oauth = await OAuth.build('your-client-id', (_, url) => console.log('Visit:', url));
      const ctx = AssetContext.new(Config.fromOAuth(oauth));
      const resp = await ctx.stockTransfersIn({ market: 'HK' });
      console.log(resp);

      Parameters

      Returns Promise<StockTransferInResponse>

    • Get stock transfer-out applications (this account to another broker)

      AP accounts only: US data-center accounts get a region error.

      const { OAuth, Config, AssetContext } = require('longbridge')

      const oauth = await OAuth.build('your-client-id', (_, url) => console.log('Visit:', url));
      const ctx = AssetContext.new(Config.fromOAuth(oauth));
      const resp = await ctx.stockTransfersOut();
      console.log(resp);

      Parameters

      Returns Promise<StockTransferOut[]>

    • Get reward records from the reward center (cash, gifts, coupons, task rewards)

      AP accounts only: US data-center accounts get a region error.

      The route has no date filter: to find rewards in a time range, page through the records and filter on their times.

      const { OAuth, Config, AssetContext } = require('longbridge')

      const oauth = await OAuth.build('your-client-id', (_, url) => console.log('Visit:', url));
      const ctx = AssetContext.new(Config.fromOAuth(oauth));
      const resp = await ctx.rewardRecords({ pageSize: 20 });
      console.log(resp);

      Parameters

      Returns Promise<RewardRecordsResponse>

    • Get coupons (reward cards)

      By default lists the coupons that have not expired (set expired). The pinned topList / bottomList are repeated on every page.

      AP accounts only: US data-center accounts get a region error.

      const { OAuth, Config, AssetContext } = require('longbridge')

      const oauth = await OAuth.build('your-client-id', (_, url) => console.log('Visit:', url));
      const ctx = AssetContext.new(Config.fromOAuth(oauth));
      const resp = await ctx.coupons({ expired: false });
      console.log(resp);

      Parameters

      Returns Promise<CouponsResponse>

    • Get the orders a coupon was applied to

      cardId is Coupon.cardId (32 hex characters, not a bank card ID); any other value fails with an error before anything is sent. The gateway rate-limits this route tightly per member, so avoid calling it concurrently.

      AP accounts only: US data-center accounts get a region error.

      const { OAuth, Config, AssetContext } = require('longbridge')

      const oauth = await OAuth.build('your-client-id', (_, url) => console.log('Visit:', url));
      const ctx = AssetContext.new(Config.fromOAuth(oauth));
      const resp = await ctx.couponOrders(couponId, CouponOrderType.Settled);
      console.log(resp);

      Parameters

      Returns Promise<CouponOrder[]>

    • Get one page of deposit records

      The server's total follows the page size rather than the record count, so it is not returned; hasMore reports a full page instead. The page size is always sent: at most 20, default 20.

      AP accounts only: US data-center accounts get a region error.

      const { OAuth, Config, AssetContext } = require('longbridge')

      const oauth = await OAuth.build('your-client-id', (_, url) => console.log('Visit:', url));
      const ctx = AssetContext.new(Config.fromOAuth(oauth));
      const resp = await ctx.deposits({ size: 20 });
      console.log(resp.items, resp.hasMore);

      Parameters

      Returns Promise<DepositsResponse>

    • Get withdrawal records

      hasMore reports a full page of the size sent (default 20, at most 50).

      AP accounts only: US data-center accounts get a region error.

      const { OAuth, Config, AssetContext } = require('longbridge')

      const oauth = await OAuth.build('your-client-id', (_, url) => console.log('Visit:', url));
      const ctx = AssetContext.new(Config.fromOAuth(oauth));
      const resp = await ctx.withdrawals({ size: 20 });
      console.log(resp);

      Parameters

      Returns Promise<WithdrawalsResponse>