Get Account Information

About 10 min

get_accounts Get Managed Accounts

TradeClient.get_accounts()

Description

Fetch a list of managed accounts of the current user, along with account information. Institutional account will return master account and all sub-accounts.

Response

list, each element is a PortfolioAccount(include/tigerapi/model.h PortfolioAccount)object

Attributes:

AttributeTypeDescription
accountutility::string_tAccount identifier
update_timestamplongLast update time
segmentsvector<Segment>Account financial segments

Example

int main(int argc, char *args[]) {
    /************************** set config **********************/
    ClientConfig config = ClientConfig();

    config.private_key = "xxxxxx your private key string xxxxxxxx";
    config.tiger_id = "your tiger id";
    config.account = "your account";

    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
    value res = trade_client->get_accounts();
    ucout << U("Accounts: ") << res << endl;

    return 0;
}

Response Example

 {
  "items":[
    {
      "account":"U10010705",
      "accountType":"GLOBAL",
      "capability":"CASH",
      "status":"Funded"
    },
    {
      "account":"572386",
      "accountType":"STANDARD",
      "capability":"CASH",
      "status":"Funded"
    },
    {
      "account":"20200821144442583",
      "accountType":"PAPER",
      "capability":"RegTMargin",
      "status":"Funded"
    }
  ]
}

get_assets Get Account Summary

value get_asset(utility::string_t account = U(""), const value &sub_accounts = value::array(), bool segment = false,
                        bool market_value = false);

Description

Get account summary,this method is only recommended for Global Account. You can also get the account summary of your standard, or paper trading account using this method. However, because different account types have different account structures, Please use get_prime_assets to get assets for prime and paper acount.

Parameters

ParameterTypseRequiredDescription
accountutility::string_tNoAccount id
sub_accountslist<string>NoA list of sub-accounts, default value is None
segmentboolNoWhether to return data grouped by segments (securities, futures). Default value is False. When set to True, a dict will be returned, where 'C' means futures, 'S' means stocks
market_valueboolNoWhether to return data grouped by currency (USD, HKD, RMB). Default is False

Response

list

Each element of this list is a PortfolioAccount Object。If the user only has one account,there will be only one element in the list returned.
PortfolioAccount(include/tigerapi/model.h) has the following structure。

Please refer to Object for data fields in Account、SecuritySegment、CommoditySegment

PortfolioAccount Object
├── account: account id
├── update_timestamp: Last update time
├── segments: account information grouped by segments
│ ├── buying_power
│ ├── capability
│ ├── cash_available_for_trade
│ ├── cash_available_for_withdrawl
│ ├── cash_balance
│ ├── category
│ ├── currency
│ ├── currency_asset
│ ├── equity_with_loan
│ ├── excess_liquidation
│ ├── gross_position_value
│ ├── init_margin
│ ├── leverage
│ ├── locked_funds
│ ├── maintain_margin
│ ├── net_liquidation
│ ├── overnight_liquidation
│ ├── overnight_margin
│ ├── realized_pl
│ ├── total_today_pl
│ ├── unrealized_pl
└─└── unrealized_plby_cost_of_carry

Example

#include "tigerapi/trade_client.h"
#include "tigerapi/contract_util.h"
#include "tigerapi/order_util.h"

using namespace std;
using namespace web;
using namespace web::json;
using namespace TIGER_API;

/**
 * Calling TradeClient
 */
class TestTradeClient {
public:
    static void test_get_asset(const std::shared_ptr<TradeClient>& trade_client) {
        value res = trade_client->get_asset();
        cout << "asset: " << res << endl;
    }

    static void test_trade(const std::shared_ptr<TradeClient>& trade_client) {
        TestTradeClient::test_get_asset(trade_client);
    }
};

