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, path string, query map[string]interface{}, ...) (interface{}, error)
- func (a *Adapter) CancelOrder(ctx context.Context, orderID string) error
- func (a *Adapter) Client() *toss.Client
- func (a *Adapter) GetBalance(ctx context.Context, accountID string) (*broker.Balance, error)
- func (a *Adapter) GetBuyingPower(ctx context.Context, currency string) (toss.BuyingPowerResponse, error)
- func (a *Adapter) GetCommissions(ctx context.Context) ([]toss.Commission, 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) GetOrders(ctx context.Context, query map[string]interface{}) (toss.PaginatedOrderResponse, 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) GetSellableQuantity(ctx context.Context, symbol string) (toss.SellableQuantityResponse, 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 Toss Securities Open API into broker.Broker.
func NewAdapterWithOptions ¶
func NewAdapterWithOptions( sandbox bool, accountID string, accountSeq string, tokenManager tokencache.Manager, logger *slog.Logger, ) *Adapter
NewAdapterWithOptions creates a Toss adapter with injectable internals.
func (*Adapter) Authenticate ¶
func (a *Adapter) Authenticate(ctx context.Context, creds broker.Credentials) (*broker.Token, error)
Authenticate authenticates with Toss.
func (*Adapter) CallEndpoint ¶
func (a *Adapter) CallEndpoint(ctx context.Context, method, path string, query map[string]interface{}, body interface{}) (interface{}, error)
CallEndpoint dispatches a raw Toss Open API endpoint using this adapter's account_seq.
func (*Adapter) CancelOrder ¶
CancelOrder cancels a Toss order.
func (*Adapter) GetBalance ¶
GetBalance retrieves a Toss account balance summary from holdings and buying-power APIs.
func (*Adapter) GetBuyingPower ¶
func (*Adapter) GetCommissions ¶
func (*Adapter) GetInstrument ¶
func (a *Adapter) GetInstrument(ctx context.Context, market, symbol string) (*broker.Instrument, error)
GetInstrument returns Toss stock metadata.
func (*Adapter) GetOHLCV ¶
func (a *Adapter) GetOHLCV(ctx context.Context, market, symbol string, opts broker.OHLCVOpts) ([]broker.OHLCV, error)
GetOHLCV retrieves Toss 1d or 1m candles.
func (*Adapter) GetOrderFills ¶
GetOrderFills returns a normalized aggregate fill for a Toss order.
func (*Adapter) GetPositions ¶
GetPositions retrieves Toss account positions.
func (*Adapter) GetQuote ¶
GetQuote retrieves a normalized stock quote from Toss prices and the latest daily candle.
func (*Adapter) GetSellableQuantity ¶
func (*Adapter) ModifyOrder ¶
func (a *Adapter) ModifyOrder(ctx context.Context, orderID string, req broker.ModifyOrderRequest) (*broker.OrderResult, error)
ModifyOrder modifies a Toss order.
func (*Adapter) PlaceOrder ¶
func (a *Adapter) PlaceOrder(ctx context.Context, req broker.OrderRequest) (*broker.OrderResult, error)
PlaceOrder places a Toss stock order.