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 interface{}) (interface{}, error)
- func (a *Adapter) CancelOrder(context.Context, 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(context.Context, string) (*broker.OrderResult, error)
- func (a *Adapter) GetOrderFills(context.Context, 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(context.Context, string, 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, ) *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 interface{}) (interface{}, error)
CallEndpoint executes a documented LS REST endpoint by path and tr_cd.
func (*Adapter) CancelOrder ¶
CancelOrder requires original symbol and quantity, which the common API does not carry yet for LS order cancellation.
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 is not implemented until LS order history is mapped into the common contract.
func (*Adapter) GetOrderFills ¶
GetOrderFills is not implemented until LS fill history is mapped into the common contract.
func (*Adapter) GetPositions ¶
GetPositions retrieves LS account positions.
func (*Adapter) ModifyOrder ¶
func (a *Adapter) ModifyOrder(context.Context, string, broker.ModifyOrderRequest) (*broker.OrderResult, error)
ModifyOrder requires original symbol and order type context, which the common API does not carry yet.
func (*Adapter) PlaceOrder ¶
func (a *Adapter) PlaceOrder(ctx context.Context, req broker.OrderRequest) (*broker.OrderResult, error)
PlaceOrder places a regular cash stock order.