Documentation ¶
Index ¶
- func GetApi(query string) interface{}
- type MarketService
- func (m *MarketService) GetAggTrades(symbol string, limit int) interface{}
- func (m *MarketService) GetAvgPrice(symbol string) interface{}
- func (m *MarketService) GetDepth(symbol string) interface{}
- func (m *MarketService) GetExchangeInfo() interface{}
- func (m *MarketService) GetHistoricalTrades(symbol string, limit int) interface{}
- func (m *MarketService) GetKlines(symbol, interval string) interface{}
- func (m *MarketService) GetPing() interface{}
- func (m *MarketService) GetServerTime() interface{}
- func (m *MarketService) GetTicker(symbols []string, windowSize string, dataType string) interface{}
- func (m *MarketService) GetTicker24Hr(symbols []string, dataType string) interface{}
- func (m *MarketService) GetTickerBookTicker(symbols []string) interface{}
- func (m *MarketService) GetTickerPrice(symbols []string) interface{}
- func (m *MarketService) GetTickerTradingDay(symbols []string) interface{}
- func (m *MarketService) GetTrades(symbol string, limit int) interface{}
- func (m *MarketService) GetUIKlines(symbol, interval string) interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MarketService ¶
type MarketService struct{}
func NewMarketService ¶
func NewMarketService() *MarketService
func (*MarketService) GetAggTrades ¶
func (m *MarketService) GetAggTrades(symbol string, limit int) interface{}
GetAggTrades 请求 Binance API 获取压缩/聚合交易记录
func (*MarketService) GetAvgPrice ¶
func (m *MarketService) GetAvgPrice(symbol string) interface{}
GetAvgPrice 请求 Binance API 获取当前平均价格
func (*MarketService) GetDepth ¶
func (m *MarketService) GetDepth(symbol string) interface{}
GetDepth 请求 Binance API 获取订单簿
func (*MarketService) GetExchangeInfo ¶
func (m *MarketService) GetExchangeInfo() interface{}
GetExchangeInfo 请求 Binance API 获取交易所信息
func (*MarketService) GetHistoricalTrades ¶
func (m *MarketService) GetHistoricalTrades(symbol string, limit int) interface{}
GetHistoricalTrades 请求 Binance API 获取旧的交易记录
func (*MarketService) GetKlines ¶
func (m *MarketService) GetKlines(symbol, interval string) interface{}
GetKlines 请求 Binance API 获取K线/蜡烛图数据
func (*MarketService) GetPing ¶
func (m *MarketService) GetPing() interface{}
GetPing 请求 Binance API 进行连接测试
func (*MarketService) GetServerTime ¶
func (m *MarketService) GetServerTime() interface{}
GetServerTime 请求 Binance API 获取服务器时间
func (*MarketService) GetTicker ¶
func (m *MarketService) GetTicker(symbols []string, windowSize string, dataType string) interface{}
GetTicker 请求 Binance API 获取滚动窗口价格变化统计数据 symbols: 交易对列表,例如 ["BTCUSDT", "BNBUSDT"] windowSize: 时间窗口大小,支持的值有 "1m", "2m", ... "59m"(分钟), "1h", "2h", ... "23h"(小时), "1d", ... "7d"(天) type: 支持的值有 "FULL" 或 "MINI"。如果未提供,默认为 "FULL" 返回字段:
- symbol: 交易对
- priceChange: 价格变化
- priceChangePercent: 价格变化百分比
- weightedAvgPrice: 加权平均价格
- prevClosePrice: 前收盘价
- lastPrice: 最新价格
- lastQty: 最新成交量
- bidPrice: 买方出价
- askPrice: 卖方出价
- openPrice: 开盘价
- highPrice: 最高价
- lowPrice: 最低价
- volume: 成交量
- quoteVolume: 成交额
- openTime: 开始时间
- closeTime: 结束时间
- firstId: 首次成交ID
- lastId: 最后成交ID
- count: 成交次数
func (*MarketService) GetTicker24Hr ¶
func (m *MarketService) GetTicker24Hr(symbols []string, dataType string) interface{}
GetTicker24Hr 请求 Binance API 获取24小时价格变动情况 symbols 是一个包含多个交易对的字符串数组,例如 ["BTCUSDT", "BNBBTC"] 返回结果是一个 interface{} 类型,包含了各个交易对的24小时价格变动数据 返回的 JSON 数据结构如下:
[{ "symbol": "BNBBTC", // 交易对 "priceChange": "-0.00010200", // 价格变动 "priceChangePercent": "-1.152", // 价格变动百分比 "weightedAvgPrice": "0.00877364", // 加权平均价格 "prevClosePrice": "0.00885700", // 前一次收盘价 "lastPrice": "0.00875500", // 最新价格 "lastQty": "3.92000000", // 最新成交量 "bidPrice": "0.00875500", // 买入价格 "bidQty": "20.61500000", // 买入数量 "askPrice": "0.00875600", // 卖出价格 "askQty": "10.44800000", // 卖出数量 "openPrice": "0.00885700", // 开盘价 "highPrice": "0.00889800", // 最高价 "lowPrice": "0.00868500", // 最低价 "volume": "48607.13000000", // 成交量 "quoteVolume": "426.46130696", // 成交额 "openTime": 1721647533545, // 开盘时间(Unix毫秒时间戳) "closeTime": 1721733933545, // 收盘时间(Unix毫秒时间戳) "firstId": 251266985, // 首次成交ID "lastId": 251440381, // 最后成交ID "count": 173397 // 成交笔数 },]
func (*MarketService) GetTickerBookTicker ¶
func (m *MarketService) GetTickerBookTicker(symbols []string) interface{}
GetTickerBookTicker 请求 Binance API 获取Symbol Order Book Ticker
func (*MarketService) GetTickerPrice ¶
func (m *MarketService) GetTickerPrice(symbols []string) interface{}
GetTickerPrice 请求 Binance API 获取Symbol价格
func (*MarketService) GetTickerTradingDay ¶
func (m *MarketService) GetTickerTradingDay(symbols []string) interface{}
GetTickerTradingDay 请求 Binance API 获取交易日价格变动情况
func (*MarketService) GetTrades ¶
func (m *MarketService) GetTrades(symbol string, limit int) interface{}
GetTrades 请求 Binance API 获取最近的交易列表
func (*MarketService) GetUIKlines ¶
func (m *MarketService) GetUIKlines(symbol, interval string) interface{}
GetUIKlines 请求 Binance API 获取UIK线数据