@taichunmin/bitfinex - v0.0.11
    Preparing search index...

    Class Bitfinex

    Index

    Constructors

    • Parameters

      • opts: { affCode?: string; apiKey?: string; apiSecret?: string; authToken?: string }

      Returns Bitfinex

    v1

    • 取得 Bitfinex 所有交易對的詳細資訊。

      Returns Promise<
          {
              expiration: string;
              initial_margin: number;
              margin: boolean;
              maximum_order_size: number;
              minimum_margin: number;
              minimum_order_size: number;
              pair: string;
              price_precision: number;
          }[],
      >

      • pair: 交易對代碼
      • price_precision: 價格小數點精確度
      • initial_margin: 初始保證金百分比
      • minimum_margin: 最低保證金百分比
      • maximum_order_size: 最大訂單量
      • minimum_order_size: 最小訂單量
      • expiration: 過期時間
      • margin: 保證金交易是否可用
      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log((await Bitfinex.v1SymbolsDetails())[0])
      /* Expected output:
      {
      expiration: 'NA',
      initial_margin: 10,
      margin: true,
      maximum_order_size: 2000,
      minimum_margin: 5,
      minimum_order_size: 0.00004,
      pair: 'btcusd',
      price_precision: 5
      }
      */

    v2

    • 取得所有的 Bifinex 設定檔。

      Returns Promise<Record<V2ConfigRequest, JsonValue>>

      Bifinex 所有設定檔的內容。

      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2Config())
    • 取得指定的 Bifinex 設定檔。

      Parameters

      Returns Promise<JsonValue>

      Bifinex 設定檔的內容。

      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2Config('pub:spec:site:maintenance'))
      /* Expected output:
      {
      id: 'maintenance-march-06-2023',
      start: '2023-03-06 09:00:00',
      duration: 6,
      url: 'https://blog.bitfinex.com/?p=21173'
      }
      */
    • 取得指定的 Bifinex 設定檔。

      Type Parameters

      Parameters

      • reqs: TReq[]

        設定檔名稱的陣列。

      Returns Promise<Record<TReq, JsonValue>>

      Bifinex 設定檔的內容。

      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2Config(['pub:spec:site:maintenance', 'pub:list:category:securities']))
      /* Expected output:
      {
      'pub:spec:site:maintenance': {
      id: 'maintenance-march-06-2023',
      start: '2023-03-06 09:00:00',
      duration: 6,
      url: 'https://blog.bitfinex.com/?p=21173'
      },
      'pub:list:category:securities': [
      [
      'aifc',
      'AIFC',
      'ALT2612:USD',
      'AIFC',
      'Bitfinex Securities Ltd.'
      ],
      [
      'el_salvador',
      'El Salvador',
      'USTBL:UST',
      'El-Salvador',
      'Bitfinex Securities El Salvador, S.A. de C.V.'
      ]
      ]
      }
      */
    • 取得目前 IP 位址的 GeoIp 資訊。

      Returns Promise<
          {
              area: number;
              city: string;
              country: string;
              eu: boolean;
              ip: string;
              ll: [number, number];
              metro: number;
              range: [number, number];
              region: string;
              timezone: string;
          },
      >

      • ip: IP 位址
      • range: IP 區塊的上下界
      • country: 2 letter ISO-3166-1 country code
      • region: Up to 3 alphanumeric variable length characters as ISO 3166-2 code, For US states this is the 2 letter state, For the United Kingdom this could be ENG as a country like “England", FIPS 10-4 subcountry code
      • eu: 1 if the country is a member state of the European Union, 0 otherwise.
      • timezone: Timezone from IANA Time Zone Database
      • city: full city name
      • ll: The latitude and longitude of the city
      • metro: Metro code
      • area: The approximate accuracy radius (km), around the latitude and longitude
      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2IntGeoIp())
    • 取得目前 Bitfinex 平台的運作狀態。維護狀態通常會持續幾分鐘到幾小時,並且在基礎設施升級期間也有可能進入維護狀態。

      當平台標記為維護模式時,機器人應停止所有交易活動。在維護模式時可能會無法取消訂單和下單。

      Returns Promise<{ status: PlatformStatus }>

      • status: operative = 1, maintenance = 0
      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2PlatformStatus()) // Expected output: { status: 1 }
    • 取得指定交易對目前的行情概覽。它會回傳當前最佳買入價和賣出價、最近成交價,以及昨日至今的每日成交量和價格變動資訊。

      Parameters

      • opts: { pair: string }

        參數說明

        • pair: 交易對代碼

      Returns Promise<
          {
              askPrice: number;
              askSize: number;
              bidPrice: number;
              bidSize: number;
              dailyChange: number;
              dailyChangeRelative: number;
              high: number;
              lastPrice: number;
              low: number;
              pair: string;
              symbol: string;
              volume: number;
          },
      >

      • symbol: 交易對代碼
      • pair: 交易對代碼
      • bidPrice: 最高的買入價
      • bidSize: 最高的 25 個買入價總數量
      • askPrice: 最低的賣出價
      • askSize: 最低的 25 個賣出價總數量
      • dailyChange: 昨日至今的價格變化量
      • dailyChangeRelative: 昨日至今的相對價格變化(乘以 100 即為百分比變化)
      • lastPrice: 最新成交價
      • volume: 昨日至今的成交量
      • high: 昨日至今的最高價
      • low: 昨日至今的最低價
      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2Ticker({ pair: 'BTCUSD' }))
      /* Expected output:
      {
      symbol: 'tBTCUSD',
      bidPrice: 82388,
      bidSize: 10.16663748,
      askPrice: 82389,
      askSize: 4.73069672,
      dailyChange: -1154,
      dailyChangeRelative: -0.01381821,
      lastPrice: 82359,
      volume: 715.62902556,
      high: 83697,
      low: 81481,
      pair: 'BTCUSD'
      }
      */
    • 取得指定融資貨幣目前的行情概覽。它會回傳當前最佳買入價和賣出價、最近成交價,以及昨日至今的每日成交量和價格變動資訊。

      Parameters

      • opts: { currency: string }

        參數說明

        • currency: 貨幣代碼

      Returns Promise<
          {
              apr: number;
              askPeriod: number;
              askPrice: number;
              askSize: number;
              bidPeriod: number;
              bidPrice: number;
              bidSize: number;
              currency: string;
              dailyChange: number;
              dailyChangePerc: number;
              dpr: number;
              frr: number;
              frrAmountAvailable: number;
              high: number;
              lastPrice: number;
              low: number;
              symbol: string;
              volume: number;
          },
      >

      • symbol: 融資代碼
      • currency: 貨幣代碼
      • frr: Flash Return Rate
      • dpr: Daily Percentage Rate,由公式 frr * 100 計算產生
      • apr: Annual Percentage Rate,由公式 frr * 100 * 365 計算產生
      • bidPrice: 最高的貸款利率
      • bidPeriod: 最高貸款利率的天數
      • bidSize: 最高的 25 個貸款利率的總數量
      • askPrice: 最低的放款利率
      • askPeriod: 最低放款利率的天數
      • askSize: 最低的 25 個放款利率的總數量
      • dailyChange: 昨日至今的利率變化量
      • dailyChangePerc: 昨日至今的相對利率變化(乘以 100 即為百分比變化)
      • lastPrice: 最新成交利率
      • volume: 昨日至今的成交量
      • high: 昨日至今的最高利率
      • low: 昨日至今的最低利率
      • frrAmountAvailable: 以 FRR 進行貸款或放款的數量
      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2Ticker({ currency: 'USD' }))
      /* Expected output:
      {
      symbol: 'fUSD',
      frr: 0.0003347671232876712,
      bidPrice: 0.0003347671232876712,
      bidPeriod: 30,
      bidSize: 33194024.88639909,
      askPrice: 0.0001639,
      askPeriod: 2,
      askSize: 42436.36607463,
      dailyChange: -9.1e-7,
      dailyChangePerc: -0.0061,
      lastPrice: 0.00014799,
      volume: 143727499.90044996,
      high: 0.00059907,
      low: 0.00007945,
      frrAmountAvailable: 45904.65709059,
      currency: 'USD',
      dpr: 0.03347671,
      apr: 12.219
      }
      */
    • 取得指定交易對或融資貨幣目前的行情概覽。它會回傳當前最佳買入價和賣出價、最近成交價,以及昨日至今的每日成交量和價格變動資訊。

      Parameters

      • opts: { symbol: string }

        參數說明

        • symbol: 交易對或融資貨幣

      Returns Promise<
          | {
              askPrice: number;
              askSize: number;
              bidPrice: number;
              bidSize: number;
              dailyChange: number;
              dailyChangeRelative: number;
              high: number;
              lastPrice: number;
              low: number;
              pair: string;
              symbol: string;
              volume: number;
          }
          | {
              apr: number;
              askPeriod: number;
              askPrice: number;
              askSize: number;
              bidPeriod: number;
              bidPrice: number;
              bidSize: number;
              currency: string;
              dailyChange: number;
              dailyChangePerc: number;
              dpr: number;
              frr: number;
              frrAmountAvailable: number;
              high: number;
              lastPrice: number;
              low: number;
              symbol: string;
              volume: number;
          },
      >

      • 交易對的行情概覽欄位
        • symbol: 交易對代碼
        • pair: 交易對代碼
        • bidPrice: 最高的買入價
        • bidSize: 最高的 25 個買入價總數量
        • askPrice: 最低的賣出價
        • askSize: 最低的 25 個賣出價總數量
        • dailyChange: 昨日至今的價格變化量
        • dailyChangeRelative: 昨日至今的相對價格變化(乘以 100 即為百分比變化)
        • lastPrice: 最新成交價
        • volume: 昨日至今的成交量
        • high: 昨日至今的最高價
        • low: 昨日至今的最低價
      • 融資的行情概覽欄位
        • symbol: 融資代碼
        • currency: 貨幣代碼
        • frr: Flash Return Rate
        • dpr: Daily Percentage Rate,由公式 frr * 100 計算產生
        • apr: Annual Percentage Rate,由公式 frr * 100 * 365 計算產生
        • bidPrice: 最高的貸款利率
        • bidPeriod: 最高貸款利率的天數
        • bidSize: 最高的 25 個貸款利率的總數量
        • askPrice: 最低的放款利率
        • askPeriod: 最低放款利率的天數
        • askSize: 最低的 25 個放款利率的總數量
        • dailyChange: 昨日至今的利率變化量
        • dailyChangePerc: 昨日至今的相對利率變化(乘以 100 即為百分比變化)
        • lastPrice: 最新成交利率
        • volume: 昨日至今的成交量
        • high: 昨日至今的最高利率
        • low: 昨日至今的最低利率
        • frrAmountAvailable: 以 FRR 進行貸款或放款的數量
      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2Ticker({ symbol: 'tBTCUSD' }))
      console.log(await Bitfinex.v2Ticker({ symbol: 'fUSD' }))
    • 取得交易對以及融資目前的行情概覽。它會回傳當前最佳買入價和賣出價、最近成交價,以及昨日至今的每日成交量和價格變動資訊。這個 API 允許同時取得多個交易對及融資的行情資訊。

      Parameters

      • opts: { symbols?: string | string[] } = {}

        參數說明

        • symbols: 交易對或融資貨幣的陣列,或指定 ALL 取得全部的行情概覽,預設為 ALL

      Returns Promise<
          (
              | {
                  askPrice: number;
                  askSize: number;
                  bidPrice: number;
                  bidSize: number;
                  dailyChange: number;
                  dailyChangeRelative: number;
                  high: number;
                  lastPrice: number;
                  low: number;
                  pair: string;
                  symbol: string;
                  volume: number;
              }
              | {
                  apr: number;
                  askPeriod: number;
                  askPrice: number;
                  askSize: number;
                  bidPeriod: number;
                  bidPrice: number;
                  bidSize: number;
                  currency: string;
                  dailyChange: number;
                  dailyChangePerc: number;
                  dpr: number;
                  frr: number;
                  frrAmountAvailable: number;
                  high: number;
                  lastPrice: number;
                  low: number;
                  symbol: string;
                  volume: number;
              }
          )[],
      >

      • 交易對的行情概覽欄位
        • symbol: 交易對代碼
        • pair: 交易對代碼
        • bidPrice: 最高的買入價
        • bidSize: 最高的 25 個買入價總數量
        • askPrice: 最低的賣出價
        • askSize: 最低的 25 個賣出價總數量
        • dailyChange: 昨日至今的價格變化量
        • dailyChangeRelative: 昨日至今的相對價格變化(乘以 100 即為百分比變化)
        • lastPrice: 最新成交價
        • volume: 昨日至今的成交量
        • high: 昨日至今的最高價
        • low: 昨日至今的最低價
      • 融資的行情概覽欄位
        • symbol: 融資代碼
        • currency: 貨幣代碼
        • frr: Flash Return Rate
        • dpr: Daily Percentage Rate,由公式 frr * 100 計算產生
        • apr: Annual Percentage Rate,由公式 frr * 100 * 365 計算產生
        • bidPrice: 最高的貸款利率
        • bidPeriod: 最高貸款利率的天數
        • bidSize: 最高的 25 個貸款利率的總數量
        • askPrice: 最低的放款利率
        • askPeriod: 最低放款利率的天數
        • askSize: 最低的 25 個放款利率的總數量
        • dailyChange: 昨日至今的利率變化量
        • dailyChangePerc: 昨日至今的相對利率變化(乘以 100 即為百分比變化)
        • lastPrice: 最新成交利率
        • volume: 昨日至今的成交量
        • high: 昨日至今的最高利率
        • low: 昨日至今的最低利率
        • frrAmountAvailable: 以 FRR 進行貸款或放款的數量
      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2Tickers()) // default: ALL symbols
      console.log(await Bitfinex.v2Tickers({ symbols: 'fUSD' }))
      console.log(await Bitfinex.v2Tickers({ symbols: ['tBTCUSD', 'fUSD'] }))
      /* Expected output:
      [
      {
      symbol: 'tBTCUSD',
      bidPrice: 82254,
      bidSize: 8.81387677,
      askPrice: 82255,
      askSize: 7.91928646,
      dailyChange: -1272,
      dailyChangeRelative: -0.01523116,
      lastPrice: 82241,
      volume: 716.48201682,
      high: 83697,
      low: 81481,
      pair: 'BTCUSD'
      },
      {
      symbol: 'fUSD',
      frr: 0.0003347671232876712,
      bidPrice: 0.0003347671232876712,
      bidPeriod: 30,
      bidSize: 33193866.53816909,
      askPrice: 0.00035676,
      askPeriod: 4,
      askSize: 442678.99810842,
      dailyChange: 0.0002188,
      dailyChangePerc: 1.4694,
      lastPrice: 0.0003677,
      volume: 144225957.2861548,
      high: 0.00059907,
      low: 0.00007945,
      frrAmountAvailable: 0,
      currency: 'USD',
      dpr: 0.03347671,
      apr: 12.219
      }
      ]
      */
    • 取得指定交易對行情概覽的歷史記錄,它會回傳以小時為單位的最佳買入價及賣出價。

      Parameters

      • opts: { end?: Date; limit?: number; start?: Date; symbols?: string | string[] } = {}

        參數說明

        • symbols: 交易對的陣列,或指定 ALL 取得全部的行情概覽,預設為 ALL。目前不支援融資貨幣。
        • start: 回傳的記錄中,mts 欄位不小於此值
        • end: 回傳的記錄中,mts 欄位不大於此值
        • limit: 回傳的記錄數量上限,最大 250,預設為 125

      Returns Promise<
          {
              askPrice: number;
              bidPrice: number;
              mts: Date;
              pair?: string;
              symbol: string;
          }[],
      >

      • symbol: 交易對代碼
      • pair: 交易對代碼
      • bidPrice: 最高的買入價
      • askPrice: 最低的賣出價
      • mts: 記錄的時間
      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2TickersHist()) // default: ALL symbols
      console.log(await Bitfinex.v2TickersHist({ symbols: ['tBTCUSD', 'tETHUSD'], limit: 2 }))
      console.log(await Bitfinex.v2TickersHist({ symbols: 'tBTCUSD', limit: 2 }))
      /* Expected output:
      [
      {
      symbol: 'tBTCUSD',
      bidPrice: 82201,
      askPrice: 82202,
      mts: 2025-03-31T07:00:03.000Z,
      pair: 'BTCUSD'
      },
      {
      symbol: 'tBTCUSD',
      bidPrice: 82345,
      askPrice: 82346,
      mts: 2025-03-31T06:00:03.000Z,
      pair: 'BTCUSD'
      }
      ]
      */

    v2/candles

    • 取得指定交易對 pair 的歷史 K 棒。

      Parameters

      • opts: {
            end?: Date;
            limit?: number;
            pair: string;
            sort?: ASC | DESC;
            start?: Date;
            timeframe?:
                | "1m"
                | "5m"
                | "15m"
                | "30m"
                | "1h"
                | "3h"
                | "6h"
                | "12h"
                | "1D"
                | "1W"
                | "14D"
                | "1M";
        }

        參數說明

        • timeframe: 時間框架,預設為 1h
        • pair: 交易對代碼,預設為 BTCUSD
        • limit: 資料筆數的上限,最大 10000
        • sort: 根據 mts 欄位將交易記錄以指定的方式進行排序,預設為 BitfinexSort.DESC
        • start: 回傳的交易記錄中,mts 欄位不小於此值
        • end: 回傳的交易記錄中,mts 欄位不大於此值

      Returns Promise<
          {
              close: number;
              high: number;
              low: number;
              mts: Date;
              open: number;
              volume: number;
          }[],
      >

      • mts: 成交時間
      • open: 開盤價
      • close: 收盤價
      • high: 最高價
      • low: 最低價
      • volume: 成交量
      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2CandlesHist({ pair: 'BTCUSD', timeframe: '1h', limit: 1 }))
      /* Expected output:
      [
      {
      mts: 2025-03-31T08:00:00.000Z,
      open: 82073,
      close: 82206,
      high: 82388,
      low: 82073,
      volume: 1.84279286
      }
      ]
      */
    • 取得指定融資貨幣 currency 的歷史 K 棒。

      Parameters

      • opts: {
            currency: string;
            end?: Date;
            limit?: number;
            period: number;
            sort?: ASC | DESC;
            start?: Date;
            timeframe?:
                | "1m"
                | "5m"
                | "15m"
                | "30m"
                | "1h"
                | "3h"
                | "6h"
                | "12h"
                | "1D"
                | "1W"
                | "14D"
                | "1M";
        }

        參數說明

        • timeframe: 時間框架,預設為 1h
        • currency: 貨幣代碼,預設為 USD
        • period: 融資天數,預設為 2
        • limit: 資料筆數的上限,最大 10000
        • sort: 根據 mts 欄位將交易記錄以指定的方式進行排序,預設為 BitfinexSort.DESC
        • start: 回傳的交易記錄中,mts 欄位不小於此值
        • end: 回傳的交易記錄中,mts 欄位不大於此值

      Returns Promise<
          {
              close: number;
              high: number;
              low: number;
              mts: Date;
              open: number;
              volume: number;
          }[],
      >

      • mts: 成交時間
      • open: 開盤利率
      • close: 收盤利率
      • high: 最高利率
      • low: 最低利率
      • volume: 成交量
      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2CandlesHist({ currency: 'USD', timeframe: '1h', period: 2, limit: 1 }))
      /* Expected output:
      [
      {
      mts: 2025-03-31T08:00:00.000Z,
      open: 0.00025,
      close: 0.00042729,
      high: 0.00042729,
      low: 0.00025,
      volume: 79474.06069641
      }
      ]
      */
    • 取得指定融資貨幣 currency 的歷史 K 棒。

      Parameters

      • opts: {
            aggregation?: 10 | 30;
            currency: string;
            end?: Date;
            limit?: number;
            periodEnd: number;
            periodStart: number;
            sort?: ASC | DESC;
            start?: Date;
            timeframe?:
                | "1m"
                | "5m"
                | "15m"
                | "30m"
                | "1h"
                | "3h"
                | "6h"
                | "12h"
                | "1D"
                | "1W"
                | "14D"
                | "1M";
        }

        參數說明

        • timeframe: 時間框架,預設為 1h
        • currency: 貨幣代碼,預設為 USD
        • periodStart: 融資天數的開始範圍
        • periodEnd: 融資天數的結束範圍
        • aggregation: 資料聚合的方式,可指定 1030,預設為 30
        • limit: 資料筆數的上限,最大 10000
        • sort: 根據 mts 欄位將交易記錄以指定的方式進行排序,預設為 BitfinexSort.DESC
        • start: 回傳的交易記錄中,mts 欄位不小於此值
        • end: 回傳的交易記錄中,mts 欄位不大於此值

      Returns Promise<
          {
              close: number;
              high: number;
              low: number;
              mts: Date;
              open: number;
              volume: number;
          }[],
      >

      • mts: 成交時間
      • open: 開盤利率
      • close: 收盤利率
      • high: 最高利率
      • low: 最低利率
      • volume: 成交量
      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2CandlesHist({ currency: 'USD', timeframe: '1h', periodStart: 2, periodEnd: 30, aggregation: 30, limit: 1 }))
      /* Expected output:
      [
      {
      mts: 2025-03-31T08:00:00.000Z,
      open: 0.00025,
      close: 0.0004273,
      high: 0.0004273,
      low: 0.00025,
      volume: 255358.55160453
      }
      ]
      */
    • 取得指定交易對 pair 的最新 K 棒。

      Parameters

      • opts: {
            end?: Date;
            pair: string;
            sort?: ASC | DESC;
            start?: Date;
            timeframe?:
                | "1m"
                | "5m"
                | "15m"
                | "30m"
                | "1h"
                | "3h"
                | "6h"
                | "12h"
                | "1D"
                | "1W"
                | "14D"
                | "1M";
        }

        參數說明

        • timeframe: 時間框架,預設為 1h
        • pair: 交易對代碼,預設為 BTCUSD
        • sort: 根據 mts 欄位將交易記錄以指定的方式進行排序,預設為 BitfinexSort.DESC
        • start: 回傳的交易記錄中,mts 欄位不小於此值
        • end: 回傳的交易記錄中,mts 欄位不大於此值

      Returns Promise<
          {
              close: number;
              high: number;
              low: number;
              mts: Date;
              open: number;
              volume: number;
          },
      >

      • mts: 成交時間
      • open: 開盤價
      • close: 收盤價
      • high: 最高價
      • low: 最低價
      • volume: 成交量
      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2CandlesLast({ pair: 'BTCUSD', timeframe: '1h' }))
      /* Expected output:
      {
      mts: 2025-03-31T08:00:00.000Z,
      open: 82073,
      close: 82381,
      high: 82388,
      low: 82073,
      volume: 1.71526122
      }
      */
    • 取得指定融資貨幣 currency 的最新 K 棒。

      Parameters

      • opts: {
            currency: string;
            end?: Date;
            period: number;
            sort?: ASC | DESC;
            start?: Date;
            timeframe?:
                | "1m"
                | "5m"
                | "15m"
                | "30m"
                | "1h"
                | "3h"
                | "6h"
                | "12h"
                | "1D"
                | "1W"
                | "14D"
                | "1M";
        }

        參數說明

        • timeframe: 時間框架,預設為 1h
        • currency: 貨幣代碼,預設為 USD
        • period: 融資天數,預設為 2
        • sort: 根據 mts 欄位將交易記錄以指定的方式進行排序,預設為 BitfinexSort.DESC
        • start: 回傳的交易記錄中,mts 欄位不小於此值
        • end: 回傳的交易記錄中,mts 欄位不大於此值

      Returns Promise<
          {
              close: number;
              high: number;
              low: number;
              mts: Date;
              open: number;
              volume: number;
          },
      >

      • mts: 成交時間
      • open: 開盤利率
      • close: 收盤利率
      • high: 最高利率
      • low: 最低利率
      • volume: 成交量
      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2CandlesLast({ currency: 'USD', timeframe: '1h', period: 2 }))
      /* Expected output:
      {
      mts: 2025-03-31T08:00:00.000Z,
      open: 0.00025,
      close: 0.00042729,
      high: 0.00042729,
      low: 0.00025,
      volume: 79474.06069641
      }
      */
    • 取得指定融資貨幣 currency 的最新 K 棒。

      Parameters

      • opts: {
            aggregation?: 10 | 30;
            currency: string;
            end?: Date;
            periodEnd: number;
            periodStart: number;
            sort?: ASC | DESC;
            start?: Date;
            timeframe?:
                | "1m"
                | "5m"
                | "15m"
                | "30m"
                | "1h"
                | "3h"
                | "6h"
                | "12h"
                | "1D"
                | "1W"
                | "14D"
                | "1M";
        }

        參數說明

        • timeframe: 時間框架,預設為 1h
        • currency: 貨幣代碼,預設為 USD
        • periodStart: 融資天數的開始範圍
        • periodEnd: 融資天數的結束範圍
        • aggregation: 資料聚合的方式,可指定 1030,預設為 30
        • sort: 根據 mts 欄位將交易記錄以指定的方式進行排序,預設為 BitfinexSort.DESC
        • start: 回傳的交易記錄中,mts 欄位不小於此值
        • end: 回傳的交易記錄中,mts 欄位不大於此值

      Returns Promise<
          {
              close: number;
              high: number;
              low: number;
              mts: Date;
              open: number;
              volume: number;
          },
      >

      • mts: 成交時間
      • open: 開盤利率
      • close: 收盤利率
      • high: 最高利率
      • low: 最低利率
      • volume: 成交量
      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2CandlesLast({ currency: 'USD', timeframe: '1h', periodStart: 2, periodEnd: 30, aggregation: 30 }))
      /* Expected output:
      {
      mts: 2025-03-31T08:00:00.000Z,
      open: 0.00025,
      close: 0.0004273,
      high: 0.0004273,
      low: 0.00025,
      volume: 255358.55160453
      }
      */

    v2/funding

    • 取得指定貨幣最近的融資統計記錄

      Parameters

      • opts: { currency?: string; end?: Date; limit?: number; start?: Date } = {}

        參數說明

        • currency: 貨幣代碼,預設為 USD
        • limit: 回傳的融資統計記錄數量上限,最大 250
        • start: 回傳的融資統計記錄中,mts 欄位不小於此值
        • end: 回傳的融資統計記錄中,mts 欄位不大於此值

      Returns Promise<
          {
              amount: number;
              amountUsed: number;
              apr: number;
              avgPeriod: number;
              belowThreshold: number;
              frr: number;
              frrDiv365: number;
              mts: Date;
          }[],
      >

      • mts: 融資統計記錄的產生時間
      • frrDiv365: Flash Return Rate 除以 365
      • frr: Flash Return Rate
      • apr: 年利率 Annual Percentage Rate,由公式 frr * 365 計算產生
      • avgPeriod: 平均融資天數
      • amount: 融資貨幣總數量
      • amountUsed: 已使用的融資貨幣數量
      • belowThreshold: 低於 0.75% 的融資貨幣掛單數量
      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2FundingStatsHist({ currency: 'USD', limit: 1 }))
      /* Expected output:
      [
      {
      mts: 2025-03-31T08:05:00.000Z,
      frrDiv365: 9.2e-7,
      avgPeriod: 76.12,
      amount: 3401493724.8104763,
      amountUsed: 3268364679.8992467,
      belowThreshold: 126893437.13542865,
      frr: 0.0003358,
      apr: 0.122567
      }
      ]
      */

    v2/trades

    • 取得指定交易對的成交記錄。

      Parameters

      • opts: { end?: Date; limit?: number; pair: string; sort?: ASC | DESC; start?: Date }

        參數說明

        • pair: 交易對代碼
        • limit: 回傳的交易記錄數量上限,最大 10000,預設為 125
        • sort: 根據 mts 欄位將交易記錄以指定的方式進行排序,預設為 BitfinexSort.DESC
        • start: 回傳的交易記錄中,mts 欄位不小於此值
        • end: 回傳的交易記錄中,mts 欄位不大於此值

      Returns Promise<{ amount: number; id: number; mts: Date; price: number }[]>

      • id: 交易 ID
      • mts: 成交時間
      • amount: 成交數量,買入為正,賣出為負。
      • price: 成交價格
      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2TradesHist({ pair: 'BTCUSD', limit: 1 }))
      /* Expected output:
      [
      {
      amount: 0.00014115,
      id: 1744148660,
      mts: 2025-03-31T07:28:25.296Z,
      price: 82139
      }
      ]
      */
    • 取得指定融資的成交記錄。

      Parameters

      • opts: {
            currency: string;
            end?: Date;
            limit?: number;
            sort?: ASC | DESC;
            start?: Date;
        }

        參數說明

        • currency: 貨幣代碼
        • limit: 回傳的交易記錄數量上限,最大 10000,預設為 125
        • sort: 根據 mts 欄位將交易記錄以指定的方式進行排序,預設為 BitfinexSort.DESC
        • start: 回傳的交易記錄中,mts 欄位不小於此值
        • end: 回傳的交易記錄中,mts 欄位不大於此值

      Returns Promise<
          { amount: number; id: number; mts: Date; period: number; rate: number }[],
      >

      • id: 交易 ID
      • mts: 成交時間
      • amount: 成交數量,買入為正,賣出為負。
      • rate: 融資成交利率
      • peroid: 融資天數
      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2TradesHist({ currency: 'USD', limit: 1 }))
      /* Expected output:
      [
      {
      amount: -4639.47753284,
      id: 356901557,
      mts: 2025-03-31T07:30:32.482Z,
      period: 2,
      rate: 0.00015
      }
      ]
      */
    • 取得指定交易對或融資的成交記錄。

      Parameters

      • opts: { end?: Date; limit?: number; sort?: ASC | DESC; start?: Date; symbol: string }

        參數說明

        • symbol: 交易對或融資代碼
        • limit: 回傳的交易記錄數量上限,最大 10000,預設為 125
        • sort: 根據 mts 欄位將交易記錄以指定的方式進行排序,預設為 BitfinexSort.DESC
        • start: 回傳的交易記錄中,mts 欄位不小於此值
        • end: 回傳的交易記錄中,mts 欄位不大於此值

      Returns Promise<
          | { amount: number; id: number; mts: Date; price: number }[]
          | { amount: number; id: number; mts: Date; period: number; rate: number }[],
      >

      • 如果 symbol 是交易對代碼時:
        • id: 交易 ID
        • mts: 成交時間
        • amount: 成交數量,買入為正,賣出為負。
        • price: 成交價格
      • 如果 symbol 是融資代碼時:
        • id: 交易 ID
        • mts: 成交時間
        • amount: 成交數量,買入為正,賣出為負。
        • rate: 融資成交利率
        • peroid: 融資天數
      const { Bitfinex } = require('@taichunmin/bitfinex')

      console.log(await Bitfinex.v2TradesHist({ symbol: 'fUSD', limit: 1 }))
      console.log(await Bitfinex.v2TradesHist({ symbol: 'tBTCUSD', limit: 1 }))

    v2/auth

    • 取得目前 apiKey 或 token 的權限。

      Returns Promise<Record<string, { read: boolean; write: boolean }>>

      apiKey = 'apiKey'
      apiSecret = 'apiSecret'

      await (async () => {
      try {
      const util = require('node:util')
      const { Bitfinex } = require('@taichunmin/bitfinex')
      const bitfinex = new Bitfinex({ apiKey, apiSecret })
      const perms = await bitfinex.v2AuthReadPermissions()
      console.log(util.inspect(perms))
      } catch (err) {
      console.log(err)
      }
      })()

      /* Expected output:
      {
      account: { read: false, write: false },
      history: { read: true, write: false },
      orders: { read: false, write: false },
      positions: { read: false, write: false },
      funding: { read: true, write: true },
      settings: { read: false, write: false },
      wallets: { read: true, write: false },
      withdraw: { read: false, write: false },
      ui_withdraw: { read: false, write: false },
      bfxpay: { read: false, write: false },
      eaas_agreement: { read: false, write: false },
      eaas_withdraw: { read: false, write: false },
      eaas_deposit: { read: false, write: false },
      eaas_brokerage: { read: false, write: false }
      }
      */
    • 取得錢包的資訊。

      Returns Promise<
          {
              availableBalance: number;
              balance: number;
              currency: string;
              lastChange: Record<string, JsonValue>;
              type: string;
              unsettledInterest: number;
          }[],
      >

      • type: 錢包類型
      • currency: 貨幣代碼
      • balance: 餘額
      • unsettledInterest: 未結算的資金
      • availableBalance: 可動用餘額
      • lastChange: 最後一筆帳目異動的記錄
      • lastChange.desc: 最後一筆帳目異動的描述
      apiKey = 'apiKey'
      apiSecret = 'apiSecret'

      await (async () => {
      try {
      const { Bitfinex } = require('@taichunmin/bitfinex')
      const bitfinex = new Bitfinex({ apiKey, apiSecret })
      console.log((await bitfinex.v2AuthReadWallets())?.[0])
      } catch (err) {
      console.log(err)
      }
      })()

      /* Expected output:
      {
      availableBalance: 0.00001,
      balance: 0.00001,
      currency: 'TRX',
      lastChange: {},
      type: 'exchange',
      unsettledInterest: 0
      }
      */

    v2/auth/funding

    • 取得指定融資貨幣的自動借出設定

      Parameters

      • opts: { currency: string }

        參數說明

        • currency: 貨幣代碼

      Returns Promise<
          | null
          | { amount: number; currency: string; period: number; rate: number },
      >

      • currency: 貨幣代碼
      • period: 融資天數
      • rate: 融資利率
      • amount: 融資最大數量,0 代表無限制

      若回傳 null 代表沒有啟用自動借出。

      apiKey = 'apiKey'
      apiSecret = 'apiSecret'

      await (async () => {
      try {
      const { Bitfinex } = require('@taichunmin/bitfinex')
      const bitfinex = new Bitfinex({ apiKey, apiSecret })
      console.log(await bitfinex.v2AuthReadFundingAutoStatus({ currency: 'USD' }))
      } catch (err) {
      console.log(err)
      }
      })()

      /* Expected output:
      { amount: 0, currency: 'USD', period: 5, rate: 0.00034405 }
      */
    • 取得目前出借中或是借入中的融資記錄。

      Parameters

      • opts: { currency?: string } = {}

        參數說明

        • currency: 貨幣代碼,如果未指定則回傳所有貨幣的融資記錄。

      Returns Promise<
          {
              amount: number;
              currency: string;
              flags: JsonValue;
              hidden: boolean;
              id: number;
              mtsCreate: Date;
              mtsLastPayout: Date;
              mtsOpening: Date;
              mtsUpdate: Date;
              noClose: boolean;
              notify: boolean;
              period: number;
              positionPair: string;
              rate: number;
              rateType: string;
              renew: boolean;
              side: number;
              status: string;
              symbol: string;
          }[],
      >

      • id: 融資記錄 ID
      • symbol: 融資代碼
      • currency: 貨幣代碼
      • side: 融資方向,1 代表為貸方,0 代表同時為貸方與借款人,-1 代表為借款人
      • amount: 融資金額
      • flags: 融資參數 (目前未定義)
      • status: 融資狀態 ACTIVE
      • rateType: 融資利率類型,FIXED 代表固定利率,VAR 代表基於 FRR 浮動利率
      • rate: 融資利率
      • period: 融資天數
      • notify: 是否通知
      • hidden: 是否隱藏
      • renew: 是否自動續借
      • noClose: 在保證金交易被關閉時是否自動結束融資
      • positionPair: 保證金交易的交易對
      • mtsOpening: 融資開始時間
      • mtsLastPayout: 最後一次支付時間
      • mtsCreate: 建立時間
      • mtsUpdate: 最後更新時間
      apiKey = 'apiKey'
      apiSecret = 'apiSecret'

      await (async () => {
      try {
      const { Bitfinex } = require('@taichunmin/bitfinex')
      const bitfinex = new Bitfinex({ apiKey, apiSecret })
      console.log((await bitfinex.v2AuthReadFundingCredits())?.[0])
      } catch (err) {
      console.log(err)
      }
      })()

      /* Expected output:
      [
      {
      amount: 1027.10723507,
      flags: 0,
      hidden: false,
      id: 402617569,
      mtsCreate: 2025-03-31T08:50:47.000Z,
      mtsLastPayout: 1970-01-01T00:00:00.000Z,
      mtsOpening: 2025-03-31T08:50:47.000Z,
      mtsUpdate: 2025-03-31T08:50:47.000Z,
      noClose: false,
      notify: false,
      period: 2,
      positionPair: 'tBTCUST',
      rate: 0.00019958,
      rateType: 'FIXED',
      renew: false,
      side: 1,
      status: 'ACTIVE',
      symbol: 'fUST',
      currency: 'UST'
      }
      ]
      */
    • 取得已結束的融資記錄。

      Parameters

      • opts: { currency?: string; end?: Date; limit?: number; start?: Date } = {}

        參數說明

        • currency: 貨幣代碼,如果未指定則回傳所有貨幣的融資記錄
        • limit: 回傳的融資記錄數量上限,最大 500
        • start: 回傳的融資記錄中,mts 欄位不小於此值
        • end: 回傳的融資記錄中,mts 欄位不大於此值

      Returns Promise<
          {
              amount: number;
              currency: string;
              flags: JsonValue;
              hidden: boolean;
              id: number;
              mtsCreate: Date;
              mtsLastPayout: Date;
              mtsOpening: Date;
              mtsUpdate: Date;
              noClose: boolean;
              notify: boolean;
              period: number;
              positionPair: string;
              rate: number;
              rateType: string;
              renew: boolean;
              side: number;
              status: string;
              symbol: string;
          }[],
      >

      • id: 融資記錄 ID
      • symbol: 融資代碼
      • currency: 貨幣代碼
      • side: 融資方向,1 代表為貸方,0 代表同時為貸方與借款人,-1 代表為借款人
      • amount: 融資金額
      • flags: 融資參數 (目前未定義)
      • status: 融資狀態 CLOSED (expired)
      • rateType: 融資利率類型,FIXED 代表固定利率,VAR 代表基於 FRR 浮動利率
      • rate: 融資利率
      • period: 融資天數
      • notify: 是否通知
      • hidden: 是否隱藏
      • renew: 是否自動續借
      • noClose: 在保證金交易被關閉時是否自動結束融資
      • positionPair: 保證金交易的交易對
      • mtsOpening: 融資開始時間
      • mtsLastPayout: 最後一次支付時間
      • mtsCreate: 建立時間
      • mtsUpdate: 最後更新時間
      apiKey = 'apiKey'
      apiSecret = 'apiSecret'

      await (async () => {
      try {
      const { Bitfinex } = require('@taichunmin/bitfinex')
      const bitfinex = new Bitfinex({ apiKey, apiSecret })
      console.log(await bitfinex.v2AuthReadFundingCreditsHist({ limit: 1 }))
      } catch (err) {
      console.log(err)
      }
      })()

      /* Expected output:
      [
      {
      amount: 850.29527051,
      flags: null,
      hidden: false,
      id: 402392161,
      mtsCreate: 2025-03-27T00:50:47.000Z,
      mtsLastPayout: 2025-03-31T00:51:03.000Z,
      mtsOpening: 2025-03-27T00:50:47.000Z,
      mtsUpdate: 2025-03-30T19:28:55.000Z,
      noClose: false,
      notify: false,
      period: 4,
      positionPair: 'tBTCUST',
      rate: 0.00031771,
      rateType: 'FIXED',
      renew: false,
      side: 1,
      status: 'CLOSED (expired)',
      symbol: 'fUST',
      currency: 'UST'
      }
      ]
      */
    • 取得融資目前的掛單,如果有指定 currency,則只會回傳該融資代碼的掛單。如果沒有指定 currency,則會回傳全部的掛單。

      Parameters

      • opts: { currency?: string } = {}

        參數說明

        • currency: 貨幣代碼

      Returns Promise<
          {
              amount: number;
              amountOrig: number;
              currency: string;
              flags?: any;
              hidden: boolean;
              id: number;
              mtsCreate: Date;
              mtsUpdate: Date;
              notify: boolean;
              period: number;
              rate: number;
              renew: boolean;
              status: string;
              symbol: string;
              type: string;
          }[],
      >

      • id: 掛單 ID
      • symbol: 掛單的融資代碼 (fUSD, etc)
      • currency: 貨幣代碼
      • mtsCreate: 建立的時間戳
      • mtsUpdate: 更新的時間戳
      • amount: 掛單的金額
      • amountOrig: 掛單的初始金額
      • type: 掛單類型 (LIMIT, ...)
      • flags: 合約的相關參數 (TBD)
      • status: 掛單的狀態 (ACTIVE, PARTIALLY FILLED)
      • rate: 掛單的利率
      • period: 掛單的天數
      • notify: 是否通知
      • hidden: 是否隱藏
      • renew: 是否自動續借
      apiKey = 'apiKey'
      apiSecret = 'apiSecret'

      await (async () => {
      try {
      const { Bitfinex } = require('@taichunmin/bitfinex')
      const bitfinex = new Bitfinex({ apiKey, apiSecret })
      console.log((await bitfinex.v2AuthReadFundingOffers())?.[0])
      } catch (err) {
      console.log(err)
      }
      })()

      /* Expected output:
      {
      amount: 1010.5521123,
      amountOrig: 1010.5521123,
      flags: null,
      hidden: false,
      id: 3854301834,
      mtsCreate: '2025-04-03T04:58:08.000Z',
      mtsUpdate: '2025-04-03T04:58:08.000Z',
      notify: false,
      period: 6,
      rate: 0.00039459,
      renew: false,
      status: 'ACTIVE',
      symbol: 'fUSD',
      type: 'LIMIT',
      currency: 'USD'
      }
      */
    • 取得已掛單融資的交易記錄。可以用來查詢特定貨幣的融資交易記錄,或是一次取得所有貨幣的融資交易記錄。

      Parameters

      • opts: { currency?: string; end?: Date; limit?: number; start?: Date } = {}

        參數說明

        • currency: 貨幣代碼,如果未指定則回傳所有貨幣的融資記錄。
        • limit: 回傳的交易記錄數量上限。
        • start: 回傳的交易記錄中,mts 欄位不小於此值
        • end: 回傳的交易記錄中,mts 欄位不大於此值

      Returns Promise<
          {
              amount: number;
              currency: string;
              id: number;
              mtsCreate: Date;
              offerId: number;
              period: number;
              rate: number;
              symbol: string;
          }[],
      >

      • id: 融資記錄 ID
      • symbol: 融資代碼
      • currency: 貨幣代碼
      • offerId: 融資掛單 ID
      • amount: 融資金額
      • rate: 融資利率
      • period: 融資天數
      • mtsCreate: 建立時間
      apiKey = 'apiKey'
      apiSecret = 'apiSecret'

      await (async () => {
      try {
      const { Bitfinex } = require('@taichunmin/bitfinex')
      const bitfinex = new Bitfinex({ apiKey, apiSecret })
      console.log(await bitfinex.v2AuthReadFundingTradesHist({ limit: 1 }))
      } catch (err) {
      console.log(err)
      }
      })()

      /* Expected output:
      [
      {
      amount: 1027.10723507,
      id: 356904509,
      mtsCreate: 2025-03-31T08:50:47.000Z,
      offerId: 3850654061,
      period: 2,
      rate: 0.00019958,
      symbol: 'fUST',
      currency: 'UST'
      }
      ]
      */
    • 更新融資貨幣的自動借出設定

      Parameters

      • opts:
            | { currency: string; status: deactivate }
            | {
                amount?: string | number;
                currency: string;
                period?: number;
                rate?: string | number;
                status: activate;
            }

        參數說明

        • status: 1 代表啟用、0 代表停用
        • currency: 貨幣代碼
        • amount: 融資自動借出的數量,最小為 50 USD 或等值的融資貨幣,0 代表無上限
        • period: 融資天數,預設為 2
        • rate: 融資利率 (單位:百分比),省略或 0 代表套用 FRR 浮動利率

      Returns Promise<
          {
              code: null
              | number;
              msgId: null | number;
              mts: Date;
              offer:
                  | null
                  | { currency: string; period: number; rate: number; threshold: number };
              status: string;
              text: string;
              type: string;
          },
      >

      • mts: 通知的時間
      • type: 通知的類型,固定為 fa-req
      • msgId: 訊息 ID
      • offer.currency: 貨幣代碼
      • offer.period: 融資天數
      • offer.rate: 融資利率
      • offer.threshold: 融資自動借出的數量,0 代表無上限
      • code: W.I.P. (work in progress)
      • status: 通知的狀態,這個欄位可能會因時而異,可能的值為 SUCCESSERRORFAILURE
      • text: 通知的詳細內容
      apiKey = 'apiKey'
      apiSecret = 'apiSecret'

      await (async () => {
      try {
      const { Bitfinex, FundingAutoStatus } = require('@taichunmin/bitfinex')
      const bitfinex = new Bitfinex({ apiKey, apiSecret })

      // activate with 0.1% rate
      console.log(await bitfinex.v2AuthWriteFundingAuto({ currency: 'BTC', rate: 0.1, period: 2, amount: 0, status: FundingAutoStatus.activate }))
      /* Expected output:
      {
      mts: '2025-03-31T09:06:27.737Z',
      type: 'fa-req',
      msgId: null,
      offer: { currency: 'BTC', period: 2, rate: 0.001, threshold: 0 },
      code: null,
      status: 'SUCCESS',
      text: 'Auto-renew of BTC offers activated at 0.1% a day for 2 days periods'
      }
      */

      // activate with FRR
      console.log(await bitfinex.v2AuthWriteFundingAuto({ currency: 'BTC', period: 2, amount: 0, status: FundingAutoStatus.activate }))
      /* Expected output:
      {
      mts: '2025-03-31T09:01:56.969Z',
      type: 'fa-req',
      msgId: null,
      offer: { currency: 'BTC', period: 2, rate: 0, threshold: 0 },
      code: null,
      status: 'SUCCESS',
      text: 'Auto-renew of BTC offers activated at FRR for 2 days periods'
      }
      */

      // deactivate
      console.log(await bitfinex.v2AuthWriteFundingAuto({ currency: 'BTC', status: FundingAutoStatus.deactivate }))
      /* Expected output:
      {
      mts: '2025-03-31T09:01:57.423Z',
      type: 'fa-req',
      msgId: null,
      offer: { currency: 'BTC', period: 2, rate: 0, threshold: 0 },
      code: null,
      status: 'SUCCESS',
      text: 'Auto-renew deactivated for BTC offers'
      }
      */
      } catch (err) {
      console.log(err)
      }
      })()
    • 取消全部的融資掛單,如果有指定貨幣時,則只取消該貨幣全部的融資掛單。

      Parameters

      • opts: { currency?: string } = {}

        參數說明

        • currency: 貨幣代碼

      Returns Promise<{ mts: Date; status: string; text: string; type: string }>

      • mts: 通知的時間
      • type: 通知的類型,固定為 foc_all-req (funding offer cancel all request)
      • status: 通知的狀態,這個欄位可能會因時而異,可能的值為 SUCCESSERRORFAILURE
      • text: 通知的詳細內容
      apiKey = 'apiKey'
      apiSecret = 'apiSecret'

      await (async () => {
      try {
      const { Bitfinex } = require('@taichunmin/bitfinex')
      const bitfinex = new Bitfinex({ apiKey, apiSecret })
      console.log(await bitfinex.v2AuthWriteFundingOfferCancelAll({ currency: 'BTC' }))
      } catch (err) {
      console.log(err)
      }
      })()

      /* Expected output:
      {
      mts: 2025-03-31T09:13:21.649Z,
      type: 'foc_all-req',
      status: 'SUCCESS',
      text: 'None to cancel'
      }
      */

    v2/auth/info

    • 取得帳戶指定貨幣的融資資訊

      Parameters

      • opts: { currency?: string } = {}

        參數說明

        • currency: 貨幣代碼,預設為 USD

      Returns Promise<
          {
              currency: string;
              durationLend: number;
              durationLoan: number;
              symbol: string;
              yieldLend: number;
              yieldLoan: number;
          },
      >

      • currency: 貨幣代碼
      • symbol: 融資代碼
      • yieldLoan: 借貸利率的加權平均
      • yieldLend: 放貸利率的加權平均
      • durationLoan: 借貸天數的加權平均
      • durationLend: 放貸天數的加權平均
      apiKey = 'apiKey'
      apiSecret = 'apiSecret'

      await (async () => {
      try {
      const { Bitfinex } = require('@taichunmin/bitfinex')
      const bitfinex = new Bitfinex({ apiKey, apiSecret })
      console.log(await bitfinex.v2AuthReadInfoFunding({ currency: 'USD' }))
      } catch (err) {
      console.log(err)
      }
      })()

      /* Expected output:
      {
      symbol: 'fUSD',
      yieldLoan: 0,
      yieldLend: 0.00022886,
      durationLoan: 0,
      durationLend: 0.5785416666666667,
      currency: 'USD'
      }
      */
    • 取得重要的帳戶資訊

      Returns Promise<
          {
              company: string;
              compCountries: string[];
              compCountriesResid: string[];
              competitionEnabled: boolean;
              complAccountType: string;
              ctxSwitch: { allowDisable: boolean; disabled: boolean };
              email: string;
              id: number;
              locale: null | string;
              masterAccount: {
                  groupId: null | number;
                  groupWithdrawEnabled: boolean;
                  id: null | number;
                  inheritVerification: boolean;
                  isGroupMaster: boolean;
                  mtsCreate: null | Date;
              };
              merchant: { enabled: boolean; isEnterprise: boolean };
              modes2FA: string[];
              mtsAccountCreate: Date;
              pptEnabled: boolean;
              securities: {
                  enabled: boolean;
                  isElSalvador: boolean;
                  isInvestorAccredited: boolean;
                  isMaster: boolean;
              };
              timeLastLogin: null
              | Date;
              timezone: string;
              username: string;
              verification: {
                  email: boolean;
                  level: number;
                  levelSubmitted: number;
                  verified: boolean;
              };
          },
      >

      • company: 代表此帳戶在何處註冊;在 Bitfinex 註冊的帳戶會顯示 'bitfinex',在 eosfinex 註冊的帳戶會顯示 'eosfinex'
      • compCountries: 根據你的驗證資料(居住地及國籍)所產生的國家代碼陣列
      • compCountriesResid: 根據你的驗證資料(居住地)所產生的國家代碼陣列
      • competitionEnabled: 代表此帳戶是否啟用 competition
      • complAccountType: 合規驗證類型 ("individual""corporate")
      • ctxSwitch.allowDisable: 帳戶是否可停用由主帳戶切換至此帳戶的功能
      • ctxSwitch.disabled: 是否禁止主帳戶切換到此帳戶
      • email: 帳戶的 email
      • id: 帳戶 ID
      • locale: 帳戶的語系設定
      • masterAccount
        • masterAccount.groupId: 帳戶群組 ID
        • masterAccount.groupWithdrawEnabled: 是否啟用群組提領
        • masterAccount.id: 主帳戶的 ID(若此帳戶為子帳戶)
        • masterAccount.inheritVerification: 代表此帳戶是否繼承主帳戶的驗證
        • masterAccount.isGroupMaster: 代表此帳戶是否為群組主帳戶
        • masterAccount.mtsCreate: 主帳戶建立的時間戳
      • merchant
        • merchant.enabled: 代表此帳戶是否為商家帳戶
        • merchant.isEnterprise: 代表此帳戶是否為企業商家帳戶
      • modes2FA: 已啟用的二階段驗證種類(包含 'u2f', 'otp')
      • mtsAccountCreate: 帳戶建立的時間戳
      • pptEnabled: 代表此帳戶是否啟用模擬交易
      • securities
        • securities.enabled: 代表此帳戶是否為證券帳戶
        • securities.isElSalvador: 代表此帳戶是否已通過薩爾瓦多證券相關驗證
        • securities.isInvestorAccredited: 代表此帳戶是否已通過合格投資人證券驗證
        • securities.isMaster: 代表此帳戶是否擁有證券子帳戶
      • timeLastLogin: 上次登入的時間戳
      • timezone: 帳戶的時區設定
      • username: 帳戶的使用者名稱
      • verification
        • verification.email: 代表此電子郵件是否已驗證
        • verification.level: 帳戶的驗證等級
        • verification.levelSubmitted: 該帳戶已提交的最高驗證申請等級
        • verification.verified: 代表使用者是否為已驗證(KYC)狀態
      apiKey = 'apiKey'
      apiSecret = 'apiSecret'

      await (async () => {
      try {
      const { Bitfinex } = require('@taichunmin/bitfinex')
      const bitfinex = new Bitfinex({ apiKey, apiSecret })
      console.log(await bitfinex.v2AuthReadInfoUser())
      } catch (err) {
      console.log(err)
      }
      })()

    v2/auth/ledgers