Documentation
¶
Index ¶
- type Adapter
- func (a *Adapter) Authenticate(ctx context.Context, creds broker.Credentials) (*broker.Token, error)
- func (a *Adapter) CallEndpoint(ctx context.Context, method string, path string, apiID string, ...) (map[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, _ 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)
- type Options
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 Kiwoom APIs into broker.Broker.
func NewAdapterWithOptions ¶
NewAdapterWithOptions creates a Kiwoom adapter with injectable internals.
func (*Adapter) Authenticate ¶
func (a *Adapter) Authenticate(ctx context.Context, creds broker.Credentials) (*broker.Token, error)
Authenticate authenticates with Kiwoom.
func (*Adapter) CallEndpoint ¶ added in v0.6.0
func (a *Adapter) CallEndpoint( ctx context.Context, method string, path string, apiID string, fields map[string]string, ) (map[string]interface{}, error)
CallEndpoint dispatches a Kiwoom endpoint path/api_id to implemented client methods.
func (*Adapter) CancelOrder ¶
CancelOrder cancels a pending order.
func (*Adapter) GetBalance ¶
GetBalance retrieves account balance summary.
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 domestic OHLCV for day/week/month intervals.
func (*Adapter) GetOrderFills ¶
GetOrderFills returns fills for the order.
func (*Adapter) GetPositions ¶
GetPositions retrieves account stock positions.
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 buy/sell stock orders.
type Options ¶
type Options struct {
TokenManager kiwoom.TokenManager
OrderContextDir string
}
Options configures adapter internals.