spreadparasite

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OrderPlacer

type OrderPlacer interface {
	SubscribeForOrderBookChanges(ctx context.Context, reqs []tinkoffinvest.OrderBookRequest) (<-chan tinkoffinvest.OrderBookChange, error) //nolint:lll
	GetTradeAvailableShares(ctx context.Context) ([]tinkoffinvest.Instrument, error)
	GetOrderBook(ctx context.Context, req tinkoffinvest.OrderBookRequest) (*tinkoffinvest.OrderBookResponse, error)

	GetOrderState(ctx context.Context, _ tinkoffinvest.AccountID, _ tinkoffinvest.OrderID) (decimal.Decimal, error)
	CancelOrder(ctx context.Context, accountID tinkoffinvest.AccountID, orderID tinkoffinvest.OrderID) error

	PlaceLimitSellOrder(ctx context.Context, request tinkoffinvest.PlaceOrderRequest) (tinkoffinvest.OrderID, error)
	PlaceLimitBuyOrder(ctx context.Context, request tinkoffinvest.PlaceOrderRequest) (tinkoffinvest.OrderID, error)
}

type Strategy

type Strategy struct {
	// contains filtered or unexported fields
}

Strategy consists in placing two counter orders at the spread border with their further adjustment.

func New

func New(
	account tinkoffinvest.AccountID,
	ignoreInconsistent bool,
	minSpreadPercentage float64,
	figis []tinkoffinvest.FIGI,
	orderPlacer OrderPlacer,
	toolsCache ToolsCache,
) (*Strategy, error)

func (*Strategy) Apply

func (*Strategy) Name

func (s *Strategy) Name() string

func (*Strategy) Run

func (s *Strategy) Run(ctx context.Context) error

type ToolsCache

type ToolsCache interface {
	Get(ctx context.Context, figi tinkoffinvest.FIGI) (toolscache.Tool, error)
}

Directories

Path Synopsis
Package spreadparasitemocks is a generated GoMock package.
Package spreadparasitemocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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