int main(int argc, char *args[]) {
    cout << "Tiger Api main" << endl;
    /************************** set config **********************/
    ClientConfig config = ClientConfig(true);

    config.private_key = "-----BEGIN RSA PRIVATE KEY-----\n"
                         "xxxxxx private key xxxxxxxx"
                         "-----END RSA PRIVATE KEY-----";
    config.tiger_id = "Tiger ID";
    config.account = "Account ID";


    /**
     * Use TradeClient
     */
    std::shared_ptr<TradeClient> trade_client = std::make_shared<TradeClient>(config);
    TestTradeClient::test_trade(trade_client);


    return 0;
}

Response Example

{
  "items":
  [
    {
      "account":"572386",
      "buyingPower":8617.0384386000005,
      "capability":"CASH",
      "cashValue":8617.0384386000005,
      "currency":"USD",
      "netLiquidation":8829.4388956000003,
      "realizedPnL":0,
      "segments":
      [
        {
          "account":"572386",
          "accruedCash":0,
          "accruedDividend":0,
          "availableFunds":8617.0384386000005,
          "cashValue":8617.0384386000005,
          "category":"S",
          "equityWithLoan":8829.4388956000003,
          "excessLiquidity":8617.0384386000005,
          "grossPositionValue":212.40045699999999,
          "initMarginReq":212.40045699999999,
          "leverage":0.024055900000000002,
          "maintMarginReq":212.40045699999999,
          "netLiquidation":8829.4388956000003,
          "title":"US Securities"
        }
      ],
      "unrealizedPnL":-29.7592915
    }
  ]
}

get_prime_assets Account Summary for Prime Account

value get_prime_asset(const utility::string_t & account = U(""), const utility::string_t & base_currency = U("USD"));
value get_prime_asset(const utility::string_t &account, Currency base_currency = Currency::USD);

Description

Get account summary, including asset information and open positions, for your Prime and Paper accounts

Parameters

ParameterTypeDescription
accountstring_taccount id, if not specified, the request will use default account id configured in client_config
base_currencyCurrencyCurrency of assets
default: Currency::USD

Response

list

A list where each element is a PortfolioAccount object. If there is only one account, the method will return a one-element list.

The structure of the PortfolioAccount object is as follows.

For a detailed list of data fields contained in PortfolioAccount and Segment, please refer to Object Information

PortfolioAccount object
├── account: account id
├── update_timestamp: update time, timestamp in milliseconds
├── segments: account information by segments, a dict with the security category as the key, and the value as a Segment object
│ ├── 'S' means securities account, value is Segment object
│ │ ├── currency: currency, such as USD, HKD
│ │ ├── capability: Account Type, Margin: RegTMargin, Cash: Cash
│ │ ├── category': Securities Classification C: (Commodities Futures), S: (Securities Stocks)
│ │ ├── cash_balance': cash that can be traded, plus some cash that has been locked (such as stocks that have been purchased but not yet traded, and some other situations will also have locked cash)
│ │ ├── cash_available_for_trade': The amount of cash and margin that can be traded in the current account
│ │ ├── cash_available_for_withdrawal': The amount of cash that can be withdrawn in the current account
│ │ ├── gross_position_value': total security value: long stock value + short stock value + long option value + short option value. The above items are calculated as absolute values
│ │ ├── equity_with_loan': Equity with loan value (including loan value assets). Securities Segment: Cash value + stock value, Futures Segment: Cash value - maintenance margin
│ │ ├── net_liquidation': net liquidation value
│ │ ├── init_margin': initial margin requirement
│ │ ├── maintain_margin': maintenance margin requirement
│ │ ├── overnight_margin': overnight margin requirement
│ │ ├── unrealized_pl': floating profit and loss
│ │ ├── realized_pl': realized profit and loss
│ │ ├── excess_liquidation': Excess liquidity, used to represent intraday risk value. Calculation method for securities segment: equity_with_loan - maintenance_margin_requirement. Calculation method for futures segment: net_liquidation - maintenance_margin_requirement
│ │ ├── overnight_liquidation': Overnight risk control value, when it is less than 0, account positions will be forced to liquidate, and you need to pay attention to risks
│ │ ├── buying_power': buying power. Estimate how many dollars you can buy in stock assets. The margin account has a maximum of four times the purchasing power of the funds (funds that are not occupited) during the day. Overnight purchasing power Up to two times. 
│ │ ├── leverage': The currently leverage, if it is less than 1, it means that the leverage is not used, and if it is greater than 1, it means the leverage multiple used
│ │ ├── currency_assets: Account asset information differentiated by transaction currency, a dict with currency as key
│ │ │ ├── 'USD' means US dollar, value is CurrencyAsset object
│ │ │ │ ├── currency': current currency, commonly used currencies include: USD-US dollar, HKD-Hong Kong dollar, SGD-Singapore dollar, CNH-RMB
│ │ │ │ ├── cash_balance': cash that can be traded, plus some cash that has been locked (such as stocks that have been purchased but not yet traded, and some other situations will also have locked cash)
│ │ │ │ ├── cash_available_for_trade': The amount of cash that can be traded in the current account
│ │ │ │ ├── gross_position_value': gross value
│ │ │ │ ├── stock_market_value': The market value of the stock, when the category is C (futures type), there will be no stock market value
│ │ │ │ ├── futures_market_value': the market value of futures, when the category is S (stock type), there will be no futures market value
│ │ │ │ ├── option_market_value': the market value of the option
│ │ │ │ ├── unrealized_pl': floating profit and loss within the account
│ │ │ │ ├── realized_pl': realized profit and loss in the account
│ │ │ ├── 'HKD' means Hong Kong dollar, value is CurrencyAsset object
│ │ └─ └── 'CNH' means RMB, value is CurrencyAsset object
│ └── 'C' means futures account, value is Segment object

