spotsim

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SpotSim

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

func New

func New(name string, data *dataloader.Data, initBalance SpotBalance, makerFeeRate float64, takerFeeRate float64) *SpotSim

func (*SpotSim) Buy

func (s *SpotSim) Buy(symbol string, orderType OrderType, price float64, size float64) (result *Order, err error)

func (*SpotSim) CancelAllOrders

func (s *SpotSim) CancelAllOrders(symbol string, opts ...OrderOption) (err error)

撤销全部委托单

func (*SpotSim) CancelOrder

func (s *SpotSim) CancelOrder(symbol string, id string, opts ...OrderOption) (result *Order, err error)

撤销单个委托单

func (*SpotSim) GetBalance

func (s *SpotSim) GetBalance(currency string) (result *SpotBalance, err error)

获取账号余额

func (*SpotSim) GetHistoryOrders

func (s *SpotSim) GetHistoryOrders(symbol string, opts ...OrderOption) (result []*Order, err error)

获取历史委托列表

func (*SpotSim) GetName

func (s *SpotSim) GetName() (name string)

获取 Exchange 名称

func (*SpotSim) GetOpenOrders

func (s *SpotSim) GetOpenOrders(symbol string, opts ...OrderOption) (result []*Order, err error)

获取活跃委托单列表

func (*SpotSim) GetOrder

func (s *SpotSim) GetOrder(symbol string, id string, opts ...OrderOption) (result *Order, err error)

获取委托信息

func (*SpotSim) GetOrderBook

func (s *SpotSim) GetOrderBook(symbol string, depth int) (result *OrderBook, err error)

获取订单薄(OrderBook)

func (*SpotSim) GetRecords

func (s *SpotSim) GetRecords(symbol string, period string, from int64, end int64, limit int) (records []*Record, err error)

获取K线数据 period: 数据周期. 分钟或者关键字1m(minute) 1h 1d 1w 1M(month) 1y 枚举值:1 3 5 15 30 60 120 240 360 720 "5m" "4h" "1d" ...

func (*SpotSim) GetTime

func (s *SpotSim) GetTime() (tm int64, err error)

获取交易所时间(ms)

func (*SpotSim) IO

func (s *SpotSim) IO(name string, params string) (string, error)

func (*SpotSim) PlaceOrder

func (s *SpotSim) PlaceOrder(symbol string, direction Direction, orderType OrderType, price float64, size float64,
	opts ...PlaceOrderOption) (result *Order, err error)

下单

func (*SpotSim) RunEventLoopOnce

func (s *SpotSim) RunEventLoopOnce() (err error)

func (*SpotSim) Sell

func (s *SpotSim) Sell(symbol string, orderType OrderType, price float64, size float64) (result *Order, err error)

func (*SpotSim) SetBacktest

func (s *SpotSim) SetBacktest(backtest IBacktest)

func (*SpotSim) SetExchangeLogger

func (s *SpotSim) SetExchangeLogger(l ExchangeLogger)

Jump to

Keyboard shortcuts

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