Documentation
¶
Index ¶
- type Adapter
- func (a *Adapter) Authenticate(ctx context.Context, creds broker.Credentials) (*broker.Token, error)
- func (a *Adapter) BootstrapSymbols(ctx context.Context) (int, error)
- func (a *Adapter) CallEndpoint(ctx context.Context, method string, path string, trID string, ...) (interface{}, error)
- func (a *Adapter) CancelOrder(ctx context.Context, orderID string) 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, accountID 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)
- func (a *Adapter) ReloadSymbols(ctx context.Context) (int, 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 KIS raw API to broker.Broker interface
func NewAdapterWithOptions ¶
func NewAdapterWithOptions( sandbox bool, accountID string, tokenManager tokencache.Manager, orderContextDir string, logger *slog.Logger, ) *Adapter
NewAdapterWithOptions creates a new KIS adapter with injectable dependencies.
func (*Adapter) Authenticate ¶
func (a *Adapter) Authenticate(ctx context.Context, creds broker.Credentials) (*broker.Token, error)
Authenticate authenticates with the broker
func (*Adapter) BootstrapSymbols ¶
BootstrapSymbols loads KIS master symbol files into memory for fast lookups.
func (*Adapter) CallEndpoint ¶ added in v0.6.0
func (a *Adapter) CallEndpoint( ctx context.Context, method string, path string, trID string, request interface{}, ) (interface{}, error)
CallEndpoint dispatches a KIS endpoint path to documented endpoint specs.
func (*Adapter) CancelOrder ¶
CancelOrder cancels an order
func (*Adapter) GetBalance ¶
GetBalance retrieves account balance
func (*Adapter) GetInstrument ¶
func (a *Adapter) GetInstrument(ctx context.Context, market, symbol string) (*broker.Instrument, error)
GetInstrument retrieves normalized instrument metadata.
func (*Adapter) GetOHLCV ¶
func (a *Adapter) GetOHLCV(ctx context.Context, market, symbol string, opts broker.OHLCVOpts) ([]broker.OHLCV, error)
GetOHLCV retrieves OHLCV data for a given market and symbol
func (*Adapter) GetOrderFills ¶
GetOrderFills returns normalized fill executions for an order.
func (*Adapter) GetPositions ¶
GetPositions retrieves account positions (stocks + bonds)
func (*Adapter) GetQuote ¶
GetQuote retrieves a quote for a given market and symbol. For overseas markets, strict documented endpoint dispatch is used.
func (*Adapter) ModifyOrder ¶
func (a *Adapter) ModifyOrder(ctx context.Context, orderID string, req broker.ModifyOrderRequest) (*broker.OrderResult, error)
ModifyOrder modifies an existing order
func (*Adapter) PlaceOrder ¶
func (a *Adapter) PlaceOrder(ctx context.Context, req broker.OrderRequest) (*broker.OrderResult, error)
PlaceOrder places a new order