Accounts and Funds
ManagedAccounts
ManagedAccountsPurpose
Lists sub-accounts managed by the configured institutional account. The client unwraps the server items envelope, and fills an empty account field from the client default.
Signature
func (c *TradeClient) ManagedAccounts(req model.ManagedAccountsRequest) ([]model.ManagedAccount, error)Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.
Parameters
model.ManagedAccountsRequest
| SDK field | Type | Required | Serialization | SDK default and constraints |
|---|---|---|---|---|
Lang | string | No | Omitted if empty | Allowed values: zh_CN, zh_TW, en_US |
Returns
([]model.ManagedAccount, error). Key fields from model.ManagedAccount:
| Field | Type | Description |
|---|---|---|
| Account | string | Account ID |
| AccountType | string | Account type (STANDARD/PAPER) |
| Capability | string | Account capability (e.g. RegTMargin) |
| Status | string | Account status |
Invocation example
result, err := tc.ManagedAccounts(model.ManagedAccountsRequest{
Account: "U123456",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result){
"items": [
{
"account": "12345678",
"capability": "RegTMargin",
"accountType": "STANDARD",
"status": "Funded"
},
{
"account": "21145462914775637",
"capability": "RegTMargin",
"accountType": "PAPER",
"status": "Funded"
}
]
}PlaceForexOrder
PlaceForexOrderPurpose
Submits a currency-conversion order between source and target currencies. The client fills an empty account field from the client default.
Signature
func (c *TradeClient) PlaceForexOrder(req model.ForexOrderRequest) (*model.ForexOrderResult, error)Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.
Parameters
model.ForexOrderRequest
| SDK field | Type | Required | Serialization | SDK default and constraints |
|---|---|---|---|---|
SegType | string | No | Omitted if empty | Allowed values: ALL, SEC, FUT, FUND |
TimeInForce | string | No | Omitted if empty | Allowed values: DAY, GTC, OPG |
Lang | string | No | Omitted if empty | Allowed values: zh_CN, zh_TW, en_US |
Returns
(*model.ForexOrderResult, error). Key fields from model.ForexOrderResult:
| Field | Type | Description |
|---|---|---|
| ID | string | Forex order ID |
| Status | string | Order status |
| SourceCurrency | string | Source currency |
| TargetCurrency | string | Target currency |
| SourceAmount | float64 | Source amount |
| TargetAmount | float64 | Target amount |
| Rate | float64 | Exchange rate |
| SubmitTime | int64 | Submit time |
Invocation example
result, err := tc.PlaceForexOrder(model.ForexOrderRequest{
Account: "U123456",
SourceCurrency: "USD",
SourceAmount: 1000,
TargetCurrency: "HKD",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result){
"id": 987654321,
"orderId": 987654321,
"symbol": "USD.HKD",
"secType": "CASH",
"action": "BUY",
"orderType": "MKT",
"totalQuantity": 10000,
"filledQuantity": 0,
"status": "Initial",
"account": "12345678"
}SegmentFundAvailable
SegmentFundAvailablePurpose
Returns amounts available for transfer between account segments. The client fills an empty account field from the client default.
Signature
func (c *TradeClient) SegmentFundAvailable(req model.SegmentFundRequest) ([]model.SegmentFundAvailableItem, error)Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.
Parameters
model.SegmentFundRequest
| SDK field | Type | Required | Serialization | SDK default and constraints |
|---|---|---|---|---|
FromSegment | string | No | Omitted if empty | Allowed values: SEC or FUT where supported |
ToSegment | string | No | Omitted if empty | Allowed values: SEC or FUT where supported |
Currency | string | No | Omitted if empty | Allowed values: ALL, USD, HKD, CNH, SGD |
Lang | string | No | Omitted if empty | Allowed values: zh_CN, zh_TW, en_US |
Returns
([]model.SegmentFundAvailableItem, error). Key fields from model.SegmentFundAvailableItem:
| Field | Type | Description |
|---|---|---|
| FromSegment | string | Source segment |
| Currency | string | Currency |
| Amount | float64 | Available amount for transfer |
Invocation example
result, err := tc.SegmentFundAvailable(model.SegmentFundRequest{
Account: "U123456",
FromSegment: "SEC",
ToSegment: "FUT",
Currency: "USD",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result){
"account": "12345678",
"segments": [
{"category": "S", "currency": "USD", "availableFunds": 50000.00},
{"category": "C", "currency": "USD", "availableFunds": 25000.00}
]
}SegmentFundHistory
SegmentFundHistoryPurpose
Returns account-segment transfer history. The client fills an empty account field from the client default.
Signature
func (c *TradeClient) SegmentFundHistory(req model.SegmentFundRequest) ([]model.SegmentFundHistoryItem, error)Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.
Parameters
model.SegmentFundRequest
| SDK field | Type | Required | Serialization | SDK default and constraints |
|---|---|---|---|---|
FromSegment | string | No | Omitted if empty | Allowed values: SEC or FUT where supported |
ToSegment | string | No | Omitted if empty | Allowed values: SEC or FUT where supported |
Currency | string | No | Omitted if empty | Allowed values: ALL, USD, HKD, CNH, SGD |
Lang | string | No | Omitted if empty | Allowed values: zh_CN, zh_TW, en_US |
Returns
([]model.SegmentFundHistoryItem, error). Key fields from model.SegmentFundHistoryItem:
| Field | Type | Description |
|---|---|---|
| ID | int64 | Transfer record ID |
| FromSegment | string | Source segment |
| ToSegment | string | Target segment |
| Currency | string | Currency |
| Amount | float64 | Transfer amount |
| Status | string | Status |
| StatusDesc | string | Status description |
| SettledAt | int64 | Settlement time |
| CreatedAt | int64 | Creation time |
| UpdatedAt | int64 | Update time |
Invocation example
result, err := tc.SegmentFundHistory(model.SegmentFundRequest{
ID: "transfer-id",
Account: "U123456",
FromSegment: "SEC",
ToSegment: "FUT",
Currency: "USD",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)[
{
"id": 111222333,
"account": "12345678",
"fromSegment": "S",
"toSegment": "C",
"currency": "USD",
"amount": 5000.00,
"status": "Completed",
"createTime": 1785384000000
}
]TransferSegmentFund
TransferSegmentFundPurpose
Submits a transfer between account segments. The client fills an empty account field from the client default.
Signature
func (c *TradeClient) TransferSegmentFund(req model.SegmentFundRequest) (*model.SegmentFund, error)Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.
Parameters
model.SegmentFundRequest
| SDK field | Type | Required | Serialization | SDK default and constraints |
|---|---|---|---|---|
FromSegment | string | No | Omitted if empty | Allowed values: SEC or FUT where supported |
ToSegment | string | No | Omitted if empty | Allowed values: SEC or FUT where supported |
Currency | string | No | Omitted if empty | Allowed values: ALL, USD, HKD, CNH, SGD |
Lang | string | No | Omitted if empty | Allowed values: zh_CN, zh_TW, en_US |
Returns
(*model.SegmentFund, error). Key fields from model.SegmentFund:
| Field | Type | Description |
|---|---|---|
| ID | interface | Transfer ID |
| FromSegment | string | Source segment |
| ToSegment | string | Target segment |
| Currency | string | Currency |
| Amount | float64 | Transfer amount |
| Status | string | Status |
| StatusDesc | string | Status description |
| Message | string | Message |
| SettledAt | int64 | Settlement time |
| CreatedAt | int64 | Creation time |
| UpdatedAt | int64 | Update time |
Invocation example
result, err := tc.TransferSegmentFund(model.SegmentFundRequest{
ID: "transfer-id",
Account: "U123456",
FromSegment: "SEC",
ToSegment: "FUT",
Currency: "USD",
Amount: 10000,
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result){
"id": 111222334,
"account": "12345678",
"fromSegment": "S",
"toSegment": "C",
"currency": "USD",
"amount": 5000.00,
"status": "Pending"
}CancelSegmentFund
CancelSegmentFundPurpose
Cancels a pending account-segment transfer. The client fills an empty account field from the client default.
Signature
func (c *TradeClient) CancelSegmentFund(req model.SegmentFundRequest) (*model.SegmentFund, error)Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.
Parameters
model.SegmentFundRequest
| SDK field | Type | Required | Serialization | SDK default and constraints |
|---|---|---|---|---|
FromSegment | string | No | Omitted if empty | Allowed values: SEC or FUT where supported |
ToSegment | string | No | Omitted if empty | Allowed values: SEC or FUT where supported |
Currency | string | No | Omitted if empty | Allowed values: ALL, USD, HKD, CNH, SGD |
Lang | string | No | Omitted if empty | Allowed values: zh_CN, zh_TW, en_US |
Returns
(*model.SegmentFund, error). Key fields from model.SegmentFund:
| Field | Type | Description |
|---|---|---|
| ID | interface | Transfer ID |
| FromSegment | string | Source segment |
| ToSegment | string | Target segment |
| Currency | string | Currency |
| Amount | float64 | Transfer amount |
| Status | string | Status |
| StatusDesc | string | Status description |
| Message | string | Message |
| SettledAt | int64 | Settlement time |
| CreatedAt | int64 | Creation time |
| UpdatedAt | int64 | Update time |
Invocation example
result, err := tc.CancelSegmentFund(model.SegmentFundRequest{
ID: "transfer-id",
Account: "U123456",
FromSegment: "SEC",
ToSegment: "FUT",
Currency: "USD",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result){
"id": 111222334,
"account": "12345678",
"fromSegment": "S",
"toSegment": "C",
"currency": "USD",
"amount": 5000.00,
"status": "Cancelled"
}FundDetails
FundDetailsPurpose
Lists cash-ledger entries using segment, type, currency, time, and offset filters. The client unwraps the server items envelope, and fills an empty account field from the client default.
Signature
func (c *TradeClient) FundDetails(req model.FundDetailsRequest) ([]model.FundDetails, error)Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.
Parameters
model.FundDetailsRequest
| SDK field | Type | Required | Serialization | SDK default and constraints |
|---|---|---|---|---|
Currency | string | No | Omitted if empty | Allowed values: ALL, USD, HKD, CNH, SGD |
Lang | string | No | Omitted if empty | Allowed values: zh_CN, zh_TW, en_US |
Returns
([]model.FundDetails, error). Key fields from model.FundDetails:
| Field | Type | Description |
|---|---|---|
| ID | FlexInt64 | Ledger entry ID |
| Account | string | Account ID |
| SegType | string | Segment type |
| FundType | string | Fund type |
| Currency | string | Currency |
| Amount | float64 | Amount |
| Balance | float64 | Balance |
| OccurTime | int64 | Occurrence time |
| Remark | string | Remark |
| ExternalID | string | External ID |
Invocation example
result, err := tc.FundDetails(model.FundDetailsRequest{
Account: "U123456",
Currency: "USD",
StartDate: 1704067200000, // 2024-01-01 UTC
EndDate: 1706745600000, // 2024-02-01 UTC
Limit: 20,
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result){
"account": "12345678",
"currency": "USD",
"items": [
{"currency": "USD", "cashBalance": 50000.00, "exchangeRate": 1.0},
{"currency": "HKD", "cashBalance": 15600.00, "exchangeRate": 7.80}
]
}FundingHistory
FundingHistoryPurpose
Lists deposit and withdrawal transfer records. The client fills an empty account field from the client default.
Signature
func (c *TradeClient) FundingHistory(req model.FundingHistoryRequest) ([]model.FundingHistoryItem, error)Requires a trading account accessible through the configuration. Institutional accounts can authenticate with SecretKey.
Parameters
model.FundingHistoryRequest
| SDK field | Type | Required | Serialization | SDK default and constraints |
|---|---|---|---|---|
SegType | string | No | Omitted if empty | Allowed values: ALL, SEC, FUT, FUND |
Lang | string | No | Omitted if empty | Allowed values: zh_CN, zh_TW, en_US |
Returns
([]model.FundingHistoryItem, error). Key fields from model.FundingHistoryItem:
| Field | Type | Description |
|---|---|---|
| ID | int64 | Record ID |
| RefID | string | Reference ID |
| Type | int | Type code |
| TypeDesc | string | Type description |
| Currency | string | Currency |
| Amount | float64 | Amount |
| BusinessDate | string | Business date |
| Status | string | Status |
| StatusDesc | string | Status description |
| CompletedStatus | bool | Whether completed |
| CreatedAt | int64 | Creation time |
| UpdatedAt | int64 | Update time |
Invocation example
result, err := tc.FundingHistory(model.FundingHistoryRequest{
Account: "U123456",
Lang: "en_US",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)[
{
"id": 555666777,
"account": "12345678",
"currency": "USD",
"amount": 10000.00,
"type": "Deposit",
"status": "Completed",
"updateTime": 1785384000000
}
]Updated about 17 hours ago