Example

#include "tigerapi/trade_client.h"
#include "tigerapi/contract_util.h"
#include "tigerapi/order_util.h"

using namespace std;
using namespace web;
using namespace web::json;
using namespace TIGER_API;

/**
 * Calling TradeClient
 */
class TestTradeClient {
public:
    static void test_get_prime_asset(const std::shared_ptr<TradeClient>& trade_client) {
        value res = trade_client->get_prime_asset();
        cout << "asset: " << res << endl;
    }

    static void test_trade(const std::shared_ptr<TradeClient>& trade_client) {
        TestTradeClient::test_get_prime_asset(trade_client);
    }
};

int main(int argc, char *args[]) {
    cout << "Tiger Api main" << endl;
    /************************** set config **********************/
    ClientConfig config = ClientConfig(true);

    config.private_key = "-----BEGIN RSA PRIVATE KEY-----\n"
                         "xxxxxx private key xxxxxxxx"
                         "-----END RSA PRIVATE KEY-----";
    config.tiger_id = "Tiger ID";
    config.account = "Account ID";


    /**
     * Use TradeClient
     */
    std::shared_ptr<TradeClient> trade_client = std::make_shared<TradeClient>(config);
    TestTradeClient::test_trade(trade_client);


    return 0;
}

Response

{
  "accountId":"572386",
  "segments":
  [
    {
      "buyingPower":8617.0200000000004,
      "capability":"CASH",
      "cashAvailableForTrade":8617.0200000000004,
      "cashBalance":8617.0200000000004,
      "category":"S",
      "consolidatedSegTypes":["SEC","FUND"],
      "currency":"USD",
      "currencyAssets":
      [
        {
          "cashAvailableForTrade":7714.4700000000003,
          "cashBalance":7714.4700000000003,
          "currency":"USD"
        },
        {
          "cashAvailableForTrade":5800.29,
          "cashBalance":5800.29,
          "currency":"HKD"
        },
        {
          "cashAvailableForTrade":1.5,
          "cashBalance":1.5,
          "currency":"NZD"
        },
        {
          "cashAvailableForTrade":1123.95,
          "cashBalance":1123.95,
          "currency":"CNH"
        },
        {
          "cashAvailableForTrade":0.12,
          "cashBalance":0.12,
          "currency":"EUR"
        }
      ],
      "equityWithLoan":8829.4200000000001,
      "excessLiquidation":8617.0200000000004,
      "grossPositionValue":212.40000000000001,
      "initMargin":212.40000000000001,
      "leverage":0.02,
      "lockedFunds":0,
      "maintainMargin":212.40000000000001,
      "netLiquidation":8829.4200000000001,
      "overnightLiquidation":8617.0200000000004,
      "overnightMargin":212.40000000000001,
      "realizedPL":0,
      "totalTodayPL":0,
      "uncollected":0,
      "unrealizedPL":-29.760000000000002,
      "unrealizedPLByCostOfCarry":-29.760000000000002
    },
    {"buyingPower":8617.0200000000004,"capability":"CASH","cashAvailableForTrade":8617.0200000000004,"cashBalance":0,
      "category":"F","consolidatedSegTypes":["SEC","FUND"],"currency":"USD","currencyAssets":[{"cashAvailableForTrade":0,"cashBalance":0,"currency":"USD"},
      {"cashAvailableForTrade":0,"cashBalance":0,"currency":"HKD"},{"cashAvailableForTrade":0,"cashBalance":0,"currency":"CNH"}],"equityWithLoan":8829.4200000000001,
      "excessLiquidation":8617.0200000000004,"grossPositionValue":0,"initMargin":212.40000000000001,"leverage":0.02,"lockedFunds":0,
      "maintainMargin":212.40000000000001,"netLiquidation":0,"overnightLiquidation":8617.0200000000004,"overnightMargin":212.40000000000001,
      "realizedPL":0.78000000000000003,"totalTodayPL":0,"uncollected":0,"unrealizedPL":0,"unrealizedPLByCostOfCarry":0}],
  "updateTimestamp":1741939073276
}


