tumble

package
v0.1.2 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: 15 Imported by: 0

Documentation

Overview

Package tumble provides a trading strategy based on order book.

All necessary configuration can be provided by environment variables, check out TradeConfig for the exact values to be passed.

The trade-bot tracks the "order book". If there are more lots in the purchase orders than in the lots for sale a certain number of times, then the robot buys the instrument at the market price, otherwise it sells, immediately placing the order in the opposite direction, but with a certain percentage of profit.

IMPORTANT NOTE: Tumble (OrderBook-based) strategy is NOT AVAILABLE IN sandbox. See https://github.com/Tinkoff/investAPI/issues/176 for details.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Order

type Order struct {
	SellFlag        bool           // if true, worker is trying to sell assets
	OrderID         string         // if order is set
	OrderPrice      *pb.MoneyValue // if order is set
	OrderPlacedTime *int64         // if order is set
}

type TradeBot

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

func NewTradeBot

func NewTradeBot() *TradeBot

func (TradeBot) Run

func (tb TradeBot) Run(ctx context.Context) (err error)

type TradeConfig

type TradeConfig struct {
	LotsToBuy int `default:"1" split_words:"true"`

	AsksBidsRatio float64 `default:"1.5" split_words:"true"`
	BidsAsksRatio float64 `default:"1.5" split_words:"true"`

	OrderBookDepth        int `default:"10" split_words:"true"`
	OrderBookFairAskDepth int `default:"5" split_words:"true"`
	OrderBookFairBidDepth int `default:"5" split_words:"true"`
}

func NewTradeConfig

func NewTradeConfig() *TradeConfig

Jump to

Keyboard shortcuts

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