Categorygithub.com/jksusu/kline
modulepackage
0.0.2
Repository: https://github.com/jksusu/kline.git
Documentation: pkg.go.dev

# README

Kline hq

huobi sian 实时行情 websocket 接口

Thank you!

Install

go get github.com/jksusu/kline

Examples: 详细功能请看 example

package main

import (
	"fmt"
	"github.com/jksusu/kline"
)

func main() {
	go Huobi()
	Sina()
}

// 火币
func Huobi() {
	c := new(kline.Huobi).NewClient()//初始化火币
	c.SetProxy("socks5://localhost:1080")//设置代理,如果不存在网络问题则不需要
	c.SetPeriod([]string{kline.AMinute})//设置订阅时段,huobi 请到官网文档查看
	c.SetPairs([]string{"btcusdt"})//设置需要订阅的交易对
	go c.Start()//启动系统
	
	//也支持链式调用
	go (&kline.Huobi{}).NewClient().SetProxy("socks5://localhost:1080").SetPeriod([]string{kline.AMinute}).SetPairs([]string{"btcusdt"}).Start()
	
	for {
		select {
		case p := <-kline.MarketChannel:
			fmt.Println(p)
			break
		case p := <-kline.RawData:
			//原始数据,如果设置了 SetRowData
			fmt.Println(p)
			break
		}
	}
}

func Sina() {
	//新浪直接设置 SetPairs 可用
	go (&kline.Sina{}).NewClient().SetRowData(true).SetPairs([]string{"hf_GC", "hf_SI", "fx_susdhkd"}).Start()
	
	for {
		select {
		case p := <-kline.MarketChannel:
			fmt.Println(p)
			break
		case p := <-kline.RawData:
			fmt.Println(p)
			break
		}
	}
}

Warn

程序未做异常处理,请自己处理异常

License

The project is licensed under the MIT License.

# Packages

No description provided by the author
No description provided by the author

# Functions

时间取模算法.

# Constants

分时.
分时.
分时.
分时.
分时.
分时.
分时.
分时.
分时.
分时.
分时.

# Variables

1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M 币安的时间规则.
1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M 币安的时间规则.
深度数据.
获取已经订阅的信息流.
行情格式.
历史行情.
行情原始格式.
订阅.
取消.

# Structs

* * https://gushitong.baidu.com/ * 外汇历史API,股票历史API */.
* * https://gushitong.baidu.com/ * 外汇历史API,股票历史API */.
No description provided by the author
No description provided by the author
No description provided by the author
数据结构定义.
数据结构定义.
No description provided by the author
No description provided by the author
数据结构定义.
数据结构定义.
数据结构定义.
No description provided by the author
贵金属.
新浪分钟线返回参数结构体.
No description provided by the author

# Interfaces

数据结构定义.