get_positions Get Positions

value get_positions(utility::string_t account = U(""), SecType sec_type = SecType::ALL, Currency currency = Currency::ALL,
                    Market market = Market::ALL,
                    utility::string_t symbol = U(""), const value &sub_accounts = value::array(), time_t expiry = -1,
                    utility::string_t strike = U(""), Right right = Right::ALL);

value get_positions(const utility::string_t &account, const utility::string_t &sec_type = U(""), const utility::string_t &currency = U("ALL"),
                    const utility::string_t &market = U("ALL"),
                    const utility::string_t &symbol = U(""), const value &sub_accounts = value::array(), time_t expiry = -1,
                    utility::string_t strike = U(""), const utility::string_t &right = U(""));

vector<Position> get_position_list(utility::string_t account = U(""), utility::string_t sec_type = U(""), utility::string_t currency = U("ALL"),
                    utility::string_t market = U("ALL"),
                    utility::string_t symbol = U(""), const value &sub_accounts = value::array(), time_t expiry = -1,
                                   utility::string_t strike = U(""), utility::string_t right = U(""));

Description

Get the position information of the account

Parameters

ParameterTypeRequiredDescription
accountstring_tNoaccount id, if not specified, default account id configured in client_config will be used
sec_typeSecTypeNoSecType enumeration, including STK/OPT/FUT
default: SecType::ALL.
currencyCurrencyNoCurrency enumeration, including ALL/USD/HKD/CNH
default: Currency::ALL
marketMarketNoMarket enumeration, including ALL/US/HK/CN
default: Market::ALL
symbolstring_tNoTicker symbol
sub_accountslist<str>NoSub account list
expirytime_tNoOptions expiration date
default: -1
strikefloatNoOptions strike price, example: 100.5
rightstring_tNo'PUT' / 'CALL' for options
default: Right::ALL

Response

list

The structure is as follows:

Each element is a Position object.

