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 WaitForOrderExecution(ctx context.Context, _ tinkoffinvest.AccountID, _ tinkoffinvest.OrderID) (decimal.Decimal, error) PlaceMarketSellOrder(ctx context.Context, request tinkoffinvest.PlaceOrderRequest) (tinkoffinvest.OrderID, error) PlaceMarketBuyOrder(ctx context.Context, request tinkoffinvest.PlaceOrderRequest) (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 realize the next strategy: if there are more lots in buy orders than in sell orders in ToolConfig.DominanceRatio times, then the robot buys the instrument at the market price, otherwise it sells, immediately placing an order in the opposite direction, but with a certain percentage of profit.
func New ¶
func New( account tinkoffinvest.AccountID, ignoreInconsistent bool, tools []ToolConfig, orderPlacer OrderPlacer, toolsCache ToolsCache, ) (*Strategy, error)
func (*Strategy) Apply ¶
func (s *Strategy) Apply(ctx context.Context, change tinkoffinvest.OrderBookChange) error
Apply applies Strategy to the next order book change.
type ToolConfig ¶
type ToolConfig struct { FIGI tinkoffinvest.FIGI Depth int DominanceRatio float64 ProfitPercentage float64 // contains filtered or unexported fields }
type ToolsCache ¶
type ToolsCache interface {
Get(ctx context.Context, figi tinkoffinvest.FIGI) (toolscache.Tool, error)
}
Click to show internal directories.
Click to hide internal directories.