hbdm_broker

package
v0.9.10 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const StatusOK = "ok"

Variables

This section is empty.

Functions

This section is empty.

Types

type HBDMBroker added in v0.9.4

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

HBDMBroker the Huobi DM broker

func NewBroker

func NewBroker(addr string, accessKey string, secretKey string) *HBDMBroker

func (*HBDMBroker) AmendOrder added in v0.9.4

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

func (*HBDMBroker) CancelAllOrders added in v0.9.4

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

func (*HBDMBroker) CancelOrder added in v0.9.4

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

func (*HBDMBroker) GetAccountSummary added in v0.9.4

func (b *HBDMBroker) GetAccountSummary(currency string) (result AccountSummary, err error)

func (*HBDMBroker) GetContractID added in v0.9.4

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

func (*HBDMBroker) GetName added in v0.9.7

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

func (*HBDMBroker) GetOpenOrders added in v0.9.4

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

func (*HBDMBroker) GetOrder added in v0.9.4

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

func (*HBDMBroker) GetOrderBook added in v0.9.4

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

func (*HBDMBroker) GetPosition added in v0.9.4

func (b *HBDMBroker) GetPosition(symbol string) (result Position, err error)

func (*HBDMBroker) GetRecords added in v0.9.8

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

func (*HBDMBroker) PlaceOrder added in v0.9.4

func (b *HBDMBroker) 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)

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 (*HBDMBroker) RunEventLoopOnce added in v0.9.4

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

func (*HBDMBroker) SetContractType added in v0.9.4

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

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

func (*HBDMBroker) SetLeverRate added in v0.9.4

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

设置杠杆大小

type WS added in v0.9.10

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

func NewWS added in v0.9.10

func NewWS(wsURL string, accessKey string, secretKey string) *WS

func (*WS) On added in v0.9.10

func (s *WS) On(event WSEvent, listener interface{})

func (*WS) SubscribeLevel2Snapshots added in v0.9.10

func (s *WS) SubscribeLevel2Snapshots(market Market)

func (*WS) SubscribeOrders added in v0.9.10

func (s *WS) SubscribeOrders(market Market)

func (*WS) SubscribePositions added in v0.9.10

func (s *WS) SubscribePositions(market Market)

func (*WS) SubscribeTrades added in v0.9.10

func (s *WS) SubscribeTrades(market Market)

Jump to

Keyboard shortcuts

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