Assets and Positions
Asset and Position Valuation
The new parameter examples below require Go SDK v0.5.5 or later.
The examples assume an initialized tc (*trade.TradeClient), with request models from the github.com/tigerfintech/openapi-go-sdk/model package.
For prime and paper trading accounts, the optional AssetQuoteType field (API field asset_quote_type) selects the quotes used to value assets and positions.
| Value | Valuation quotes |
|---|---|
ETH | Pre-market, regular-session, and after-hours quotes. During the overnight session, uses the previous day's after-hours closing price. |
RTH | Regular-session quotes only. Outside regular hours, uses the regular-session closing price. |
OVERNIGHT | Includes pre-market, regular-session, after-hours, and overnight quotes; during the overnight session, uses overnight quotes. |
An empty field is omitted and preserves the existing valuation behavior. This field controls asset and position valuation.
This setting does not freeze assets or positions. Even with RTH, cash movements, exchange rates, or activity in other markets can change net liquidation value. It does not enable overnight order execution.
Positions
PositionsPurpose
Lists account positions with instrument, market, currency, and sub-account filters. The client unwraps the server items envelope, and fills an empty account field from the client default.
Signature
func (c *TradeClient) Positions(req model.PositionsRequest) ([]model.Position, error)Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.
Parameters
model.PositionsRequest
| SDK field | Type | Required | Serialization | SDK default and constraints |
|---|---|---|---|---|
Account | string | No | Uses the client default when empty | Trading account ID |
SecretKey | string | No | Omitted if empty | Institutional-account authentication key |
Symbol | string | No | Omitted if empty | Instrument symbol |
SecType | string | No | Omitted if empty | Allowed values: ALL, STK, OPT, WAR, IOPT, FUT, FOP, CASH, MLEG, FUND |
Currency | string | No | Omitted if empty | Allowed values: ALL, USD, HKD, CNH, SGD |
Market | string | No | Omitted if empty | Allowed values: ALL, US, HK, CN, SG |
SubAccounts | []string | No | Omitted if empty | Sub-account list |
Expiry | string | No | Omitted if empty | Expiry date |
Strike | string | No | Omitted if empty | Strike price |
Right | string | No | Omitted if empty | Allowed values: PUT, CALL (option side); br, nr when used as quote adjustment |
AssetQuoteType | string | No | Omitted if empty | ETH, RTH, or OVERNIGHT; see Asset and Position Valuation |
Lang | string | No | Omitted if empty | Allowed values: zh_CN, zh_TW, en_US |
Returns
([]model.Position, error). Key fields from model.Position:
| Field | Type | Description |
|---|---|---|
| Account | string | Account ID |
| Symbol | string | Symbol code |
| SecType | string | Security type |
| Market | string | Market |
| Currency | string | Currency |
| Position | int64 | Position quantity |
| PositionScale | int | Position scale |
| PositionQty | float64 | Position quantity (with scale) |
| SalableQty | float64 | Salable quantity |
| AverageCost | float64 | Average cost |
| AverageCostByAverage | float64 | Average cost (average method) |
| AverageCostOfCarry | float64 | Cost of carry |
| MarketValue | float64 | Market value |
| RealizedPnl | float64 | Realized P&L |
| RealizedPnlByAverage | float64 | Realized P&L by average cost |
| UnrealizedPnl | float64 | Unrealized P&L |
| UnrealizedPnlByAverage | float64 | Unrealized P&L by average cost |
| UnrealizedPnlByCostOfCarry | float64 | Unrealized P&L by cost of carry |
| UnrealizedPnlPercent | float64 | Unrealized P&L percentage |
| UnrealizedPnlPercentByAverage | float64 | Unrealized P&L percentage by average cost |
| UnrealizedPnlPercentByCostOfCarry | float64 | Unrealized P&L percentage by cost of carry |
| ContractId | int64 | Contract ID |
| Identifier | string | Contract identifier |
| Name | string | Contract name |
| LatestPrice | float64 | Latest price |
| LastClosePrice | float64 | Previous close |
| Multiplier | float64 | Contract multiplier |
| Status | int | Status |
| UpdateTimestamp | int64 | Update time in milliseconds |
| MmPercent | float64 | Maintenance-margin percentage |
| MmValue | float64 | Maintenance-margin value |
| TodayPnl | float64 | Today's P&L |
| TodayPnlPercent | float64 | Today's P&L percentage |
| ComboTypes | []string | Combo types |
| Categories | []string | Categories |
Invocation example
result, err := tc.Positions(model.PositionsRequest{
Account: "your_prime_or_paper_account",
AssetQuoteType: "OVERNIGHT",
Symbol: "AAPL",
SecType: "STK",
Currency: "USD",
Market: "US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)[
{
"symbol": "AAPL",
"secType": "STK",
"market": "US",
"currency": "USD",
"position": 100,
"averageCost": 150.25,
"latestPrice": 308.91,
"marketValue": 30891.00,
"unrealizedPnl": 15866.00,
"realizedPnl": 0.0,
"account": "12345678"
},
{
"symbol": "MSFT",
"secType": "STK",
"market": "US",
"currency": "USD",
"position": 50,
"averageCost": 380.50,
"latestPrice": 425.30,
"marketValue": 21265.00,
"unrealizedPnl": 2240.00,
"realizedPnl": 0.0,
"account": "12345678"
}
]Rate limit
The base rate limit is 60 requests/min.
Assets
AssetsPurpose
Returns account assets with optional segment and market-value details. The client unwraps the server items envelope, and fills an empty account field from the client default.
Signature
func (c *TradeClient) Assets(req model.AssetsRequest) ([]model.Asset, error)Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.
Parameters
model.AssetsRequest
| SDK field | Type | Required | Serialization | SDK default and constraints |
|---|---|---|---|---|
Account | string | No | Uses the client default when empty | Trading account ID |
SecretKey | string | No | Omitted if empty | Institutional-account authentication key |
Segment | bool | No | Omitted when false | Whether to return segmented assets |
MarketValue | bool | No | Omitted when false | Whether to return market values |
SubAccounts | []string | No | Omitted if empty | Sub-account list |
BaseCurrency | string | No | Omitted if empty | Base currency |
Consolidated | *bool | No | Omitted when nil | Whether to consolidate assets; a pointer distinguishes explicit false from omission |
AssetQuoteType | string | No | Omitted if empty | ETH, RTH, or OVERNIGHT; see Asset and Position Valuation |
Lang | string | No | Omitted if empty | Allowed values: zh_CN, zh_TW, en_US |
Returns
([]model.Asset, error). Key fields from model.Asset:
| Field | Type | Description |
|---|---|---|
| Account | string | Account ID |
| Capability | string | Account type |
| Currency | string | Currency |
| BuyingPower | float64 | Buying power |
| CashValue | float64 | Cash balance |
| NetLiquidation | float64 | Net liquidation value |
| RealizedPnL | float64 | Realized P&L |
| UnrealizedPnL | float64 | Unrealized P&L |
| Segments | []AssetSegment | Segment asset list |
AssetSegment field | Type | Description |
|---|---|---|
| Account | string | Account ID |
| Category | string | Segment category |
| Title | string | Segment title |
| NetLiquidation | float64 | Net liquidation value |
| CashValue | float64 | Cash balance |
| AvailableFunds | float64 | Available funds |
| EquityWithLoan | float64 | Equity with loan |
| ExcessLiquidity | float64 | Excess liquidity |
| AccruedCash | float64 | Accrued cash |
| AccruedDividend | float64 | Accrued dividend |
| InitMarginReq | float64 | Initial margin requirement |
| MaintMarginReq | float64 | Maintenance margin requirement |
| GrossPositionValue | float64 | Gross position value |
| Leverage | float64 | Leverage |
Invocation example
result, err := tc.Assets(model.AssetsRequest{
Account: "your_prime_or_paper_account",
AssetQuoteType: "OVERNIGHT",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result){
"account": "12345678",
"netLiquidation": 125000.00,
"equityWithLoan": 125000.00,
"initMarginReq": 35000.00,
"maintMarginReq": 28000.00,
"availableFunds": 90000.00,
"excessLiquidity": 97000.00,
"buyingPower": 270000.00,
"cashValue": 50000.00,
"grossPositionValue": 75000.00,
"unrealizedPnl": 18106.00,
"realizedPnl": 3250.00
}Rate limit
The base rate limit is 60 requests/min.
PrimeAssets
PrimeAssetsPurpose
Returns the detailed segmented asset model for a prime account. The client fills an empty account field from the client default.
Signature
func (c *TradeClient) PrimeAssets(req model.AssetsRequest) (*model.PrimeAsset, error)Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.
Parameters
model.AssetsRequest
| SDK field | Type | Required | Serialization | SDK default and constraints |
|---|---|---|---|---|
Account | string | No | Uses the client default when empty | Trading account ID |
SecretKey | string | No | Uses the client configuration when empty | Institutional-account authentication key |
Segment | bool | No | Omitted when false | AssetsRequest compatibility field; PrimeAssets is already segmented, so this is normally unnecessary |
MarketValue | bool | No | Omitted when false | AssetsRequest compatibility field; whether the prime-assets API applies it depends on the API response |
SubAccounts | []string | No | Omitted if empty | Sub-account list; applicable to institutional-account queries |
BaseCurrency | string | No | Omitted if empty | Base currency; whether the prime-assets API applies it depends on the API response |
Consolidated | *bool | No | Omitted when nil | Whether to consolidate assets; a pointer distinguishes explicit false from omission and applies to prime accounts |
AssetQuoteType | string | No | Omitted if empty | ETH, RTH, or OVERNIGHT; see Asset and Position Valuation |
Lang | string | No | Omitted if empty | Allowed values: zh_CN, zh_TW, en_US |
Returns
(*model.PrimeAsset, error). Key fields from model.PrimeAsset:
| Field | Type | Description |
|---|---|---|
| AccountID | string | Account ID |
| UpdateTimestamp | int64 | Update timestamp |
| Segments | []PrimeAssetSegment | Segment asset list |
PrimeAssetSegment field | Type | Description |
|---|---|---|
| Capability | string | Account capability |
| Category | string | Segment category |
| Currency | string | Currency |
| CashBalance | float64 | Cash balance |
| CashAvailableForTrade | float64 | Cash available for trading |
| GrossPositionValue | float64 | Gross position value |
| EquityWithLoan | float64 | Equity with loan |
| NetLiquidation | float64 | Net liquidation value |
| InitMargin | float64 | Initial margin |
| MaintainMargin | float64 | Maintenance margin |
| OvernightMargin | float64 | Overnight margin |
| UnrealizedPL | float64 | Unrealized P&L |
| UnrealizedPLByCostOfCarry | float64 | Unrealized P&L by cost of carry |
| RealizedPL | float64 | Realized P&L |
| TotalTodayPL | float64 | Total P&L today |
| ExcessLiquidation | float64 | Excess liquidity |
| OvernightLiquidation | float64 | Overnight liquidity |
| BuyingPower | float64 | Buying power |
| LockedFunds | float64 | Locked funds |
| Leverage | float64 | Leverage |
| Uncollected | float64 | Uncollected funds |
| CurrencyAssets | []CurrencyAsset | Per-currency assets |
| ConsolidatedSegTypes | []string | Consolidated segment types |
CurrencyAsset field | Type | Description |
|---|---|---|
| Currency | string | Currency |
| CashBalance | float64 | Cash balance |
| CashAvailableForTrade | float64 | Cash available for trading |
| ForexRate | float64 | Exchange rate |
Invocation example
result, err := tc.PrimeAssets(model.AssetsRequest{
Account: "your_prime_or_paper_account",
AssetQuoteType: "OVERNIGHT",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result){
"account": "12345678",
"totalAssets": 125000.00,
"netLiquidation": 125000.00,
"totalCashValue": 50000.00,
"stockMarketValue": 75000.00,
"optionMarketValue": 0.0,
"futureMarketValue": 0.0,
"unrealizedPnl": 18106.00,
"realizedPnl": 3250.00
}Rate limit
The base rate limit is 60 requests/min.
AnalyticsAsset
AnalyticsAssetPurpose
Returns daily holding value, cash, P&L, and net-value analytics. The client unwraps the server items envelope, and fills an empty account field from the client default.
Signature
func (c *TradeClient) AnalyticsAsset(req model.AnalyticsAssetRequest) ([]model.AnalyticsAsset, error)Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.
Parameters
model.AnalyticsAssetRequest
| SDK field | Type | Required | Serialization | SDK default and constraints |
|---|---|---|---|---|
Account | string | No | Uses the client default when empty | Trading account ID |
SubAccount | string | No | Omitted if empty | One sub-account |
SecretKey | string | No | Omitted if empty | Institutional-account authentication key |
SegType | string | No | Omitted if empty | Allowed values: ALL, SEC, FUT, FUND |
Currency | string | No | Omitted if empty | Allowed values: ALL, USD, HKD, CNH, SGD |
SubAccounts | []string | No | Omitted if empty | Sub-account list |
StartDate | string | No | Omitted if empty | None; yyyy-MM-dd |
EndDate | string | No | Omitted if empty | None; yyyy-MM-dd |
Lang | string | No | Omitted if empty | Allowed values: zh_CN, zh_TW, en_US |
Returns
([]model.AnalyticsAsset, error). Key fields from model.AnalyticsAsset:
| Field | Type | Description |
|---|---|---|
| Date | string | Date |
| HoldingValue | float64 | Holding value |
| CashBalance | float64 | Cash balance |
| Pnl | float64 | P&L |
| PnlRate | float64 | P&L rate |
| NetValueIndex | float64 | Net value index |
| Currency | string | Currency |
| SegType | string | Segment type |
Invocation example
result, err := tc.AnalyticsAsset(model.AnalyticsAssetRequest{
Account: "U123456",
Currency: "USD",
StartDate: "2025-01-01",
EndDate: "2025-01-31",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result){
"account": "12345678",
"summary": {
"netLiquidation": 125000.00,
"totalCashValue": 50000.00,
"grossPositionValue": 75000.00,
"unrealizedPnl": 18106.00,
"realizedPnl": 3250.00
},
"segments": [
{"secType": "STK", "marketValue": 75000.00, "unrealizedPnl": 18106.00}
]
}AggregateAssets
AggregateAssetsPurpose
Aggregates assets for institutional accounts with aggregation enabled, such as accounts with shared purchasing power across sub-accounts. An institutional trader key and a segment (SEC, FUT, or FUND) are required. The client fills an empty account field from the client default.
Signature
func (c *TradeClient) AggregateAssets(req model.AggregateAssetsRequest) (*model.AggregateAssets, error)Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.
Parameters
model.AggregateAssetsRequest
| SDK field | Type | Required | Serialization | SDK default and constraints |
|---|---|---|---|---|
Account | string | No | Uses the client default when empty | Trading account ID |
SecretKey | string | Yes, in request or configuration | Uses the client configuration when empty | Required institutional trader key |
SegType | string | Yes | Omitted if empty | API requires SEC, FUT, or FUND |
BaseCurrency | string | No | Omitted if empty | Base currency |
AssetQuoteType | string | No | Omitted if empty | ETH, RTH, or OVERNIGHT; see Asset and Position Valuation |
Lang | string | No | Omitted if empty | Allowed values: zh_CN, zh_TW, en_US |
Returns
(*model.AggregateAssets, error). Key fields from model.AggregateAssets:
| Field | Type | Description |
|---|---|---|
| AccountID | string | Account ID |
| NetLiquidation | float64 | Net liquidation value |
| GrossPositionValue | float64 | Gross position value |
| CashBalance | float64 | Cash balance |
| BaseCurrency | string | Base currency |
| CurrencyAssets | []CurrencyAsset | Per-currency asset list |
CurrencyAsset fields:
| Field | Type | Description |
|---|---|---|
| Currency | string | Currency |
| CashBalance | float64 | Cash balance |
| CashAvailableForTrade | float64 | Cash available for trading |
| ForexRate | float64 | Exchange rate |
Invocation example
result, err := tc.AggregateAssets(model.AggregateAssetsRequest{
Account: "your_institutional_account",
SecretKey: "your_institutional_secret_key",
SegType: "SEC",
AssetQuoteType: "OVERNIGHT",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)[
{
"account": "12345678",
"accountType": "STANDARD",
"netLiquidation": 125000.00,
"totalCashValue": 50000.00,
"currency": "USD"
}
]Rate limit
The base rate limit is 60 requests/min.
Updated 6 days ago
