Documentation ¶
Index ¶
- Constants
- func CalcInitialMargin(sizeCurrency float64) float64
- func CalcMaintMargin(sizeCurrency float64) float64
- func CalcPnl(side Direction, positionSize float64, entryPrice float64, exitPrice float64) (pnl float64, pnlUsd float64)
- type DiribitSim
- func (b *DiribitSim) AmendOrder(symbol string, id string, price float64, size float64) (result Order, err error)
- func (b *DiribitSim) CancelAllOrders(symbol string) (err error)
- func (b *DiribitSim) CancelOrder(symbol string, id string) (result Order, err error)
- func (b *DiribitSim) GetAccountSummary(currency string) (result AccountSummary, err error)
- func (b *DiribitSim) GetContractID() (symbol string, err error)
- func (b *DiribitSim) GetName() (name string)
- func (b *DiribitSim) GetOpenOrders(symbol string) (result []Order, err error)
- func (b *DiribitSim) GetOrder(symbol string, id string) (result Order, err error)
- func (b *DiribitSim) GetOrderBook(symbol string, depth int) (result OrderBook, err error)
- func (b *DiribitSim) GetPosition(symbol string) (result Position, err error)
- func (b *DiribitSim) GetRecords(symbol string, period string, from int64, end int64, limit int) (records []Record, err error)
- func (b *DiribitSim) PlaceOrder(symbol string, direction Direction, orderType OrderType, price float64, ...) (result Order, err error)
- func (b *DiribitSim) RunEventLoopOnce() (err error)
- func (b *DiribitSim) SetContractType(pair string, contractType string) (err error)
- func (b *DiribitSim) SetLeverRate(value float64) (err error)
- type MarginInfo
Constants ¶
View Source
const (
PositionSizeLimit = 1000000 // Position size limit
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DiribitSim ¶
type DiribitSim struct {
// contains filtered or unexported fields
}
DiribitSim the deribit broker for backtest
func (*DiribitSim) AmendOrder ¶
func (*DiribitSim) CancelAllOrders ¶
func (b *DiribitSim) CancelAllOrders(symbol string) (err error)
func (*DiribitSim) CancelOrder ¶
func (b *DiribitSim) CancelOrder(symbol string, id string) (result Order, err error)
func (*DiribitSim) GetAccountSummary ¶
func (b *DiribitSim) GetAccountSummary(currency string) (result AccountSummary, err error)
func (*DiribitSim) GetContractID ¶
func (b *DiribitSim) GetContractID() (symbol string, err error)
func (*DiribitSim) GetName ¶
func (b *DiribitSim) GetName() (name string)
func (*DiribitSim) GetOpenOrders ¶
func (b *DiribitSim) GetOpenOrders(symbol string) (result []Order, err error)
func (*DiribitSim) GetOrder ¶
func (b *DiribitSim) GetOrder(symbol string, id string) (result Order, err error)
func (*DiribitSim) GetOrderBook ¶
func (b *DiribitSim) GetOrderBook(symbol string, depth int) (result OrderBook, err error)
func (*DiribitSim) GetPosition ¶
func (b *DiribitSim) GetPosition(symbol string) (result Position, err error)
func (*DiribitSim) GetRecords ¶
func (*DiribitSim) PlaceOrder ¶
func (*DiribitSim) RunEventLoopOnce ¶
func (b *DiribitSim) RunEventLoopOnce() (err error)
func (*DiribitSim) SetContractType ¶
func (b *DiribitSim) SetContractType(pair string, contractType string) (err error)
func (*DiribitSim) SetLeverRate ¶
func (b *DiribitSim) SetLeverRate(value float64) (err error)
type MarginInfo ¶
type MarginInfo struct { Leverage float64 MaintMargin float64 LiquidationPriceLong float64 LiquidationPriceShort float64 }
func CalcMarginInfo ¶
func CalcMarginInfo(balance float64, entryPrice float64, positionSize float64) (result MarginInfo)
计算保证金参数
Click to show internal directories.
Click to hide internal directories.