ParameterTypeDescription
accountutility::string_tAccount id
contractContractContract object
positionlong longPosition quantity
average_costdoubleHolding cost
latest_pricedoubleLatest price(During trading hours, it is the market price. For US stocks outside of trading hours, the prime account uses the after-hours closing price, while the global account uses the intraday closing price.)
market_valuedoubleMarket value
realized_pnldoubleRealized profit and loss
unrealized_pnldoubleUnrealized profit and loss

Example

#include "tigerapi/trade_client.h"
#include "tigerapi/contract_util.h"
#include "tigerapi/order_util.h"

using namespace std;
using namespace web;
using namespace web::json;
using namespace TIGER_API;

/**
 * Calling TradeClient
 */
class TestTradeClient {
public:
    static void test_get_positions(const std::shared_ptr<TradeClient>& trade_client) {
        value res = trade_client->get_positions();
        cout << "position: " << res << endl;
    }

    static void test_trade(const std::shared_ptr<TradeClient>& trade_client) {
        TestTradeClient::test_get_positions(trade_client);
    }
};

int main(int argc, char *args[]) {
    cout << "Tiger Api main" << endl;
    /************************** set config **********************/
    ClientConfig config = ClientConfig(true);

    config.private_key = "-----BEGIN RSA PRIVATE KEY-----\n"
                         "xxxxxx private key xxxxxxxx"
                         "-----END RSA PRIVATE KEY-----";
    config.tiger_id = "Tiger ID";
    config.account = "Account ID";


    /**
     * Use TradeClient
     */
    std::shared_ptr<TradeClient> trade_client = std::make_shared<TradeClient>(config);
    TestTradeClient::test_trade(trade_client);


    return 0;
}

Response

{
  "account":"572386",
  "averageCost":1.1932,
  "averageCostByAverage":1.1932,
  "averageCostOfCarry":1.1932,
  "categories":[],
  "comboTypeMap":{},
  "contractId":7451,
  "currency":"USD",
  "identifier":"ROSGQ",
  "lastClosePrice":0.0001,
  "latestPrice":0.0001,
  "market":"US",
  "marketValue":0.00059999999999999995,
  "multiplier":1,
  "position":6,
  "positionQty":6,
  "positionScale":0,
  "realizedPnl":0,
  "realizedPnlByAverage":0,
  "salableQty":6,
  "secType":"STK",
  "status":0,
  "symbol":"ROSGQ",
  "todayPnl":0,
  "todayPnlPercent":0,
  "unrealizedPnl":-7.1585000000000001,
  "unrealizedPnlByAverage":-7.1585000000000001,
  "unrealizedPnlByCostOfCarry":-7.1585000000000001,
  "unrealizedPnlPercent":-0.99990000000000001,
  "unrealizedPnlPercentByAverage":-0.99990000000000001,
  "unrealizedPnlPercentByCostOfCarry":-0.99990000000000001,
  "updateTimestamp":1741939624143
}

get_analytics_asset Get Analytics Asset

value get_analytics_asset(utility::string_t account, utility::string_t start_date, utility::string_t end_date, utility::string_t seg_type = U("SEC"), utility::string_t currency = U("USD"), utility::string_t sub_account = U(""));

Description

Get historical asset analysis of the account

Parameters

ParameterTypeRequiredDescription
accountutility::string_tYesAccount id
start_dateutility::string_tYesstart date, format yyyy-MM-dd, like '2022-01-01'
end_dateutility::string_tYesend date, format yyyy-MM-dd, like '2022-02-01', if not passed, use current date
seg_typeutility::string_tnoAccount segment
default: U("SEC")
currencyutility::string_tnocurrency type
default: U("USD")
sub_accountutility::string_tnoSub-account (for institutional accounts only), if this field is passed, the assets of the sub-account will be returned

Return

summary: The corresponding value is the asset analysis summary.

ParameterTypeDescription
pnlfloatProfit and Loss Amount
pnl_percentagefloatProfit and Loss Amount rate
annualized_returnfloatAnnualized rate of return (imputed)
over_user_percentagefloatPercentage of users exceeded

