hbdm

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 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 *hbdm.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 Hbdm

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

Hbdm the Huobi DM exchange

func NewHbdm

func NewHbdm(params *Parameters) *Hbdm

func (*Hbdm) AmendOrder

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

func (*Hbdm) CancelAllOrders

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

func (*Hbdm) CancelOrder

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

func (*Hbdm) CloseLong

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

func (*Hbdm) CloseShort

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

func (*Hbdm) GetBalance

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

func (*Hbdm) GetContractID

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

func (*Hbdm) GetContractInfo

func (b *Hbdm) GetContractInfo(symbol string) (rawSymbol string, contractType string, err error)

func (*Hbdm) GetName

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

func (*Hbdm) GetOpenOrders

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

func (*Hbdm) GetOrder

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

func (*Hbdm) GetOrderBook

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

func (*Hbdm) GetPositions

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

func (*Hbdm) GetRecords

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

func (*Hbdm) GetTime

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

func (*Hbdm) OpenLong

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

func (*Hbdm) OpenShort

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

func (*Hbdm) PlaceOrder

func (b *Hbdm) 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档 ioc: IOC订单 fok:FOK订单 "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下单 ----------------------------------------------------- 对手价下单price价格参数不用传,对手价下单价格是买一和卖一价 optimal_5:最优5档、optimal_10:最优10档、optimal_20:最优20档下单price价格参数不用传 "limit":限价,"post_only":只做maker单 需要传价格 "fok":全部成交或立即取消,"ioc":立即成交并取消剩余。

func (*Hbdm) SetContractType

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

设置合约类型 currencyPair: BTC/ETH/...

func (*Hbdm) SetLeverRate

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

设置杠杆大小

func (*Hbdm) SubscribeLevel2Snapshots

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

func (*Hbdm) SubscribeOrders

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

func (*Hbdm) SubscribePositions

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

func (*Hbdm) SubscribeTrades

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

type HbdmWebSocket

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

func NewHbdmWebSocket

func NewHbdmWebSocket(params *Parameters) *HbdmWebSocket

func (*HbdmWebSocket) SubscribeLevel2Snapshots

func (s *HbdmWebSocket) SubscribeLevel2Snapshots(symbol string, contractType string, callback func(ob *OrderBook)) error

func (*HbdmWebSocket) SubscribeOrders

func (s *HbdmWebSocket) SubscribeOrders(symbol string, contractType string, callback func(orders []*Order)) error

func (*HbdmWebSocket) SubscribePositions

func (s *HbdmWebSocket) SubscribePositions(symbol string, contractType string, callback func(positions []*Position)) error

func (*HbdmWebSocket) SubscribeTrades

func (s *HbdmWebSocket) SubscribeTrades(symbol string, contractType string, callback func(trades []*Trade)) error

Jump to

Keyboard shortcuts

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