bitmexsim

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderSizeLimit = 10000000 // Order size limit
)

Variables

This section is empty.

Functions

func CalcPnl

func CalcPnl(side crex.Direction, positionSize float64, entryPrice float64, exitPrice float64) (pnl float64, pnlUsd float64)

计算收益 pnl: 收益(BTC/ETH) pnlUsd: 收益(USD)

Types

type BitMEXSim

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

BitMEXSim the BitMEX exchange for backtest

func NewBitMEXSim

func NewBitMEXSim(data *data.Data, cash float64, makerFeeRate float64, takerFeeRate float64) *BitMEXSim

func (*BitMEXSim) AmendOrder

func (b *BitMEXSim) AmendOrder(symbol string, id string, price float64, size float64) (result Order, err error)

func (*BitMEXSim) CancelAllOrders

func (b *BitMEXSim) CancelAllOrders(symbol string) (err error)

func (*BitMEXSim) CancelOrder

func (b *BitMEXSim) CancelOrder(symbol string, id string) (result Order, err error)

func (*BitMEXSim) CloseLong added in v1.1.3

func (b *BitMEXSim) CloseLong(symbol string, orderType OrderType, price float64, size float64) (result Order, err error)

func (*BitMEXSim) CloseShort added in v1.1.3

func (b *BitMEXSim) CloseShort(symbol string, orderType OrderType, price float64, size float64) (result Order, err error)

func (*BitMEXSim) GetBalance

func (b *BitMEXSim) GetBalance(currency string) (result Balance, err error)

func (*BitMEXSim) GetContractID

func (b *BitMEXSim) GetContractID() (symbol string, err error)

func (*BitMEXSim) GetName

func (b *BitMEXSim) GetName() (name string)

func (*BitMEXSim) GetOpenOrders

func (b *BitMEXSim) GetOpenOrders(symbol string) (result []Order, err error)

func (*BitMEXSim) GetOrder

func (b *BitMEXSim) GetOrder(symbol string, id string) (result Order, err error)

func (*BitMEXSim) GetOrderBook

func (b *BitMEXSim) GetOrderBook(symbol string, depth int) (result OrderBook, err error)

func (*BitMEXSim) GetPositions

func (b *BitMEXSim) GetPositions(symbol string) (result []Position, err error)

func (*BitMEXSim) GetRecords

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

func (*BitMEXSim) OpenLong added in v1.1.3

func (b *BitMEXSim) OpenLong(symbol string, orderType OrderType, price float64, size float64) (result Order, err error)

func (*BitMEXSim) OpenShort added in v1.1.3

func (b *BitMEXSim) OpenShort(symbol string, orderType OrderType, price float64, size float64) (result Order, err error)

func (*BitMEXSim) PlaceOrder

func (b *BitMEXSim) PlaceOrder(symbol string, direction Direction, orderType OrderType, price float64,
	size float64, opts ...OrderOption) (result Order, err error)

func (*BitMEXSim) RunEventLoopOnce

func (b *BitMEXSim) RunEventLoopOnce() (err error)

func (*BitMEXSim) SetContractType

func (b *BitMEXSim) SetContractType(currencyPair string, contractType string) (err error)

func (*BitMEXSim) SetLeverRate

func (b *BitMEXSim) SetLeverRate(value float64) (err error)

func (*BitMEXSim) SubscribeLevel2Snapshots

func (b *BitMEXSim) SubscribeLevel2Snapshots(market Market, callback func(ob *OrderBook)) error

func (*BitMEXSim) SubscribeOrders

func (b *BitMEXSim) SubscribeOrders(market Market, callback func(orders []Order)) error

func (*BitMEXSim) SubscribePositions

func (b *BitMEXSim) SubscribePositions(market Market, callback func(positions []Position)) error

func (*BitMEXSim) SubscribeTrades

func (b *BitMEXSim) SubscribeTrades(market Market, callback func(trades []Trade)) error

type MarginInfo

type MarginInfo struct {
	Leverage              float64
	MaintMargin           float64
	LiquidationPriceLong  float64
	LiquidationPriceShort float64
}

Jump to

Keyboard shortcuts

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