bitmexsim

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 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 broker for backtest

func New

func New(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) GetAccountSummary

func (b *BitMEXSim) GetAccountSummary(currency string) (result AccountSummary, 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 added in v1.0.0

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) PlaceOrder

func (b *BitMEXSim) PlaceOrder(symbol string, direction Direction, orderType OrderType, price float64,
	stopPx float64, size float64, postOnly bool, reduceOnly bool, params map[string]interface{}) (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) WS added in v1.0.0

func (b *BitMEXSim) WS() (ws WebSocket, err 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