Account Subscriptions
SubscribeAsset
SubscribeAssetPurpose
Subscribes the connected client to asset events and records the subscription locally.
Signature
func (c *PushClient) SubscribeAsset(account string) errorRequires an authenticated push connection and an accessible trading account. An empty account uses the configured account.
Parameters
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
account | string | Yes | None | Account ID; an empty string uses the configured default account |
Returns
error; nil means the message was written to the current connection.
Invocation example
if err := pc.SubscribeAsset(""); err != nil {
log.Fatal(err)
}Callback Data Example
{
"account": "13810712",
"currency": "USD",
"segment": "S",
"availableFunds": 2285040.55,
"netLiquidation": 2285529.37,
"buyingPower": 9140162.19,
"cashBalance": 2284275.24,
"grossPositionValue": 1143.04,
"timestamp": "1669888806020"
}UnsubscribeAsset
UnsubscribeAssetPurpose
Unsubscribes the connected client from asset events and removes the local subscription record.
Signature
func (c *PushClient) UnsubscribeAsset() errorRequires an authenticated push connection and an accessible trading account. An empty account uses the configured account.
Parameters
No parameters.
Returns
error; nil means the message was written to the current connection.
Invocation example
if err := pc.UnsubscribeAsset(); err != nil {
log.Fatal(err)
}SubscribePosition
SubscribePositionPurpose
Subscribes the connected client to position events and records the subscription locally.
Signature
func (c *PushClient) SubscribePosition(account string) errorRequires an authenticated push connection and an accessible trading account. An empty account uses the configured account.
Parameters
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
account | string | Yes | None | Account ID; an empty string uses the configured default account |
Returns
error; nil means the message was written to the current connection.
Invocation example
if err := pc.SubscribePosition(""); err != nil {
log.Fatal(err)
}Callback Data Example
{
"account": "13810712",
"symbol": "AAPL",
"identifier": "AAPL",
"market": "US",
"secType": "STK",
"positionQty": 4.0,
"averageCost": 75.0,
"latestPrice": 147.23,
"marketValue": 588.92,
"unrealizedPnl": 288.92,
"timestamp": "1669888802018"
}UnsubscribePosition
UnsubscribePositionPurpose
Unsubscribes the connected client from position events and removes the local subscription record.
Signature
func (c *PushClient) UnsubscribePosition() errorRequires an authenticated push connection and an accessible trading account. An empty account uses the configured account.
Parameters
No parameters.
Returns
error; nil means the message was written to the current connection.
Invocation example
if err := pc.UnsubscribePosition(); err != nil {
log.Fatal(err)
}SubscribeOrder
SubscribeOrderPurpose
Subscribes the connected client to order events and records the subscription locally.
Signature
func (c *PushClient) SubscribeOrder(account string) errorRequires an authenticated push connection and an accessible trading account. An empty account uses the configured account.
Parameters
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
account | string | Yes | None | Account ID; an empty string uses the configured default account |
Returns
error; nil means the message was written to the current connection.
Invocation example
if err := pc.SubscribeOrder(""); err != nil {
log.Fatal(err)
}Callback Data Example
{
"id": "28875370355884032",
"account": "736845",
"symbol": "CL",
"action": "BUY",
"orderType": "LMT",
"totalQuantity": "1",
"filledQuantity": "1",
"avgFillPrice": 77.76,
"status": "Filled",
"timestamp": "1669200782221"
}UnsubscribeOrder
UnsubscribeOrderPurpose
Unsubscribes the connected client from order events and removes the local subscription record.
Signature
func (c *PushClient) UnsubscribeOrder() errorRequires an authenticated push connection and an accessible trading account. An empty account uses the configured account.
Parameters
No parameters.
Returns
error; nil means the message was written to the current connection.
Invocation example
if err := pc.UnsubscribeOrder(); err != nil {
log.Fatal(err)
}SubscribeTransaction
SubscribeTransactionPurpose
Subscribes the connected client to transaction events and records the subscription locally.
Signature
func (c *PushClient) SubscribeTransaction(account string) errorRequires an authenticated push connection and an accessible trading account. An empty account uses the configured account.
Parameters
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
account | string | Yes | None | Account ID; an empty string uses the configured default account |
Returns
error; nil means the message was written to the current connection.
Invocation example
if err := pc.SubscribeTransaction(""); err != nil {
log.Fatal(err)
}UnsubscribeTransaction
UnsubscribeTransactionPurpose
Unsubscribes the connected client from transaction events and removes the local subscription record.
Signature
func (c *PushClient) UnsubscribeTransaction() errorRequires an authenticated push connection and an accessible trading account. An empty account uses the configured account.
Parameters
No parameters.
Returns
error; nil means the message was written to the current connection.
Invocation example
if err := pc.UnsubscribeTransaction(); err != nil {
log.Fatal(err)
}Updated about 17 hours ago
