skeleton

package module
v0.0.0-...-d32edd1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

README

bbgo-strategy-infinite-grid (無限網格策略)

參考 https://bensonsun.medium.com/%E7%B5%95%E5%B0%8D%E7%84%A1%E8%85%A6%E7%9A%84%E6%AF%94%E7%89%B9%E5%B9%A3%E6%8A%95%E8%B3%87%E6%96%B9%E6%B3%95-pionex-%E7%84%A1%E9%99%90%E7%B6%B2%E6%A0%BC%E4%BA%A4%E6%98%93-%E6%A5%B5%E9%80%9F%E5%AE%9A%E6%8A%95-d963551d5150

安裝

go get -u github.com/c9s/bbgo/cmd/bbgo
bbgo build --config config/infinite-grid.yaml

設定

exchangeStrategies:
- on: max # 交易所
  infinitegrid:
    symbol: BTCUSDT # 交易對
    quantity: 0.001 # 網格每次掛單交易數量
    initialOrderQuantity: 0.0035 # 初次購買數量 (不可與 quantity 相同)
    gridNumber: 8 # 初始網格數
    countOfMoreOrders: 4 # 跑出初始網格後,新增的網格掛單數量
    budget: 3200 # 預算 (參考用)
    margin: 0.005 # 網格間距 (百分比,0.005 為 0.5%)
    lowerPrice: 13000.0 # 最低掛單價格,低於此價格不買進

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Strategy

type Strategy struct {
	*bbgo.Notifiability

	*bbgo.Graceful

	bbgo.OrderExecutor

	Symbol string `json:"symbol"`

	types.Market

	// Max budget of the strategy
	Budget fixedpoint.Value `json:"budget"`

	LowerPrice fixedpoint.Value `json:"lowerPrice"`

	// Buy-Sell Margin for each pair of orders
	Margin fixedpoint.Value `json:"margin"`

	// Quantity is the quantity you want to submit for each order.
	Quantity fixedpoint.Value `json:"quantity"`

	InitialOrderQuantity fixedpoint.Value `json:"initialOrderQuantity"`
	CountOfMoreOrders    int              `json:"countOfMoreOrders"`

	// GridNum is the grid number, how many orders you want to post on the orderbook.
	GridNum int  `json:"gridNumber"`
	Long    bool `json:"long"`
	// contains filtered or unexported fields
}

func (*Strategy) ID

func (s *Strategy) ID() string

func (*Strategy) Run

func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, session *bbgo.ExchangeSession) error

func (*Strategy) Subscribe

func (s *Strategy) Subscribe(session *bbgo.ExchangeSession)

Jump to

Keyboard shortcuts

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