Skip to content

Commit 8a277fd

Browse files
committed
update readme
1 parent 8397a66 commit 8a277fd

File tree

2 files changed

+23
-166
lines changed

2 files changed

+23
-166
lines changed

README.md

Lines changed: 8 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<div align="center">
22
<img width="409" heigth="205" src="https://upload-images.jianshu.io/upload_images/6760989-dec7dc747846880e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="goex">
33
<img src="https://travis-ci.org/nntaoli-project/goex.svg?branch=dev"/>
4-
<br/>
5-
[![](logo.png)] (https://www.jetbrains.com/?from=goex)
64
</div>
75

86
### goex目标
@@ -15,119 +13,44 @@ goex项目是为了统一并标准化各个数字资产交易平台的接口而
1513

1614
| 交易所 | 行情接口 | 交易接口 | 版本号 |
1715
| --- | --- | --- | --- |
18-
| hbg.com | Y | Y | 1 |
19-
| hbdm.com | Y| Y | 1 |
20-
| okex.com | Y | Y | 3 |
16+
| huobi.pro | Y | Y | 1 |
17+
| hbdm.com | Y (REST / WS)| Y | 1 |
18+
| okex.com (spot/future)| Y (REST / WS) | Y | 1 |
19+
| okex.com (swap future) | Y | Y | 2 |
2120
| binance.com | Y | Y | 1 |
2221
| kucoin.com | Y | Y | 1 |
2322
| bitstamp.net | Y | Y | 1 |
2423
| bitfinex.com | Y | Y | 1 |
2524
| zb.com | Y | Y | 1 |
2625
| kraken.com | Y | Y | * |
27-
| poloniex.com | Y | Y | * |
28-
| aacoin.com | Y | Y | 1 |
29-
| allcoin.ca | Y | Y | * |
26+
| poloniex.com | Y | Y | * |
3027
| big.one | Y | Y | 2\|3 |
31-
| fcoin.com | Y | Y | 2 |
3228
| hitbtc.com | Y | Y | * |
3329
| coinex.com | Y | Y | 1 |
3430
| exx.com | Y | Y | 1 |
3531
| bithumb.com | Y | Y | * |
3632
| gate.io | Y | N | 1 |
37-
| btcbox.co.jp | Y | N | * |
38-
| coinbig.com | Y | Y | * |
39-
|coinbene.com|Y|Y|*|
33+
| bittrex.com | Y | N | 1.1 |
4034

4135
### 安装goex库
36+
> go get
4237
4338
``` go get github.com/nntaoli-project/goex ```
4439

4540
>建议go mod 管理依赖
4641
```
4742
require (
48-
github.com/nntaoli-project/goex v1.0.4
43+
github.com/nntaoli-project/goex latest
4944
)
5045
```
5146

52-
### 例子
53-
54-
```golang
55-
56-
package main
57-
58-
import (
59-
"github.com/nntaoli-project/goex"
60-
"github.com/nntaoli-project/goex/builder"
61-
"log"
62-
"time"
63-
)
64-
65-
func main() {
66-
apiBuilder := builder.NewAPIBuilder().HttpTimeout(5 * time.Second)
67-
//apiBuilder := builder.NewAPIBuilder().HttpTimeout(5 * time.Second).HttpProxy("socks5://127.0.0.1:1080")
68-
69-
//build spot api
70-
//api := apiBuilder.APIKey("").APISecretkey("").ClientID("123").Build(goex.BITSTAMP)
71-
api := apiBuilder.APIKey("").APISecretkey("").Build(goex.HUOBI_PRO)
72-
log.Println(api.GetExchangeName())
73-
log.Println(api.GetTicker(goex.BTC_USD))
74-
log.Println(api.GetDepth(2, goex.BTC_USD))
75-
//log.Println(api.GetAccount())
76-
//log.Println(api.GetUnfinishOrders(goex.BTC_USD))
77-
78-
//build future api
79-
futureApi := apiBuilder.APIKey("").APISecretkey("").BuildFuture(goex.HBDM)
80-
log.Println(futureApi.GetExchangeName())
81-
log.Println(futureApi.GetFutureTicker(goex.BTC_USD, goex.QUARTER_CONTRACT))
82-
log.Println(futureApi.GetFutureDepth(goex.BTC_USD, goex.QUARTER_CONTRACT, 5))
83-
//log.Println(futureApi.GetFutureUserinfo()) // account
84-
//log.Println(futureApi.GetFuturePosition(goex.BTC_USD , goex.QUARTER_CONTRACT))//position info
85-
}
86-
87-
```
88-
89-
### websocket 使用例子
90-
91-
```golang
92-
import (
93-
"github.com/nntaoli-project/goex"
94-
"github.com/nntaoli-project/goex/huobi"
95-
//"github.com/nntaoli-project/goex/okcoin"
96-
"log"
97-
)
98-
99-
func main() {
100-
101-
//ws := okcoin.NewOKExFutureWs() //ok期货
102-
ws := huobi.NewHbdmWs() //huobi期货
103-
//设置回调函数
104-
ws.SetCallbacks(func(ticker *goex.FutureTicker) {
105-
log.Println(ticker)
106-
}, func(depth *goex.Depth) {
107-
log.Println(depth)
108-
}, func(trade *goex.Trade, contract string) {
109-
log.Println(contract, trade)
110-
})
111-
//订阅行情
112-
ws.SubscribeTrade(goex.BTC_USDT, goex.NEXT_WEEK_CONTRACT)
113-
ws.SubscribeDepth(goex.BTC_USDT, goex.QUARTER_CONTRACT, 5)
114-
ws.SubscribeTicker(goex.BTC_USDT, goex.QUARTER_CONTRACT)
115-
}
116-
117-
```
118-
119-
### 更多文档
120-
121-
[goex.TOP](https://goex.top)
122-
12347
### 注意事项
12448

12549
1. 推荐使用GoLand开发。
12650
2. 推荐关闭自动格式化功能,代码请使用go fmt 格式化.
12751
3. 不建议对现已存在的文件进行重新格式化,这样会导致commit特别糟糕。
12852
4. 请用OrderID2这个字段代替OrderID
12953
5. 请不要使用deprecated关键字标注的方法和字段,后面版本可能随时删除的
130-
6. 交流QQ群:574829125
13154
-----------------
13255

13356
donate

README_en.md

Lines changed: 15 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ goex project is designed to unify and standardize the interfaces of each digital
1111
### Exchanges are supported by goex `23+`
1212
| Exchange | Market API | Order API | Version |
1313
| --- | --- | --- | --- |
14-
| hbg.com | Y | Y | 1 |
14+
| huobi.pro | Y | Y | 1 |
1515
| hbdm.com | Y (REST / WS)| Y | 1 |
1616
| okex.com (spot/future)| Y (REST / WS) | Y | 1 |
1717
| okex.com (swap future) | Y | Y | 2 |
@@ -21,104 +21,38 @@ goex project is designed to unify and standardize the interfaces of each digital
2121
| bitfinex.com | Y | Y | 1 |
2222
| zb.com | Y | Y | 1 |
2323
| kraken.com | Y | Y | * |
24-
| poloniex.com | Y | Y | * |
25-
| aacoin.com | Y | Y | 1 |
26-
| allcoin.ca | Y | Y | * |
24+
| poloniex.com | Y | Y | * |
2725
| big.one | Y | Y | 2\|3 |
28-
| fcoin.com | Y (REST / WS) | Y | 2 |
2926
| hitbtc.com | Y | Y | * |
3027
| coinex.com | Y | Y | 1 |
3128
| exx.com | Y | Y | 1 |
3229
| bithumb.com | Y | Y | * |
3330
| gate.io | Y | N | 1 |
34-
| btcbox.co.jp | Y | N | * |
3531
| bittrex.com | Y | N | 1.1 |
36-
| btcchina.com | Y | Y | 1 |
37-
| coinbig.com | Y | Y | * |
3832

3933
### Install goex
40-
``` go get github.com/nntaoli-project/goex ```
41-
42-
### Example
43-
```golang
44-
45-
package main
46-
47-
import (
48-
"github.com/nntaoli-project/goex"
49-
"github.com/nntaoli-project/goex/builder"
50-
"log"
51-
"time"
52-
)
53-
54-
func main() {
55-
apiBuilder := builder.NewAPIBuilder().HttpTimeout(5 * time.Second)
56-
//apiBuilder := builder.NewAPIBuilder().HttpTimeout(5 * time.Second).HttpProxy("socks5://127.0.0.1:1080")
57-
58-
//build spot api
59-
//api := apiBuilder.APIKey("").APISecretkey("").ClientID("123").Build(goex.BITSTAMP)
60-
api := apiBuilder.APIKey("").APISecretkey("").Build(goex.HUOBI_PRO)
61-
log.Println(api.GetExchangeName())
62-
log.Println(api.GetTicker(goex.BTC_USD))
63-
log.Println(api.GetDepth(2, goex.BTC_USD))
64-
//log.Println(api.GetAccount())
65-
//log.Println(api.GetUnfinishOrders(goex.BTC_USD))
66-
67-
//build future api
68-
futureApi := apiBuilder.APIKey("").APISecretkey("").BuildFuture(goex.HBDM)
69-
log.Println(futureApi.GetExchangeName())
70-
log.Println(futureApi.GetFutureTicker(goex.BTC_USD, goex.QUARTER_CONTRACT))
71-
log.Println(futureApi.GetFutureDepth(goex.BTC_USD, goex.QUARTER_CONTRACT, 5))
72-
//log.Println(futureApi.GetFutureUserinfo()) // account
73-
//log.Println(futureApi.GetFuturePosition(goex.BTC_USD , goex.QUARTER_CONTRACT))//position info
74-
}
34+
> go get
7535
76-
```
36+
``` go get github.com/nntaoli-project/goex ```
37+
> go mod
7738
78-
### websocket Example
79-
```golang
80-
import (
81-
"github.com/nntaoli-project/goex"
82-
"github.com/nntaoli-project/goex/huobi"
83-
//"github.com/nntaoli-project/goex/okcoin"
84-
"log"
39+
```
40+
require (
41+
github.com/nntaoli-project/goex latest
8542
)
86-
87-
func main() {
88-
89-
//ws := okcoin.NewOKExFutureWs() //ok future
90-
ws := huobi.NewHbdmWs() //huobi future
91-
//setup callback
92-
ws.SetCallbacks(func(ticker *goex.FutureTicker) {
93-
log.Println(ticker)
94-
}, func(depth *goex.Depth) {
95-
log.Println(depth)
96-
}, func(trade *goex.Trade, contract string) {
97-
log.Println(contract, trade)
98-
})
99-
//subscribe
100-
ws.SubscribeTrade(goex.BTC_USDT, goex.NEXT_WEEK_CONTRACT)
101-
ws.SubscribeDepth(goex.BTC_USDT, goex.QUARTER_CONTRACT, 5)
102-
ws.SubscribeTicker(goex.BTC_USDT, goex.QUARTER_CONTRACT)
103-
}
104-
10543
```
10644

107-
### More Detail
108-
109-
[goex.TOP](https://goex.top)
110-
111-
# Highly Recommended(IMPORTANCE)
45+
#Recommended(IMPORTANCE)
11246
1. use GoLand development.
11347
2. turn off the auto format function.
11448
3. DONOT reformat existing files, which will result in a particularly bad commit.
11549
4. use the OrderID2 field instead of the OrderID
50+
5. can't use the deprecated field or method
11651

117-
### How to find us
118-
Join QQ group: [574829125](#)
119-
52+
donate & Buy a cup of Coffee for author
12053
-----------------
54+
BTC:13cBHLk6B7t3Uj7caJbCwv1UaiuiA6Qx8z
12155

122-
### Buy me a Coffe
123-
124-
<img src="https://raw.githubusercontent.com/nntaoli-project/goex/dev/wx_pay.JPG" width="250" alt="Buy me a Coffe">&nbsp;&nbsp;&nbsp;<img src="https://raw.githubusercontent.com/nntaoli-project/goex/dev/IMG_1177.jpg" width="250" alt="Buy me a Coffe">
56+
LTC:LVxM7y1K2dnpuNBU42ei3dKzPySf4VAm1H
57+
58+
ETH:0x98573ddb33cdddce480c3bc1f9279ccd88ca1e93

0 commit comments

Comments
 (0)