hbdmswap

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const StatusOK = "ok"

Variables

This section is empty.

Functions

This section is empty.

Types

type DepthOrderBook

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

func NewDepthOrderBook

func NewDepthOrderBook(symbol string) *DepthOrderBook

func (*DepthOrderBook) GetOrderBook

func (d *DepthOrderBook) GetOrderBook(depth int) (result OrderBook)

func (*DepthOrderBook) GetSymbol

func (d *DepthOrderBook) GetSymbol() string

func (*DepthOrderBook) Update

func (d *DepthOrderBook) Update(data *hbdmswap.WSDepthHF)

type DobItem

type DobItem struct {
	Price  float64
	Amount float64
}

func (DobItem) ExtractKey

func (e DobItem) ExtractKey() float64

func (DobItem) String

func (e DobItem) String() string

type HbdmSwap

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

HbdmSwap the Huobi DM Swap exchange

func NewHbdmSwap

func NewHbdmSwap(params *Parameters) *HbdmSwap

func (*HbdmSwap) AmendOrder

func (b *HbdmSwap) AmendOrder(symbol string, id string, price float64, size float64, opts ...OrderOption) (result *Order, err error)

func (*HbdmSwap) CancelAllOrders

func (b *HbdmSwap) CancelAllOrders(symbol string, opts ...OrderOption) (err error)

func (*HbdmSwap) CancelOrder

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

func (*HbdmSwap) CloseLong

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

func (*HbdmSwap) CloseShort

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

func (*HbdmSwap) GetBalance

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

func (*HbdmSwap) GetContractID

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

func (*HbdmSwap) GetName

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

func (*HbdmSwap) GetOpenOrders

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

func (*HbdmSwap) GetOrder

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

func (*HbdmSwap) GetOrderBook

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

func (*HbdmSwap) GetPositions

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

func (*HbdmSwap) GetRecords

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

func (*HbdmSwap) GetTime

func (b *HbdmSwap) GetTime() (tm int64, err error)

func (*HbdmSwap) OpenLong

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

func (*HbdmSwap) OpenShort

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

func (*HbdmSwap) PlaceOrder

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

PlaceOrder 下单 params: order_price_type: 订单报价类型 订单报价类型: "limit": 限价 "opponent": 对手价 "post_only":只做maker单 post only下单只受用户持仓数量限制 optimal_5:最优5档 optimal_10:最优10档 optimal_20:最优20档 "fok":FOK订单 "ioc":IOC订单 opponent_ioc": 对手价-IOC下单 "optimal_5_ioc":最优5档-IOC下单 "optimal_10_ioc":最优10档-IOC下单 "optimal_20_ioc":最优20档-IOC下单 "opponent_fok": 对手价-FOK下单 "optimal_5_fok":最优5档-FOK下单 "optimal_10_fok":最优10档-FOK下单 "optimal_20_fok":最优20档-FOK下单

func (*HbdmSwap) SetContractType

func (b *HbdmSwap) SetContractType(pair string, contractType string) (err error)

设置合约类型

func (*HbdmSwap) SetLeverRate

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

设置杠杆大小

func (*HbdmSwap) SubscribeLevel2Snapshots

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

func (*HbdmSwap) SubscribeOrders

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

func (*HbdmSwap) SubscribePositions

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

func (*HbdmSwap) SubscribeTrades

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

type SwapWebSocket

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

func NewSwapWebSocket

func NewSwapWebSocket(params *Parameters) *SwapWebSocket

func (*SwapWebSocket) SubscribeLevel2Snapshots

func (s *SwapWebSocket) SubscribeLevel2Snapshots(market Market, callback func(ob *OrderBook)) error

func (*SwapWebSocket) SubscribeOrders

func (s *SwapWebSocket) SubscribeOrders(market Market, callback func(orders []*Order)) error

func (*SwapWebSocket) SubscribePositions

func (s *SwapWebSocket) SubscribePositions(market Market, callback func(positions []*Position)) error

func (*SwapWebSocket) SubscribeTrades

func (s *SwapWebSocket) SubscribeTrades(market Market, callback func(trades []*Trade)) error

Jump to

Keyboard shortcuts

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