history: History assets

ParameterTypeDescription
dateintDate timestamp in milliseconds
pnlfloatAmount of profit or loss compared to the previous day
pnl_percentagefloatYield compared to the previous day
assetfloatTotal assets amount
cash_balancefloatCash balance
gross_position_valuefloatposition market value
depositfloatdeposit amount
withdrawalfloatwithdrawal amount

Examples

static void test_get_analytics_asset(const std::shared_ptr<TradeClient>& trade_client) {
    value res = trade_client->get_analytics_asset(trade_client->client_config.account, U("2023-11-01"),
                                                  U("2023-12-31"));
    ucout << U("analytics asset: ") << res << endl;
}

Return example

{
  "history":
  [
    {
      "asset":48831542.450000003, 
      "cashBalance":48831466.36999999997, 
      "date":1688356800000, "deposit":0,
      "grossPositionValue": 76.0699999999999999993, 
      "pnl":0, 
      "pnlPercentage":0, 
      "withdrawal":0
    },
    {
      "asset":48831533.82999999998, 
      "cashBalance":48831460.32,
      "date": 1688443200000,
      "deposit":0, 
      "grossPositionValue":73.510000000000005,
      "pnl":-8.619999999999999992,
      "pnlPercentage":0,
      "withdrawal":0
    },
    {
      " asset":48831521.65999999996, 
      "cashBalance":48831447.100000001, 
      "date":1688529600000,
      "deposit":0,
      "grossPositionValue": 74.5499999999999999997,
      "pnl":-20.7899999999999999999,
      "pnlPercentage":0,
      "withdrawal":0
    },
    {
      "asset":48831519.65999999996,
      "cashBalance":48831446
    },
    {
      "asset":48831525.450000003, 
      "cashBalance":48831454.530000001,
      "date":1688702400000,
      "deposit":0, 
      "grossPositionValue": 70.920000000000002, 
      "pnl":-17, 
      "pnlPercentage":0, 
      "withdrawal":0
    }
  ], 
    "summary":
    {
      "annualizedReturn":0,
      "overUserPercentage":0, 
      "pnl":-8.8900000000000006,
      "pnlPercentage":0
    }
}


get_estimate_tradable_quantity

value get_estimate_tradable_quantity(Order &order, utility::string_t seg_type = U("SEC"))

Description

Query the maximum buy/sell quantity for a specific asset under the account, supporting stocks and options, but not futures.

Parameters

FieldsTypeDescription
orderOrderOrder to be queried
seg_typeutility::string_tSegment type
default: U("SEC")

Order

Only limit or stop orders are supported; futures are not supported for the time being.

Returns

FieldsTypeDescription
position_quantityfloatPosition (held) quantity
tradable_position_quantityfloatQuantity available for trading
tradable_quantityfloatCash Tradable Quantity (If action is 'buy', returns the quantity available for purchase; otherwise, returns the quantity available for sale)

example

    static void test_get_estimate_tradable_quantity(const std::shared_ptr<TradeClient>& trade_client) {
        Contract contract = ContractUtil::stock_contract(U("AAPL"), U("USD"));
        Order order = OrderUtil::limit_order(contract, U("BUY"), 1, 100.0); value res = trade_client-contract(U("AAPL"), U("USD")); value
        value res = trade_client->get_estimate_tradable_quantity(order);
        ucout << U("estimate tradable quantity: ") << res << endl;
    }

Return example

 {
  "positionQuantity":0,
  "tradablePositionQuantity":0,
  "tradableQuantity":77}

get_segment_fund_available

value get_segment_fund_available(utility::string_t from_segment, utility::string_t currency = U("USD"))Description

Get the funds available for transfer under the corresponding segment of the account (consolidated/demo account).

Parameters

ParametersTypeRequiredDescription
from_segmentutility::string_tYesTransfer out segment, FUT or SEC
currencyutility::string_tNoTransfer out currency
default: U("USD")

