adapter

package
v0.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

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

func (a *Adapter) BootstrapSymbols(ctx context.Context) (int, error)

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

func (a *Adapter) CancelOrder(ctx context.Context, orderID string) error

CancelOrder cancels an order

func (*Adapter) GetBalance

func (a *Adapter) GetBalance(ctx context.Context, accountID string) (*broker.Balance, error)

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) GetOrder

func (a *Adapter) GetOrder(ctx context.Context, orderID string) (*broker.OrderResult, error)

GetOrder returns current order status based on cached/meta information.

func (*Adapter) GetOrderFills

func (a *Adapter) GetOrderFills(ctx context.Context, orderID string) ([]broker.OrderFill, error)

GetOrderFills returns normalized fill executions for an order.

func (*Adapter) GetPositions

func (a *Adapter) GetPositions(ctx context.Context, accountID string) ([]broker.Position, error)

GetPositions retrieves account positions (stocks + bonds)

func (*Adapter) GetQuote

func (a *Adapter) GetQuote(ctx context.Context, market, symbol string) (*broker.Quote, error)

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) Name

func (a *Adapter) Name() string

Name returns the broker name

func (*Adapter) PlaceOrder

func (a *Adapter) PlaceOrder(ctx context.Context, req broker.OrderRequest) (*broker.OrderResult, error)

PlaceOrder places a new order

func (*Adapter) ReloadSymbols

func (a *Adapter) ReloadSymbols(ctx context.Context) (int, error)

ReloadSymbols force-reloads KIS master symbol files.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL