Documentation
¶
Overview ¶
Package trade provide TradeContext
Index ¶
- Constants
- type AccountBalance
- type AccountBalances
- type AllExecutionsResponse
- type BalanceType
- type CashFlow
- type CashFlows
- type CashInfo
- type ChargeCategoryCode
- type CommissionFreeStatus
- type Currency
- type DeductionStatus
- type EstimateMaxPurchaseQuantityResponse
- type Execution
- type Executions
- type FundPosition
- type FundPositionChannel
- type FundPositions
- type GetAccountBalance
- type GetAllExecutions
- type GetCashFlow
- type GetEstimateMaxPurchaseQuantity
- type GetFundPositions
- type GetHistoryExecutions
- type GetHistoryOrders
- type GetStockPositions
- type GetTodayExecutions
- type GetTodayOrders
- type GetUSHistoryOrders
- type GetUSRealizedPL
- type MarginRatio
- type Market
- type OfDirection
- type Option
- type Options
- type Order
- type OrderChargeDetail
- type OrderChargeFee
- type OrderChargeItem
- type OrderDetail
- type OrderHistoryDetail
- type OrderSide
- type OrderStatus
- type OrderTag
- type OrderType
- type Orders
- type OutsideRTH
- type PushEvent
- type PushOrderChanged
- type QueryUSOrdersRequest
- type QueryUSOrdersResponse
- type ReplaceOrder
- type StockPosition
- type StockPositionChannel
- type StockPositions
- type SubResponse
- type SubResponseFail
- type SubmitOrder
- type TimeType
- type TradeContext
- func (c *TradeContext) AccountBalance(ctx context.Context, params *GetAccountBalance) (accounts []*AccountBalance, err error)
- func (c *TradeContext) AllExecutions(ctx context.Context, params *GetAllExecutions) (resp *AllExecutionsResponse, err error)
- func (c *TradeContext) CancelOrder(ctx context.Context, orderId string) (err error)
- func (c *TradeContext) CashFlow(ctx context.Context, params *GetCashFlow) (cashflows []*CashFlow, err error)
- func (c *TradeContext) Close() error
- func (c *TradeContext) EstimateMaxPurchaseQuantity(ctx context.Context, params *GetEstimateMaxPurchaseQuantity) (empqr EstimateMaxPurchaseQuantityResponse, err error)
- func (c *TradeContext) FundPositions(ctx context.Context, symbols []string) (fundPositionChannels []*FundPositionChannel, err error)
- func (c *TradeContext) HistoryExecutions(ctx context.Context, params *GetHistoryExecutions) (trades []*Execution, err error)
- func (c *TradeContext) HistoryOrders(ctx context.Context, params *GetHistoryOrders) (orders []*Order, hasMore bool, err error)
- func (c *TradeContext) MarginRatio(ctx context.Context, symbol string) (marginRatio MarginRatio, err error)
- func (c *TradeContext) OnTrade(f func(*PushEvent))
- func (c *TradeContext) OrderDetail(ctx context.Context, orderId string) (orderDetail OrderDetail, err error)
- func (c *TradeContext) QueryUSOrders(ctx context.Context, req *GetUSHistoryOrders) (*QueryUSOrdersResponse, error)
- func (c *TradeContext) ReplaceOrder(ctx context.Context, params *ReplaceOrder) (err error)
- func (c *TradeContext) StockPositions(ctx context.Context, symbols []string) (stockPositionChannels []*StockPositionChannel, err error)
- func (c *TradeContext) SubmitOrder(ctx context.Context, params *SubmitOrder) (orderId string, err error)
- func (c *TradeContext) Subscribe(ctx context.Context, topics []string) (subRes *SubResponse, err error)
- func (c *TradeContext) TodayExecutions(ctx context.Context, params *GetTodayExecutions) (trades []*Execution, err error)
- func (c *TradeContext) TodayOrders(ctx context.Context, params *GetTodayOrders) (orders []*Order, err error)
- func (c *TradeContext) USAssetOverview(ctx context.Context) (*USAssetOverview, error)
- func (c *TradeContext) USOrderDetail(ctx context.Context, orderID string) (*USOrderDetailResponse, error)
- func (c *TradeContext) USRealizedPL(ctx context.Context, req *GetUSRealizedPL) (*USRealizedPLResponse, error)
- func (c *TradeContext) Unsubscribe(ctx context.Context, topics []string) (unsubRes *UnsubResponse, err error)
- func (c *TradeContext) WithdrawOrder(ctx context.Context, orderId string) (err error)
- type TriggerPriceType
- type TriggerStatus
- type USAssetOverview
- type USAttachedOrder
- type USButtonControl
- type USCashEntry
- type USChargeDetail
- type USChargeItem
- type USCryptoEntry
- type USOrder
- type USOrderDetail
- type USOrderDetailResponse
- type USOrderHistory
- type USRealizedPLEntry
- type USRealizedPLMetric
- type USRealizedPLResponse
- type USStockEntry
- type UnsubResponse
Constants ¶
const ( // Balance type BalanceTypeUnknown BalanceType = 0 // unknown type BalanceTypeCash BalanceType = 1 // cash BalanceTypeStock BalanceType = 2 // stock BalanceTypeFund BalanceType = 3 // fund // Outflow direction OfDirectionUnkown OfDirection = 0 OfDirectionOut OfDirection = 1 // outflow OfDirectionIn OfDirection = 2 // inflow // Time force in type TimeTypeDay TimeType = "Day" // Day Order TimeTypeGTC TimeType = "GTC" // Good Til Canceled Order TimeTypeGTD TimeType = "GTD" // Good Til Date Order // Order type OrderTypeLO OrderType = "LO" // Limit Order OrderTypeELO OrderType = "ELO" // Enhanced Limit Order OrderTypeMO OrderType = "MO" // Market Order OrderTypeAO OrderType = "AO" // At-auction Order OrderTypeALO OrderType = "ALO" // At-auction Limit Order OrderTypeODD OrderType = "ODD" // Odd Lots Order OrderTypeLIT OrderType = "LIT" // Limit If Touched OrderTypeMIT OrderType = "MIT" // Market If Touched OrderTypeTSLPAMT OrderType = "TSLPAMT" // Trailing Limit If Touched (Trailing Amount) OrderTypeTSLPPCT OrderType = "TSLPPCT" // Trailing Limit If Touched (Trailing Percent) OrderTypeTSMAMT OrderType = "TSMAMT" // Trailing Market If Touched (Trailing Amount) OrderTypeTSMPCT OrderType = "TSMPCT" // Trailing Market If Touched (Trailing Percent) OrderTypeSLO OrderType = "SLO" // SLO order // Order side OrderSideBuy OrderSide = "Buy" OrderSideSell OrderSide = "Sell" // Order status OrderNotReported OrderStatus = "NotReported" OrderReplacedNotReported OrderStatus = "ReplacedNotReported" OrderProtectedNotReported OrderStatus = "ProtectedNotReported" OrderVarietiesNotReported OrderStatus = "VarietiesNotReported" OrderFilledStatus OrderStatus = "FilledStatus" OrderWaitToNew OrderStatus = "WaitToNew" OrderNewStatus OrderStatus = "NewStatus" OrderWaitToReplace OrderStatus = "WaitToReplace" OrderPendingReplaceStatus OrderStatus = "PendingReplaceStatus" OrderReplacedStatus OrderStatus = "ReplacedStatus" OrderPartialFilledStatus OrderStatus = "PartialFilledStatus" OrderWaitToCancel OrderStatus = "WaitToCancel" OrderPendingCancelStatus OrderStatus = "PendingCancelStatus" OrderRejectedStatus OrderStatus = "RejectedStatus" OrderCanceledStatus OrderStatus = "CanceledStatus" OrderExpiredStatus OrderStatus = "ExpiredStatus" OrderPartialWithdrawal OrderStatus = "PartialWithdrawal" // Outside RTH OutsideRTHOnly OutsideRTH = "RTH_ONLY" // Regular trading hour only OutsideRTHAny OutsideRTH = "ANY_TIME" // Any time OutsideRTHOvernight OutsideRTH = "OVERNIGHT" // Overnight OutsideRTHOptionPreMarket OutsideRTH = "OPTION_PRE_MARKET" // Overnight option OutsideRTHUnknown OutsideRTH = "UnknownOutsideRth" // Default is UnknownOutsideRth when the order is not a US stock // Order tag OrderTagNormal OrderTag = "Normal" // Normal Order OrderTagLongTerm OrderTag = "Gtc" // Long term Order OrderTagGrey OrderTag = "Grey" // Grey Order // Trigger status TriggerStatusDeactive TriggerStatus = "DEACTIVE" TriggerStatusActive TriggerStatus = "ACTIVE" TriggerStatusReleased TriggerStatus = "RELEASED" // Trigger price type TriggerPriceTypeLimit TriggerPriceType = "LIT" // Limit If Touched TriggerPriceTypeMarket TriggerPriceType = "MIT" // Market If Touched // Commission-free Status CommissionFreeStatusNone CommissionFreeStatus = "None" CommissionFreeStatusCaculated CommissionFreeStatus = "Calculated" // Commission-free amount to be calculated CommissionFreeStatusPending CommissionFreeStatus = "Pending" // Pending commission-free CommissionFreeStatusReady CommissionFreeStatus = "Ready" // Commission-free applied // Deduction status/Cashback Status DeductionStatusNone DeductionStatus = "NONE" DeductionStatusNoData DeductionStatus = "NO_DATA" DeductionStatusPending DeductionStatus = "PENDING" DeductionStatusDone DeductionStatus = "DONE" // Charge category code ChargeCategoryCodeUnknown ChargeCategoryCode = "UNKNOWN" ChargeCategoryCodeBrokerFees ChargeCategoryCode = "BROKER_FEES" ChargeCategoryCodeThirdFees ChargeCategoryCode = "THIRD_FEES" // Currency CurrencyHKD Currency = "HKD" CurrencyUSD Currency = "USD" CurrencyCNH Currency = "CNH" CurrencyDefault Currency = "" )
const (
DefaultTradeUrl = "wss://openapi-trade.longbridge.com/v2"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountBalance ¶
type AccountBalance struct {
TotalCash *decimal.Decimal
MaxFinanceAmount *decimal.Decimal
RemainingFinanceAmount *decimal.Decimal
RiskLevel string
MarginCall *decimal.Decimal
NetAssets *decimal.Decimal // net asset
InitMargin *decimal.Decimal // initial margin
MaintenanceMargin *decimal.Decimal // maintenance margin
Currency string
BuyPower *decimal.Decimal
CashInfos []*CashInfo
}
AccountBalance is user account balance
type AccountBalances ¶
type AccountBalances struct {
List []*AccountBalance
}
AccountBalances has a AccountBalance list
type AllExecutionsResponse ¶ added in v0.26.0
AllExecutionsResponse is the response for get all executions request
type BalanceType ¶
type BalanceType int32
type CashFlow ¶
type CashFlow struct {
TransactionFlowName string
Direction OfDirection
BusinessType BalanceType
Balance *decimal.Decimal
Currency string
BusinessTime string
Symbol string
Description string
}
CashFlow is cash flow details
type CashInfo ¶
type CashInfo struct {
WithdrawCash *decimal.Decimal
AvailableCash *decimal.Decimal
FrozenCash *decimal.Decimal
SettlingCash *decimal.Decimal
Currency string
}
CashInfo
type ChargeCategoryCode ¶
type ChargeCategoryCode string
type CommissionFreeStatus ¶
type CommissionFreeStatus string
type DeductionStatus ¶
type DeductionStatus string
type EstimateMaxPurchaseQuantityResponse ¶
type EstimateMaxPurchaseQuantityResponse struct {
CashMaxQty int64 // Cash available quantity
MarginMaxQty int64 // Margin available quantity
}
EstimateMaxPurchaseQuantity is response for estimate maximum purchase quantity
type Execution ¶
type Execution struct {
OrderId string
TradeId string
Symbol string
TradeDoneAt time.Time
Quantity string
Price *decimal.Decimal
}
Execution is execution details
type FundPosition ¶
type FundPosition struct {
Symbol string
CurrentNetAssetValue *decimal.Decimal
NetAssetValueDay int64
SymbolName string
Currency string
CostNetAssetValue *decimal.Decimal
HoldingUnits *decimal.Decimal
}
FundPosition is fund position details
type FundPositionChannel ¶
type FundPositionChannel struct {
AccountChannel string
Positions []*FundPosition
}
FundPositionChannel is a account channel's fund position details
type FundPositions ¶
type FundPositions struct {
List []*FundPositionChannel
}
FundPositions has a FundPosition list
type GetAccountBalance ¶
type GetAccountBalance struct {
Currency Currency // optional
}
func (*GetAccountBalance) Values ¶
func (r *GetAccountBalance) Values() url.Values
type GetAllExecutions ¶ added in v0.26.0
type GetAllExecutions struct {
Symbol string // optional
OrderId string // optional
StartAt time.Time // optional
EndAt time.Time // optional
Page int64 // optional
}
func (*GetAllExecutions) Values ¶ added in v0.26.0
func (req *GetAllExecutions) Values() url.Values
type GetCashFlow ¶
type GetCashFlow struct {
StartAt int64 // start timestamp , required
EndAt int64 // end timestamp, required
BusinessType BalanceType
Symbol string
Page int64
Size int64
}
func (*GetCashFlow) Values ¶
func (r *GetCashFlow) Values() url.Values
type GetEstimateMaxPurchaseQuantity ¶
type GetEstimateMaxPurchaseQuantity struct {
Symbol string
OrderType OrderType
Price decimal.Decimal
Currency string
OrderId string
Side OrderSide
}
func (*GetEstimateMaxPurchaseQuantity) Values ¶
func (r *GetEstimateMaxPurchaseQuantity) Values() url.Values
type GetFundPositions ¶
type GetFundPositions struct {
Symbols []string // optional
}
func (*GetFundPositions) Values ¶
func (r *GetFundPositions) Values() url.Values
type GetHistoryExecutions ¶
type GetHistoryExecutions struct {
Symbol string // optional
StartAt time.Time // optional
EndAt time.Time // optional
}
func (*GetHistoryExecutions) Values ¶
func (req *GetHistoryExecutions) Values() url.Values
type GetHistoryOrders ¶
type GetHistoryOrders struct {
Symbol string // optional
Status []OrderStatus // optional
Side OrderSide // optional
Market openapi.Market // optional
StartAt int64 // optional
EndAt int64 // optional
}
func (*GetHistoryOrders) Values ¶
func (r *GetHistoryOrders) Values() url.Values
type GetStockPositions ¶
type GetStockPositions struct {
Symbols []string // optional
}
func (*GetStockPositions) Values ¶
func (r *GetStockPositions) Values() url.Values
type GetTodayExecutions ¶
func (*GetTodayExecutions) Values ¶
func (req *GetTodayExecutions) Values() url.Values
type GetTodayOrders ¶
type GetTodayOrders struct {
Symbol string // optional
Status []OrderStatus // optional
Side OrderSide // optional
Market openapi.Market // optional
}
func (*GetTodayOrders) Values ¶
func (r *GetTodayOrders) Values() url.Values
type GetUSHistoryOrders ¶ added in v0.26.0
type GetUSHistoryOrders struct {
Symbol string // optional — user-facing symbol e.g. "AAPL.US" or "DOGEUSD.BKKT"
Side OrderSide // optional — Buy / Sell; zero value = all directions
StartAt int64 // optional — unix seconds; zero = last 90 days
EndAt int64 // optional — unix seconds; zero = now
QueryType int32 // 0=all, 1=pending, 2=filled history; default 0
Page int32 // 1-based page number; default 1
Limit int32 // page size; default 20
}
GetUSHistoryOrders is the request for QueryUSOrders, modelled after GetHistoryOrders for HK/CN orders.
QueryType: 0=all (includes Rejected), 1=pending, 2=history (filled only). Default (QueryType=0) matches what the app shows as "past orders".
type GetUSRealizedPL ¶ added in v0.26.0
type GetUSRealizedPL struct {
Currency string // required — e.g. "USD"
// Category filters by asset type: "ALL", "STOCK", "OPTION", "CRYPTO".
// Zero value / empty = all categories.
Category string
}
GetUSRealizedPL is the request for USRealizedPL.
type MarginRatio ¶
type MarginRatio struct {
ImFactor *decimal.Decimal // Initial margin ratio
MmFactor *decimal.Decimal // Maintain the initial margin ratio
FmFactor *decimal.Decimal // Forced close-out margin ratio
}
MarginRatio contains some ratio
type OfDirection ¶
type OfDirection int32
type Option ¶
type Option func(*Options)
Option
func OnReconnect ¶
OnReconnect to set reconnect callbacks for trade context
func WithHttpClient ¶
WithHttpClient use to set http client for trade context
func WithLbOptions ¶
func WithLbOptions(opts *longbridge.Options) Option
WithLbOptions to set longbridge options for trade context
func WithLogger ¶
WithLogger use custom protocol.Logger implementation
func WithTradeURL ¶
WithTradeURL to set trade url for trade context
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options for quote context
type Order ¶
type Order struct {
OrderId string
Status OrderStatus
StockName string
Quantity string
ExecutedQuantity string
Price *decimal.Decimal
ExecutedPrice *decimal.Decimal
SubmittedAt string
Side OrderSide
Symbol string
OrderType OrderType
LastDone *decimal.Decimal
TriggerPrice *decimal.Decimal
Msg string
Tag OrderTag
TimeInForce TimeType
ExpireDate string
UpdatedAt string
TriggerAt string
TrailingAmount *decimal.Decimal
TrailingPercent *decimal.Decimal
LimitOffset *decimal.Decimal
TriggerStatus TriggerStatus
Currency string
OutsideRth OutsideRTH
Remark string
}
Order is order details
type OrderChargeDetail ¶
type OrderChargeDetail struct {
TotalAmount decimal.Decimal
Currency string
Items []OrderChargeItem
}
type OrderChargeFee ¶
type OrderChargeFee struct {
Code ChargeCategoryCode
Name string
Fees []OrderChargeFee
}
type OrderChargeItem ¶
type OrderChargeItem struct {
Code ChargeCategoryCode
Name string
Fees []OrderChargeFee
}
type OrderDetail ¶
type OrderDetail struct {
OrderId string
Status OrderStatus
StockName string
Quantity int64 // Submitted quantity
ExecutedQuantity int64
Price *decimal.Decimal // Submitted price
ExecutedPrice *decimal.Decimal
SubmittedAt string // Submitted time
Side OrderSide /// Order side
Symbol string
OrderType OrderType
LastDone *decimal.Decimal
TriggerPrice *decimal.Decimal
Msg string // Rejected Message or remark
Tag OrderTag
TimeInForce TimeType
ExpireDate string
UpdatedAt string
TriggerAt string // Conditional order trigger time
TrailingAmount *decimal.Decimal
TrailingPercent *decimal.Decimal
LimitOffset *decimal.Decimal
TriggerStatus TriggerStatus
Currency string
OutsideRth OutsideRTH /// Enable or disable outside regular trading hours
Remark string
FreeStatus CommissionFreeStatus
FreeAmount *decimal.Decimal
FreeCurrency string
DeductionsStatus DeductionStatus
DeductionsAmount *decimal.Decimal
DeductionsCurrency string
PlatformDeductedStatus DeductionStatus
PlatformDeductedAmount *decimal.Decimal
PlatformDeductedCurrency string
History OrderHistoryDetail
ChargeDetail OrderChargeDetail
}
type OrderHistoryDetail ¶
type OrderHistoryDetail struct {
// Executed price for executed orders, submitted price for expired,
// canceled, rejected orders, etc.
Price decimal.Decimal
// Executed quantity for executed orders, remaining quantity for expired,
// canceled, rejected orders, etc.
Quantity int64
Status OrderStatus
Msg string // Execution or error message
Time string // Occurrence time
}
type OrderStatus ¶
type OrderStatus string
type OutsideRTH ¶
type OutsideRTH string // Outside regular trading hours
type PushEvent ¶
type PushEvent struct {
Event string
Data *PushOrderChanged
}
PushEvent is quote context callback event
type PushOrderChanged ¶
type PushOrderChanged struct {
AccountNo string
Currency string
ExecutedPrice *decimal.Decimal
ExecutedQuantity *decimal.Decimal
LastPrice *decimal.Decimal
LimitOffset string
Msg string
OrderId string
OrderType OrderType
Side OrderSide
Status OrderStatus
StockName string
SubmittedAt string
Price *decimal.Decimal
Quantity *decimal.Decimal
Symbol string
Tag OrderTag
TrailingAmount *decimal.Decimal
TrailingPercent string
TriggerAt string
TriggerPrice *decimal.Decimal
TriggerStatus TriggerStatus
UpdatedAt string
Remark string
}
PushOrderChanged is order change event details
type QueryUSOrdersRequest ¶ added in v0.26.0
type QueryUSOrdersRequest = GetUSHistoryOrders
QueryUSOrdersRequest is an alias for GetUSHistoryOrders.
type QueryUSOrdersResponse ¶ added in v0.26.0
type QueryUSOrdersResponse struct {
Orders []USOrder `json:"orders"`
TotalCount int32 `json:"total_count"`
}
QueryUSOrdersResponse holds the paged list of US orders.
type ReplaceOrder ¶
type ReplaceOrder struct {
OrderId string // required
Quantity uint64 // required
Price decimal.Decimal // LO / ELO / ALO / ODD / LIT Order Required
TriggerPrice decimal.Decimal // LIT / MIT Order Required
LimitOffset decimal.Decimal // TSLPAMT / TSLPPCT Order Required
TrailingAmount decimal.Decimal // TSLPAMT / TSMAMT Order Required
TrailingPercent decimal.Decimal // TSLPPCT / TSMAPCT Order Required
Remark string
}
type StockPosition ¶
type StockPosition struct {
Symbol string
SymbolName string
Quantity string
AvailableQuantity string
Currency string
CostPrice *decimal.Decimal
Market openapi.Market
}
StockPosition is user stock position details
type StockPositionChannel ¶
type StockPositionChannel struct {
AccountChannel string
Positions []*StockPosition
}
StockPositionChannel is a account channel's stock positions details
type StockPositions ¶
type StockPositions struct {
List []*StockPositionChannel
}
StockPositions has a StockPosition list
type SubResponse ¶
type SubResponse struct {
Success []string
Fail []*SubResponseFail
Current []string
}
SubResponse is subscribe function response
type SubResponseFail ¶
SubResponseFail contains subscribe failed reason
type SubmitOrder ¶
type SubmitOrder struct {
Symbol string // required
OrderType OrderType // required
Side OrderSide // required
SubmittedQuantity uint64 // required
SubmittedPrice decimal.Decimal // LO / ELO / ALO / ODD / LIT Order Required
TriggerPrice decimal.Decimal // LIT / MIT Order Required
LimitOffset decimal.Decimal // TSLPAMT / TSLPPCT Order Required
TrailingAmount decimal.Decimal // TSLPAMT / TSMAMT Order Required
TrailingPercent decimal.Decimal // TSLPPCT / TSMAPCT Order Required
ExpireDate *time.Time // required when time_in_force is GTD
OutsideRTH OutsideRTH
Remark string
TimeInForce TimeType // required
}
type TradeContext ¶
type TradeContext struct {
// contains filtered or unexported fields
}
TradeContext is a client for interacting with Longbridge Trade OpenAPI. Longbridge Trade OpenAPI document is https://open.longbridge.com/en/docs/trade/trade-overview
Example:
conf, err := config.NewFromEnv()
tctx, err := trade.NewFromCfg(conf)
tctx.OnTrade(func(orderEvent *trade.PushEvent) {
fmt.Printf("order event: %v", orderEvent)
})
_, err := tctx.Subscribe(context.Background(), []string{"private"})
price := decimal.NewFromString("175.62")
oid, err := tctx.SubmitOrder(context.Background(), &trade.SubmitOrder{
Symbol: "AAPL.US",
OrderType: trade.OrderTypeLO,
Side: trade.OrderSideBuy,
SubmittedPrice: price,
SubmittedQuantity: 2,
TimeInForce: trade.TimeTypeDay,
})
func New ¶
func New(opt ...Option) (*TradeContext, error)
New return TradeContext with option. A connection will be created with Trade server.
func NewFormEnv
deprecated
func NewFormEnv() (*TradeContext, error)
Deprecated: NewFormEnv return TradeContext with environment variables, use NewFromCfg plz
func NewFromCfg ¶
func NewFromCfg(cfg *config.Config) (*TradeContext, error)
NewFromCfg return TradeContext with config.Config.
func NewHTTPFromCfg ¶ added in v0.26.0
func NewHTTPFromCfg(cfg *config.Config) (*TradeContext, error)
NewHTTPFromCfg returns a TradeContext that uses only the HTTP client, without establishing a WebSocket connection. Use this when you only need HTTP-based methods (e.g. US-market APIs: QueryUSOrders, USAssetOverview, USRealizedPL, USOrderDetail) and do not need trade push events.
func (*TradeContext) AccountBalance ¶
func (c *TradeContext) AccountBalance(ctx context.Context, params *GetAccountBalance) (accounts []*AccountBalance, err error)
AccountBalance to obtain the available, desirable, frozen, to-be-settled, and in-transit funds (fund purchase and redemption) information for each currency of the user. Reference: https://open.longbridge.com/en/docs/trade/asset/account Example:
conf, err := config.NewFromEnv()
tctx, err := trade.NewFromCfg(conf)
ab, err := trade.AccountBalance(context.Background(), &trade.GetAccountBalance{Currency: trade.CurrencyHKD})
func (*TradeContext) AllExecutions ¶ added in v0.26.0
func (c *TradeContext) AllExecutions(ctx context.Context, params *GetAllExecutions) (resp *AllExecutionsResponse, err error)
AllExecutions will return all executions Reference: https://open.longbridge.com/en/docs/trade/execution/all_executions
func (*TradeContext) CancelOrder ¶
func (c *TradeContext) CancelOrder(ctx context.Context, orderId string) (err error)
CancelOrder to close an open order Reference: https://open.longbridge.com/en/docs/trade/order/withdraw Example:
conf, err := config.NewFromEnv() tctx, err := trade.NewFromCfg(conf) err = tctx.CancelOrder(context.Background(), "12123123")
func (*TradeContext) CashFlow ¶
func (c *TradeContext) CashFlow(ctx context.Context, params *GetCashFlow) (cashflows []*CashFlow, err error)
CashFlow to obtain capital inflow/outflow direction, capital type, capital amount, occurrence time, associated stock code and capital flow description information. Reference: https://open.longbridge.com/en/docs/trade/asset/cashflow Example:
conf, err := config.NewFromEnv()
tctx, err := trade.NewFromCfg(conf)
start := time.Date(2024, 5, 1, 0, 0, 0, 0, time.UTC).Unix()
end := time.Date(2024, 6, 1, 0, 0, 0, 0, time.UTC).Unix()
flows, err := tctx.CashFlow(context.Background(), trade.GetCashFlow{
StartAt: start,
EndAt: end,
BussinessType: trade.BalanceTypeCash,
})
func (*TradeContext) EstimateMaxPurchaseQuantity ¶
func (c *TradeContext) EstimateMaxPurchaseQuantity(ctx context.Context, params *GetEstimateMaxPurchaseQuantity) (empqr EstimateMaxPurchaseQuantityResponse, err error)
EstimateMaxPurchaseQuantity is used for estimating the maximum purchase quantity for Hong Kong and US stocks, warrants, and options. Reference: https://open.longbridge.com/en/docs/trade/order/estimate_available_buy_limit Example:
conf, err := config.NewFromEnv()
tctx, err := trade.NewFromCfg(conf)
price, _ := decimal.NewFromString("175.62")
empqr, err := trade.EstimateMaxPurchaseQuantity(context.Background(), &trade.GetEstimateMaxPurchaseQuantity{
Symbol: "AAPL.US",
Price: price,
OrderType: trade.OrderTypeLO,
Currency: "USD",
Side: trade.OrderSideBuy,
})
func (*TradeContext) FundPositions ¶
func (c *TradeContext) FundPositions(ctx context.Context, symbols []string) (fundPositionChannels []*FundPositionChannel, err error)
FundPositions to obtain fund position information including account, fund code, holding share, cost net worth, current net worth, and currency. Reference: https://open.longbridge.com/en/docs/trade/asset/fund Example:
conf, err := config.NewFromEnv()
tctx, err := trade.NewFromCfg(conf)
channels, err := tctx.FundPositions(context.Background, []string{"AAPL.US", "700.HK"})
func (*TradeContext) HistoryExecutions ¶
func (c *TradeContext) HistoryExecutions(ctx context.Context, params *GetHistoryExecutions) (trades []*Execution, err error)
HistoryExecutions will return history executions. Reference: https://open.longbridge.com/en/docs/trade/execution/history_executions
Example:
conf, err := config.NewFromEnv()
tctx, err := trade.NewFromCfg(conf)
trades, err := tctx.HistoryExecutions(context.Background(), &trade.GetHistoryExecutions{
Symbol: "AAPL.US",
StartAt: time.Date(2024, 5, 1, 0, 0, 0, 0, time.UTC),
EndAt: time.Date(2024, 5, 10, 0, 0, 0, 0, time.UTC),
})
func (*TradeContext) HistoryOrders ¶
func (c *TradeContext) HistoryOrders(ctx context.Context, params *GetHistoryOrders) (orders []*Order, hasMore bool, err error)
HistoryOrders will return history orders Reference: https://open.longbridge.com/en/docs/trade/order/history_orders Example:
conf, err := config.NewFromEnv()
tctx, err := trade.NewFromCfg(conf)
orders, hasMore, err := tctx.HistoryOrders(context.Background(), &trade.GetHistoryOrders{
Symbol: "AAPL.US",
Status: []trade.OrderStatus{trade.OrderFilledStatus},
})
func (*TradeContext) MarginRatio ¶
func (c *TradeContext) MarginRatio(ctx context.Context, symbol string) (marginRatio MarginRatio, err error)
MarginRatio is used to obtain the initial margin ratio, maintain the margin ratio and strengthen the margin ratio of stocks. Reference: https://open.longbridge.com/en/docs/trade/asset/margin_ratio Example:
conf, err := config.NewFromEnv() tctx, err := trade.NewFromCfg(conf) mr, err := tctx.MarginRatio(context.Background(), "AAPL.US")
func (*TradeContext) OnTrade ¶
func (c *TradeContext) OnTrade(f func(*PushEvent))
OnQuote set callback function which will be called when server push events. No-op when created via NewHTTPFromCfg (no WS connection).
func (*TradeContext) OrderDetail ¶
func (c *TradeContext) OrderDetail(ctx context.Context, orderId string) (orderDetail OrderDetail, err error)
OrderDetail is used for order detail query Reference: https://open.longbridge.com/en/docs/trade/order/order_detail Example:
conf, err := config.NewFromEnv() tctx, err := trade.NewFromCfg(conf) od, err := tctx.OrderDetail(context.Background(), "1123123123")
func (*TradeContext) QueryUSOrders ¶ added in v0.26.0
func (c *TradeContext) QueryUSOrders(ctx context.Context, req *GetUSHistoryOrders) (*QueryUSOrdersResponse, error)
QueryUSOrders queries the US order list.
Path: POST /v1/us/orders/query US token required; returns *http.RegionRestrictedError for non-US credentials.
func (*TradeContext) ReplaceOrder ¶
func (c *TradeContext) ReplaceOrder(ctx context.Context, params *ReplaceOrder) (err error)
ReplaceOrder modify quantity or price Reference: https://open.longbridge.com/en/docs/trade/order/replace
Example:
conf, err := config.NewFromEnv()
tctx, err := trade.NewFromCfg(conf)
err := tctx.ReplaceOrder(context.Background(), &trade.ReplaceOrder{OrderId: "123123", Quantity: 2, Remark: "just replace the order"})
func (*TradeContext) StockPositions ¶
func (c *TradeContext) StockPositions(ctx context.Context, symbols []string) (stockPositionChannels []*StockPositionChannel, err error)
StockPositions to obtain stock position information including account, stock code, number of shares held, number of available shares, average position price (calculated according to account settings), and currency. Reference: https://open.longbridge.com/en/docs/trade/asset/stock Example:
conf, err := config.NewFromEnv()
tctx, err := trade.NewFromCfg(conf)
channels, err := tctx.StockPositions(context.Background(), []string{"AAPL.US"})
func (*TradeContext) SubmitOrder ¶
func (c *TradeContext) SubmitOrder(ctx context.Context, params *SubmitOrder) (orderId string, err error)
func (*TradeContext) Subscribe ¶
func (c *TradeContext) Subscribe(ctx context.Context, topics []string) (subRes *SubResponse, err error)
Subscribe topics then the handler will receive push event. Reference: https://open.longbridge.com/en/docs/trade/trade-push#subscribe Returns an error when created via NewHTTPFromCfg (no WS connection).
func (*TradeContext) TodayExecutions ¶
func (c *TradeContext) TodayExecutions(ctx context.Context, params *GetTodayExecutions) (trades []*Execution, err error)
TodayExecutions will return today's executions Reference: https://open.longbridge.com/en/docs/trade/execution/today_executions Example:
conf, err := config.NewFromEnv()
tctx, err := trade.NewFromCfg(conf)
trades, err := tctx.TodayExecutions(context.Background(), &trade.GetTodayExecutions{Symbol: "AAPL.US"})
func (*TradeContext) TodayOrders ¶
func (c *TradeContext) TodayOrders(ctx context.Context, params *GetTodayOrders) (orders []*Order, err error)
TodayOrders will return today orders Reference: https://open.longbridge.com/en/docs/trade/order/today_orders
Example:
conf, err := config.NewFromEnv()
tctx, err := trade.NewFromCfg(conf)
orders, err := tctx.TodayOrders(context.Background(), &trade.GetTodayOrders{Symbol: "AAPL.US"})
func (*TradeContext) USAssetOverview ¶ added in v0.26.0
func (c *TradeContext) USAssetOverview(ctx context.Context) (*USAssetOverview, error)
USAssetOverview returns the full US account asset snapshot, including stock, option, multi-leg, and crypto positions together with purchasing power.
counter_id fields in crypto positions are converted to user-facing symbols. asset_timestamp is converted from Unix seconds to time.Time.
Path: GET /v1/us/assets/overview US token required; returns *http.RegionRestrictedError for non-US credentials.
func (*TradeContext) USOrderDetail ¶ added in v0.26.0
func (c *TradeContext) USOrderDetail(ctx context.Context, orderID string) (*USOrderDetailResponse, error)
USOrderDetail returns the detail for a single US order.
Path: GET /v1/us/orders/{order_id} US token required; returns *http.RegionRestrictedError for non-US credentials.
func (*TradeContext) USRealizedPL ¶ added in v0.26.0
func (c *TradeContext) USRealizedPL(ctx context.Context, req *GetUSRealizedPL) (*USRealizedPLResponse, error)
USRealizedPL returns realized profit-and-loss for the US account.
Path: GET /v1/us/assets/pl/realized US token required; returns *http.RegionRestrictedError for non-US credentials.
func (*TradeContext) Unsubscribe ¶
func (c *TradeContext) Unsubscribe(ctx context.Context, topics []string) (unsubRes *UnsubResponse, err error)
Unsubscribe topics then the handler will not receive the symbol's event. Reference: https://open.longbridge.com/en/docs/trade/trade-push#cancel-subscribe Returns an error when created via NewHTTPFromCfg (no WS connection).
func (*TradeContext) WithdrawOrder ¶
func (c *TradeContext) WithdrawOrder(ctx context.Context, orderId string) (err error)
WithdrawOrder to close an open order. It is same as CancelOrder function. Reference: https://open.longbridge.com/en/docs/trade/order/withdraw Example:
conf, err := config.NewFromEnv() tctx, err := trade.NewFromCfg(conf) err = tctx.WithdrawOrder(context.Background(), "12123123")
type TriggerPriceType ¶ added in v0.24.0
type TriggerPriceType string
type TriggerStatus ¶
type TriggerStatus string
type USAssetOverview ¶ added in v0.26.0
type USAssetOverview struct {
AccountType string `json:"account_type"`
AssetTimestamp time.Time `json:"-"`
CashBuyPower string `json:"cash_buy_power"`
OvernightBuyPower string `json:"overnight_buy_power"`
Currency string `json:"currency"`
CashList []USCashEntry `json:"cash_list"`
StockList []USStockEntry `json:"stock_list"`
OptionList []interface{} `json:"option_list"`
CryptoList []USCryptoEntry `json:"crypto_list"`
MultiLeg interface{} `json:"multi_leg"`
}
USAssetOverview is the US account asset snapshot.
type USAttachedOrder ¶ added in v0.26.0
type USAttachedOrder struct {
AttachedTypeDisplay int32 `json:"attached_type_display"`
ExecutedQty string `json:"executed_qty"`
Quantity string `json:"quantity"`
Status string `json:"status"`
TriggerPrice string `json:"trigger_price"`
OrderID string `json:"order_id"`
GTD string `json:"gtd"`
TimeInForce int32 `json:"time_in_force"`
Tag int32 `json:"tag"`
ActivateOrderType string `json:"activate_order_type"`
ActivateRTH int32 `json:"activate_rth"`
SubmitPrice string `json:"submit_price"`
// Symbol is the user-facing trading symbol (e.g. "NKE.US"), converted from CounterID.
Symbol string `json:"-"`
CounterID string `json:"counter_id"`
Withdrawn bool `json:"withdrawn"`
}
USAttachedOrder is one bracket/conditional order attached to the main order.
type USButtonControl ¶ added in v0.26.0
type USButtonControl struct {
Withdraw int32 `json:"withdraw"`
Replace int32 `json:"replace"`
Exceptionable []string `json:"exceptionable"`
}
USButtonControl holds the action-button state for an order.
type USCashEntry ¶ added in v0.26.0
type USCashEntry struct {
Currency string `json:"currency"`
FrozenBuyCash string `json:"frozen_buy_cash"`
Outstanding string `json:"outstanding"`
SettledCash string `json:"settled_cash"`
TotalAmount string `json:"total_amount"`
TotalCash string `json:"total_cash"`
}
USCashEntry is one currency cash entry in USAssetOverview.
type USChargeDetail ¶ added in v0.26.0
type USChargeDetail struct {
Currency string `json:"currency"`
TotalAmount string `json:"total_amount"`
Items []USChargeItem `json:"items"`
}
USChargeDetail holds the fee breakdown for an order.
type USChargeItem ¶ added in v0.26.0
type USChargeItem struct {
Code int32 `json:"code"`
Name string `json:"name"`
Fees []string `json:"fees"`
}
USChargeItem is one fee category within USChargeDetail.
type USCryptoEntry ¶ added in v0.26.0
type USCryptoEntry struct {
AssetType string `json:"asset_type"`
AverageCost string `json:"average_cost"`
// Symbol is the user-facing trading-pair symbol (e.g. "BTCUSD.BKKT"),
// converted from the API's counter_id field (e.g. "VA/BKKT/BTCUSD").
Symbol string `json:"symbol"`
Currency string `json:"currency"`
IndustryName string `json:"industry_name"`
}
USCryptoEntry is one cryptocurrency holding in USAssetOverview.
type USOrder ¶ added in v0.26.0
type USOrder struct {
// OrderID is the unique order identifier (field "id" in raw response).
// Use this with USOrderDetail.
OrderID string `json:"id"`
AAID string `json:"aaid"`
AccountChannel string `json:"account_channel"`
// Action: 1=buy, 2=sell
Action int32 `json:"action"`
// Symbol is converted from counter_id (e.g. "VA/BKKT/DOGEUSD" → "DOGEUSD.BKKT")
Symbol string `json:"symbol"`
// UnderlyingSymbol is converted from underlying_counter_id (options only)
UnderlyingSymbol string `json:"underlying_symbol"`
Code string `json:"code"`
Name string `json:"name"`
SecurityType string `json:"security_type"`
Currency string `json:"currency"`
TradeCurrency string `json:"trade_currency"`
OrderType string `json:"order_type"`
Status string `json:"status"`
Price string `json:"price"`
Quantity string `json:"quantity"`
ExecutedQty string `json:"executed_qty"`
ExecutedPrice string `json:"executed_price"`
ExecutedAmount string `json:"executed_amount"`
OperateDirection string `json:"operate_direction"`
TimeInForce int32 `json:"time_in_force"`
GTD string `json:"gtd"`
SubmittedAt time.Time `json:"submitted_at"`
UpdatedAt time.Time `json:"updated_at"`
Msg string `json:"msg"`
Report string `json:"report"`
// Options-specific fields
ContractDirection string `json:"contract_direction"`
ContractDueDate string `json:"contract_due_date"`
StrikePrice string `json:"strike_price"`
// Trailing stop fields
TailingAmount string `json:"tailing_amount"`
TailingPercent string `json:"tailing_percent"`
// Trigger / conditional order fields
TriggerPrice string `json:"trigger_price"`
TriggerStatus int32 `json:"trigger_status"`
TriggerAt string `json:"trigger_at"`
TriggerExchange string `json:"trigger_exchange"`
TriggerLastDone string `json:"trigger_last_done"`
TriggerCount int32 `json:"trigger_count"`
// Other
LotSize string `json:"lot_size"`
LimitOffset string `json:"limit_offset"`
LimitDepthLevel int32 `json:"limit_depth_level"`
MarketPrice string `json:"market_price"`
LastDone string `json:"last_done"`
MonitorPrice string `json:"monitor_price"`
SubmittedAmount string `json:"submitted_amount"`
PlatformDeductionsStatus int32 `json:"platform_deductions_status"`
PloyID string `json:"ploy_id"`
PloyType string `json:"ploy_type"`
TickerSize string `json:"ticker_size"`
CurrentMillisecond string `json:"current_millisecond"`
OrgID string `json:"org_id"`
Tag int32 `json:"tag"`
ForceOnlyRTH int32 `json:"force_only_rth"`
DeductionsStatus int32 `json:"deductions_status"`
FreeStatus int32 `json:"free_status"`
Trend int32 `json:"trend"`
}
USOrder is one order entry in QueryUSOrdersResponse. counter_id fields are converted to user-facing symbol format.
type USOrderDetail ¶ added in v0.26.0
type USOrderDetail struct {
ID string `json:"id"`
AAID string `json:"aaid"`
AccountChannel string `json:"account_channel"`
Action int32 `json:"action"`
// Symbol is the user-facing trading symbol (e.g. "NKE.US"), converted from CounterID.
Symbol string `json:"-"`
// UnderlyingSymbol is the user-facing underlying symbol (options only), converted from UnderlyingCounterID.
UnderlyingSymbol string `json:"-"`
CounterID string `json:"counter_id"`
UnderlyingCounterID string `json:"underlying_counter_id"`
SecurityType string `json:"security_type"`
Name string `json:"name"`
Currency string `json:"currency"`
TradeCurrency string `json:"trade_currency"`
OrderType string `json:"order_type"`
Status string `json:"status"`
Price string `json:"price"`
Quantity string `json:"quantity"`
ExecutedQty string `json:"executed_qty"`
ExecutedPrice string `json:"executed_price"`
ExecutedAmount string `json:"executed_amount"`
OperateDirection string `json:"operate_direction"`
TimeInForce int32 `json:"time_in_force"`
GTD string `json:"gtd"`
Tag int32 `json:"tag"`
Msg string `json:"msg"`
ForceOnlyRTH int32 `json:"force_only_rth"`
SubmittedAt string `json:"submitted_at"` // unix seconds string
DoneAt string `json:"done_at"` // unix seconds string
TriggerPrice string `json:"trigger_price"`
TriggerAt string `json:"trigger_at"`
TriggerStatus int32 `json:"trigger_status"`
TriggerExchange string `json:"trigger_exchange"`
TriggerLastDone string `json:"trigger_last_done"`
TriggerCount int32 `json:"trigger_count"`
TailingAmount string `json:"tailing_amount"`
TailingPercent string `json:"tailing_percent"`
LimitOffset string `json:"limit_offset"`
LimitDepthLevel int32 `json:"limit_depth_level"`
MarketPrice string `json:"market_price"`
SubmittedAmount string `json:"submitted_amount"`
EstimatedFee string `json:"estimated_fee"`
FreeStatus int32 `json:"free_status"`
FreeAmount string `json:"free_amount"`
FreeCurrency string `json:"free_currency"`
DeductionsStatus int32 `json:"deductions_status"`
DeductionsAmount string `json:"deductions_amount"`
DeductionsCurrency string `json:"deductions_currency"`
PlatformDeductionsStatus int32 `json:"platform_deductions_status"`
PlatformDeductionsAmount string `json:"platform_deductions_amount"`
PlatformDeductionsCurrency string `json:"platform_deductions_currency"`
DisplayAccount string `json:"display_account"`
SettlementAccount string `json:"settlement_account"`
SettlementChannel string `json:"settlement_channel"`
CustomerName string `json:"customer_name"`
RealName string `json:"real_name"`
EnName string `json:"en_name"`
JointRealName string `json:"joint_real_name"`
JointEnName string `json:"joint_en_name"`
OrgID string `json:"org_id"`
BCAN string `json:"bcan"`
OpEntrustWay int32 `json:"op_entrust_way"`
OpEntrustWayName string `json:"op_entrust_way_name"`
Remark string `json:"remark"`
Notice string `json:"notice"`
ShortSellType int32 `json:"short_sell_type"`
PloyType string `json:"ploy_type"` // API returns string e.g. "0"
PloyID string `json:"ploy_id"`
PloyStatus string `json:"ploy_status"`
Trend int32 `json:"trend"`
WithdrawalReason string `json:"withdrawal_reason"`
ActivateOrderType string `json:"activate_order_type"`
ActivateRTH int32 `json:"activate_rth"`
SubmitPrice string `json:"submit_price"`
ContractDirection string `json:"contract_direction"`
StrikePrice string `json:"strike_price"`
ContractSize string `json:"contract_size"`
MonitorPrice string `json:"monitor_price"`
ButtonControl USButtonControl `json:"button_control"`
ChargeDetail *USChargeDetail `json:"charge_detail"`
AttachedOrders []USAttachedOrder `json:"attached_orders"`
OrderHistories []USOrderHistory `json:"order_histories"`
}
USOrderDetail is the full typed order object within USOrderDetailResponse. submitted_at and done_at are raw unix-second strings (not converted to time.Time, since this struct is also reused for CurrentAttachedOrder which may vary).
func (*USOrderDetail) UnmarshalJSON ¶ added in v0.26.0
func (o *USOrderDetail) UnmarshalJSON(b []byte) error
UnmarshalJSON converts counter_id / underlying_counter_id fields to user-facing Symbol / UnderlyingSymbol after standard JSON deserialization.
type USOrderDetailResponse ¶ added in v0.26.0
type USOrderDetailResponse struct {
Order *USOrderDetail `json:"order"`
CurrentAttachedOrder *USOrderDetail `json:"current_attached_order"`
CurrentMillisecond string `json:"current_millisecond"`
}
USOrderDetailResponse is the response for USOrderDetail. CurrentAttachedOrder is the active bracket/conditional sub-order, or nil. CurrentMillisecond is the server timestamp at response time.
type USOrderHistory ¶ added in v0.26.0
type USOrderHistory struct {
Price string `json:"price"`
Qty string `json:"qty"`
Status string `json:"status"`
Msg string `json:"msg"`
Time string `json:"time"` // unix seconds as string
IsManually bool `json:"is_manually"`
ExecType int32 `json:"exec_type"`
OppPartyID string `json:"opp_party_id"`
TrdMatchID string `json:"trd_match_id"`
Operator string `json:"operator"`
OpEntrustWay string `json:"op_entrust_way"`
CxlRejResponseTo int32 `json:"cxl_rej_response_to"`
WithdrawalReason string `json:"withdrawal_reason"`
OppName string `json:"opp_name"`
ExecID string `json:"exec_id"`
}
USOrderHistory is one state-transition entry within USOrderDetail.OrderHistories.
type USRealizedPLEntry ¶ added in v0.26.0
type USRealizedPLEntry struct {
Category int32 `json:"category"`
Currency string `json:"currency"`
Metrics []USRealizedPLMetric `json:"metrics"`
}
USRealizedPLEntry is one asset-category entry in USRealizedPLResponse. Category values: 0=all, 1=stock, 2=option, 3=crypto.
type USRealizedPLMetric ¶ added in v0.26.0
type USRealizedPLMetric struct {
Amount string `json:"amount"`
Period int32 `json:"period"`
Rate string `json:"rate"`
}
USRealizedPLMetric is one time-period metric within a USRealizedPLEntry.
type USRealizedPLResponse ¶ added in v0.26.0
type USRealizedPLResponse struct {
RealizedPLList []USRealizedPLEntry `json:"realized_pl_list"`
}
USRealizedPLResponse is the response for GET /v1/us/assets/pl/realized.
type USStockEntry ¶ added in v0.26.0
type USStockEntry struct {
// Symbol is the ticker code returned by the API (e.g. "AAPL"). See FullSymbol for the qualified form.
Symbol string `json:"symbol"`
// FullSymbol is the user-facing qualified symbol (e.g. "AAPL.US"), converted from CounterID.
FullSymbol string `json:"-"`
AssetType string `json:"asset_type"`
Quantity string `json:"quantity"`
Currency string `json:"currency"`
AverageCost string `json:"average_cost"`
Market string `json:"market"`
CounterID string `json:"counter_id"`
TradeStatus string `json:"trade_status"`
PrevClose string `json:"prev_close"`
LastDone string `json:"last_done"`
MarketPrice string `json:"market_price"`
PretradeClose string `json:"pretrade_close"`
StockInvestOfToday string `json:"stock_invest_of_today"`
TodayPL string `json:"today_pl"`
PretradeStockInvestOfToday string `json:"pretrade_stock_invest_of_today"`
PretradeTodayPL string `json:"pretrade_today_pl"`
NightLastDone string `json:"night_last_done"`
NightPrevClose string `json:"night_prev_close"`
PositionSide string `json:"position_side"`
OpenPositionTime string `json:"open_position_time"`
Name string `json:"name"`
IndustryCounterID string `json:"industry_counter_id"`
IndustryName string `json:"industry_name"`
}
USStockEntry is one stock/equity position in USAssetOverview.
type UnsubResponse ¶
type UnsubResponse struct {
Current []string
}