Returns

NameTypeDescription
from_segmentstringTransfer out segment, FUT or SEC
currencystringTransfer out currency, USD or HKD
amountfloatTransferable funds, in dollars

Examples

    static void test_get_segment_fund_available(const std::shared_ptr<TradeClient>& trade_client) {
        value res = trade_client->get_segment_fund_available(U("SEC"));
        ucout << U("segment fund available: ") << res << endl;
    }

Return example

[{"amount":93104.7599999999999995, "currency": "USD", "fromSegment": "SEC"}]


transfer_segment_fund

value transfer_segment_fund(utility::string_t from_segment, utility::string_t to_segment, double amount, utility::string_t currency = U("USD"))

Description

Transfer of funds under different segments of an account, e.g. securities segment to futures segment (for consolidated or demo accounts).

Parameters

ParameterTypeRequiredDescription
from_segmentutility::string_tYestransfer out segment, FUT or SEC
to_segmentutility::string_tYestransfer to segment, FUT or SEC, must be different from from_segment
amountdoubleYesTransfer amount in $ of corresponding currency
currencyutility::string_tNoTransfer to segment
default: U("USD")

Returns

nametypedescription
idintTransfer Record ID
from_segmentutility::string_ttransfer_segment, FUT or SEC
to_segmentutility::string_tTransfer in to segment, FUT or SEC
currencyutility::string_ttransfer_out_currency, USD or HKD
amountfloatTransfer amount in dollars
statusutility::string_tStatus (NEW/PROC/SUCC/FAIL/CANC)
status_descutility::string_tstatus_description (submitted/processing/accounted/failed/canceled)
messageutility::string_tFailed message
settled_atintArrival timestamp
updated_atintupdate_timestamp
created_atintCreation timestamp

Example

static void test_transfer_segment_fund(const std::shared_ptr<TradeClient>& trade_client) {
    value res = trade_client->transfer_segment_fund(U("SEC"), U("FUT"), 10.0);
    ucout << U("transfer segment fund: ") << res << endl;
}

Return example

{'id': 30322815980011520, 'from_segment': 'SEC', 'to_segment': 'FUT', 'currency': 'USD',
 'amount': 100.0, 'status': 'NEW', 'status_desc': 'Submitted', 'message': None, 'settled_at': None,
  'updated_at': 1680243926131, 'created_at': 1680243926131}


get_segment_fund_history

value get_segment_fund_history(int limit = 0);

Description

Query historical transfer records between account segments, sorted in descending order by time. (Applicable to comprehensive/simulated accounts)

Parameters

ParameterTypeRequiredDescription
limitintNoReturns the most recent transfer records. Default is 100, maximum is 500.

Response

FieldTypeDescription
idintTransfer record ID
from_segmentutility::string_tOutgoing segment, FUT or SEC.
to_segmentutility::string_tIncoming segment, FUT or SEC
currencyutility::string_tOutgoing currency, USD or HKD
amountfloatTransfer amount
statusutility::string_tStatus (NEW/PROC/SUCC/FAIL/CANC)
status_descutility::string_tStatus description (Submitted/Processing/Transferred/Transfer Failed/Cancelled)
settled_atintTimestamp of when transfer was settled
updated_atintTimestamp of when transfer was updated
created_atintTimestamp of when transfer was created

Example

static void test_get_segment_fund_history(const std::shared_ptr<TradeClient>& trade_client) {
    value res = trade_client->get_segment_fund_history();
    ucout << U("segment fund history: ") << res << endl;
}

Response Example

[
  {
    "amount":10,
    "createdAt":1689250798000,
    "currency":"USD",
    "fromSegment":"SEC",
    "id":31503365023203328,
    "settledAt":1689250802000,
    "status":"SUCC",
    "statusDesc":"SUCCESS",
    "toSegment":"FUT",
    "updatedAt":1689250798000
  }
]

Last update: