Documentation ¶
Index ¶
- func RegisterExchange(exchange Type, iExchange IExchange)
- type Balance
- type BaseApi
- type BaseExchange
- type IApi
- type IExchange
- type IKLineService
- type KLine
- type KLineService
- func (s *KLineService) Collect() map[string]interface{}
- func (s *KLineService) Do() ([]KLine, error)
- func (s *KLineService) SetEndTime(endTime int64) IKLineService
- func (s *KLineService) SetInterval(interval string) IKLineService
- func (s *KLineService) SetLimit(limit int) IKLineService
- func (s *KLineService) SetStartTime(startTime int64) IKLineService
- func (s *KLineService) SetSymbol(symbol string) IKLineService
- type Ticker
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterExchange ¶
Types ¶
type BaseExchange ¶
func (*BaseExchange) GetBalance ¶
func (exchange *BaseExchange) GetBalance(asset string) Balance
func (*BaseExchange) GetBalances ¶
func (exchange *BaseExchange) GetBalances() []Balance
type IExchange ¶
type IExchange interface { //订阅市场数据 SubscribeMarketData(streams []string, callback func(map[string]interface{})) error //订阅订单更新 SubscribeAccount(callback func(map[string]interface{})) error //近期K线 NewKLineService() IKLineService //下单 AddOrder(order db.Order) (map[string]interface{}, error) //取消订单 CancelOrder(symbol string, orderId string) (map[string]interface{}, error) //刷新账户信息 RefreshAccount() //获取账户余额 GetBalance(asset string) Balance //获取账户所有余额 GetBalances() []Balance //创建exchange NewExchange(apiKey string, apiSecret string) IExchange //ParseKLine ParseKLine(data map[string]interface{}) KLine //ParseTicker ParseTicker(data map[string]interface{}) Ticker }
type IKLineService ¶
type IKLineService interface { SetSymbol(symbol string) IKLineService SetInterval(interval string) IKLineService SetStartTime(startTime int64) IKLineService SetEndTime(endTime int64) IKLineService SetLimit(limit int) IKLineService Collect() map[string]interface{} Do() ([]KLine, error) }
KLine服务
type KLineService ¶
type KLineService struct { Api IApi Symbol string Interval string StartTime *int64 EndTime *int64 Limit *int }
func (*KLineService) Collect ¶
func (s *KLineService) Collect() map[string]interface{}
func (*KLineService) Do ¶
func (s *KLineService) Do() ([]KLine, error)
func (*KLineService) SetEndTime ¶
func (s *KLineService) SetEndTime(endTime int64) IKLineService
func (*KLineService) SetInterval ¶
func (s *KLineService) SetInterval(interval string) IKLineService
func (*KLineService) SetLimit ¶
func (s *KLineService) SetLimit(limit int) IKLineService
func (*KLineService) SetStartTime ¶
func (s *KLineService) SetStartTime(startTime int64) IKLineService
func (*KLineService) SetSymbol ¶
func (s *KLineService) SetSymbol(symbol string) IKLineService
type Ticker ¶
type Ticker struct { EventType string `json:"e"` // 事件类型 Time float64 `json:"E"` // 事件时间 Symbol string `json:"s"` // 交易对 Change24Price decimal.Decimal `json:"p"` // 24小时价格变化 Change24Percent decimal.Decimal `json:"P"` // 24小时价格变化(百分比) AvgPrice decimal.Decimal `json:"w"` // 平均价格 First24PricePre decimal.Decimal `json:"x"` // 整整24小时之前,向前数的最后一次成交价格 LatestPrice decimal.Decimal `json:"c"` // 最新成交价格 LatestVol decimal.Decimal `json:"Q"` // 最新成交交易的成交量 LatestHighPriceBuy decimal.Decimal `json:"b"` // 目前最高买单价 LatestHighPriceBuyVol decimal.Decimal `json:"B"` // 目前最高买单价的挂单量 LatestLowPriceSell decimal.Decimal `json:"a"` // 目前最低卖单价 LatestLowPriceSellVol decimal.Decimal `json:"A"` // 目前最低卖单价的挂单量 First24PriceAft decimal.Decimal `json:"o"` // 整整24小时前,向后数的第一次成交价格 High24Price decimal.Decimal `json:"h"` // 24小时内最高成交价 Low24Price decimal.Decimal `json:"l"` // 24小时内最低成交价 Vol decimal.Decimal `json:"v"` // 24小时内成交量 Amount decimal.Decimal `json:"q"` // 24小时内成交额 StartTime float64 `json:"O"` // 统计开始时间 EndTime float64 `json:"C"` // 统计结束时间 FirstOrderId int `json:"F"` // 24小时内第一笔成交交易ID EndOrderId int `json:"L"` // 24小时内最后一笔成交交易ID OrderNum int `json:"n"` // 24小时内成交数 }
Click to show internal directories.
Click to hide internal directories.