Documentation
¶
Index ¶
- type Adapter
- func (a *Adapter) Authenticate(ctx context.Context, creds broker.Credentials) (*broker.Token, error)
- func (a *Adapter) BuildOverseasTradeSubscriptions(ctx context.Context, market string, maxRows int) ([]ls.RealtimeSubscription, error)
- func (a *Adapter) BuildTradeSubscriptions(ctx context.Context) ([]ls.RealtimeSubscription, error)
- func (a *Adapter) CallEndpoint(ctx context.Context, method, path, trCD string, request any) (any, error)
- func (a *Adapter) CallEndpointPage(ctx context.Context, method, path, trCD string, request any, ...) (*ls.EndpointPage, error)
- func (a *Adapter) CancelOrder(ctx context.Context, orderID string) error
- func (a *Adapter) Client() *ls.Client
- func (a *Adapter) ConnectRealtime(ctx context.Context) (*ls.RealtimeConn, error)
- func (a *Adapter) GetBalance(ctx context.Context, accountID string) (*broker.Balance, error)
- func (a *Adapter) GetInstrument(ctx context.Context, market, symbol string) (*broker.Instrument, error)
- func (a *Adapter) GetOHLCV(ctx context.Context, market, symbol string, opts broker.OHLCVOpts) ([]broker.OHLCV, error)
- func (a *Adapter) GetOrder(ctx context.Context, orderID string) (*broker.OrderResult, error)
- func (a *Adapter) GetOrderFills(ctx context.Context, orderID string) ([]broker.OrderFill, error)
- func (a *Adapter) GetPositions(ctx context.Context, _ string) ([]broker.Position, error)
- func (a *Adapter) GetQuote(ctx context.Context, market, symbol string) (*broker.Quote, error)
- func (a *Adapter) ModifyOrder(ctx context.Context, orderID string, req broker.ModifyOrderRequest) (*broker.OrderResult, error)
- func (a *Adapter) Name() string
- func (a *Adapter) PlaceOrder(ctx context.Context, req broker.OrderRequest) (*broker.OrderResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter adapts LS Securities OpenAPI into broker.Broker.
func NewAdapterWithOptions ¶
func NewAdapterWithOptions( sandbox bool, accountID string, tokenManager tokencache.Manager, macAddress string, logger *slog.Logger, orderContextDir ...string, ) *Adapter
NewAdapterWithOptions creates an LS adapter with injectable internals.
func (*Adapter) Authenticate ¶
func (a *Adapter) Authenticate(ctx context.Context, creds broker.Credentials) (*broker.Token, error)
Authenticate authenticates with LS.
func (*Adapter) BuildOverseasTradeSubscriptions ¶
func (a *Adapter) BuildOverseasTradeSubscriptions(ctx context.Context, market string, maxRows int) ([]ls.RealtimeSubscription, error)
BuildOverseasTradeSubscriptions returns overseas trade subscriptions from LS overseas stock master.
func (*Adapter) BuildTradeSubscriptions ¶
BuildTradeSubscriptions returns KOSPI/KOSDAQ trade subscriptions from LS stock master.
func (*Adapter) CallEndpoint ¶
func (a *Adapter) CallEndpoint(ctx context.Context, method, path, trCD string, request any) (any, error)
CallEndpoint executes a documented LS REST endpoint by path and tr_cd.
func (*Adapter) CallEndpointPage ¶ added in v0.28.0
func (a *Adapter) CallEndpointPage(ctx context.Context, method, path, trCD string, request any, continuation ls.Continuation) (*ls.EndpointPage, error)
CallEndpointPage executes one documented REST page and returns continuation headers.
func (*Adapter) CancelOrder ¶
CancelOrder cancels the currently unfilled quantity of a tracked same-day order.
func (*Adapter) ConnectRealtime ¶
ConnectRealtime opens an LS realtime WebSocket connection.
func (*Adapter) GetBalance ¶
GetBalance retrieves LS stock account balance summary.
func (*Adapter) GetInstrument ¶
func (a *Adapter) GetInstrument(ctx context.Context, market, symbol string) (*broker.Instrument, error)
GetInstrument returns stock master metadata.
func (*Adapter) GetOHLCV ¶
func (a *Adapter) GetOHLCV(ctx context.Context, market, symbol string, opts broker.OHLCVOpts) ([]broker.OHLCV, error)
GetOHLCV retrieves daily/weekly/monthly candles.
func (*Adapter) GetOrder ¶
GetOrder reads a tracked same-day order. It does not infer fill average prices from the t0425 field named execution price; exact executions are available via GetOrderFills.
func (*Adapter) GetOrderFills ¶
GetOrderFills returns exact reported executions for a tracked same-day order.
func (*Adapter) GetPositions ¶
GetPositions retrieves LS account positions.
func (*Adapter) ModifyOrder ¶
func (a *Adapter) ModifyOrder(ctx context.Context, orderID string, req broker.ModifyOrderRequest) (*broker.OrderResult, error)
ModifyOrder modifies the remaining quantity of a tracked same-day order.
func (*Adapter) PlaceOrder ¶
func (a *Adapter) PlaceOrder(ctx context.Context, req broker.OrderRequest) (*broker.OrderResult, error)
PlaceOrder places a regular cash stock order.