diff --git a/main.go b/main.go index 8eafced..854416e 100644 --- a/main.go +++ b/main.go @@ -3,15 +3,15 @@ package main import ( "context" "fmt" + . "github.com/eddddiez/OKEX_V5SDK_GO/rest" + . "github.com/eddddiez/OKEX_V5SDK_GO/ws" "log" "time" - . "v5sdk_go/rest" - . "v5sdk_go/ws" ) /* - rest API请求 - 更多示例请查看 rest/rest_test.go +rest API请求 +更多示例请查看 rest/rest_test.go */ func REST() { // 设置您的APIKey diff --git a/rest/rest.go b/rest/rest.go index d764125..774d817 100644 --- a/rest/rest.go +++ b/rest/rest.go @@ -6,11 +6,11 @@ import ( "encoding/json" "errors" "fmt" + . "github.com/eddddiez/OKEX_V5SDK_GO/utils" "io/ioutil" "net/http" "strings" "time" - . "v5sdk_go/utils" ) type RESTAPI struct { @@ -51,9 +51,9 @@ type Okexv5APIResponse struct { } /* - endPoint:请求地址 - apiKey - isSimulate: 是否为模拟环境 +endPoint:请求地址 +apiKey +isSimulate: 是否为模拟环境 */ func NewRESTClient(endPoint string, apiKey *APIKeyInfo, isSimulate bool) *RESTAPI { @@ -230,7 +230,7 @@ func (this *RESTAPI) Run(ctx context.Context) (res *RESTAPIResult, err error) { } /* - 生成请求对应的参数 +生成请求对应的参数 */ func (this *RESTAPI) GenReqInfo() (uri string, body string, err error) { uri = this.Uri @@ -265,14 +265,14 @@ func (this *RESTAPI) GenReqInfo() (uri string, body string, err error) { } /* - Set http request headers: - Accept: application/json - Content-Type: application/json; charset=UTF-8 (default) - Cookie: locale=en_US (English) - OK-ACCESS-KEY: (Your setting) - OK-ACCESS-SIGN: (Use your setting, auto sign and add) - OK-ACCESS-TIMESTAMP: (Auto add) - OK-ACCESS-PASSPHRASE: Your setting +Set http request headers: +Accept: application/json +Content-Type: application/json; charset=UTF-8 (default) +Cookie: locale=en_US (English) +OK-ACCESS-KEY: (Your setting) +OK-ACCESS-SIGN: (Use your setting, auto sign and add) +OK-ACCESS-TIMESTAMP: (Auto add) +OK-ACCESS-PASSPHRASE: Your setting */ func (this *RESTAPI) SetHeaders(request *http.Request, timestamp string, sign string) (header string) { @@ -306,7 +306,7 @@ func (this *RESTAPI) SetHeaders(request *http.Request, timestamp string, sign st } /* - 打印header信息 +打印header信息 */ func (this *RESTAPI) PrintRequest(request *http.Request, body string, preHash string) { if this.ApiKeyInfo.SecKey != "" { diff --git a/ws/utils.go b/ws/utils.go index 3c75066..0d1de4d 100644 --- a/ws/utils.go +++ b/ws/utils.go @@ -2,10 +2,10 @@ package ws import ( "errors" + . "github.com/eddddiez/OKEX_V5SDK_GO/ws/wImpl" + . "github.com/eddddiez/OKEX_V5SDK_GO/ws/wInterface" "log" "runtime/debug" - . "v5sdk_go/ws/wImpl" - . "v5sdk_go/ws/wInterface" ) // 判断返回结果成功失败 diff --git a/ws/wImpl/JRPCData.go b/ws/wImpl/JRPCData.go index cfd3223..ec5de80 100644 --- a/ws/wImpl/JRPCData.go +++ b/ws/wImpl/JRPCData.go @@ -1,11 +1,11 @@ /* - JRPC请求/响应数据 +JRPC请求/响应数据 */ package wImpl import ( "encoding/json" - . "v5sdk_go/utils" + . "github.com/eddddiez/OKEX_V5SDK_GO/utils" ) // jrpc请求结构体 diff --git a/ws/wImpl/ReqData.go b/ws/wImpl/ReqData.go index df7afa1..88f70ba 100644 --- a/ws/wImpl/ReqData.go +++ b/ws/wImpl/ReqData.go @@ -6,7 +6,7 @@ package wImpl import ( "encoding/json" - . "v5sdk_go/utils" + . "github.com/eddddiez/OKEX_V5SDK_GO/utils" ) // 客户端请求消息格式 diff --git a/ws/wInterface/IParam.go b/ws/wInterface/IParam.go index 72f10e1..8ea880b 100644 --- a/ws/wInterface/IParam.go +++ b/ws/wInterface/IParam.go @@ -1,6 +1,6 @@ package wInterface -import . "v5sdk_go/ws/wImpl" +import . "github.com/eddddiez/OKEX_V5SDK_GO/ws/wImpl" // 请求数据 type WSParam interface { diff --git a/ws/ws_cli.go b/ws/ws_cli.go index cf391a4..4ab735a 100644 --- a/ws/ws_cli.go +++ b/ws/ws_cli.go @@ -5,14 +5,14 @@ import ( "encoding/json" "errors" "fmt" + . "github.com/eddddiez/OKEX_V5SDK_GO/config" + . "github.com/eddddiez/OKEX_V5SDK_GO/utils" + . "github.com/eddddiez/OKEX_V5SDK_GO/ws/wImpl" "log" "regexp" "runtime/debug" "sync" "time" - . "v5sdk_go/config" - . "v5sdk_go/utils" - . "v5sdk_go/ws/wImpl" "github.com/gorilla/websocket" ) @@ -55,9 +55,9 @@ type WsClient struct { } /* - 服务端响应详细信息 - Timestamp: 接受到消息的时间 - Info: 接受到的消息字符串 +服务端响应详细信息 +Timestamp: 接受到消息的时间 +Info: 接受到的消息字符串 */ type Msg struct { Timestamp time.Time `json:"timestamp"` @@ -71,7 +71,7 @@ func (this *Msg) Print() { } /* - 订阅结果封装后的消息结构体 +订阅结果封装后的消息结构体 */ type ProcessDetail struct { EndPoint string `json:"endPoint"` @@ -112,7 +112,7 @@ func NewWsClient(ep string) (r *WsClient, err error) { } /* - 新增记录深度信息 +新增记录深度信息 */ func (a *WsClient) addDepthDataList(key string, dd DepthDetail) error { a.DepthDataLock.Lock() @@ -122,7 +122,7 @@ func (a *WsClient) addDepthDataList(key string, dd DepthDetail) error { } /* - 更新记录深度信息(如果没有记录不会更新成功) +更新记录深度信息(如果没有记录不会更新成功) */ func (a *WsClient) updateDepthDataList(key string, dd DepthDetail) error { a.DepthDataLock.Lock() @@ -136,7 +136,7 @@ func (a *WsClient) updateDepthDataList(key string, dd DepthDetail) error { } /* - 删除记录深度信息 +删除记录深度信息 */ func (a *WsClient) deleteDepthDataList(key string) error { a.DepthDataLock.Lock() @@ -146,7 +146,7 @@ func (a *WsClient) deleteDepthDataList(key string) error { } /* - 设置是否自动深度管理,开启 true,关闭 false +设置是否自动深度管理,开启 true,关闭 false */ func (a *WsClient) EnableAutoDepthMgr(b bool) error { a.DepthDataLock.Lock() @@ -162,7 +162,7 @@ func (a *WsClient) EnableAutoDepthMgr(b bool) error { } /* - 获取当前的深度快照信息(合并后的) +获取当前的深度快照信息(合并后的) */ func (a *WsClient) GetSnapshotByChannel(data DepthData) (snapshot *DepthDetail, err error) { key, err := json.Marshal(data.Arg) @@ -309,7 +309,7 @@ func (a *WsClient) work() { } /* - 处理接受到的消息 +处理接受到的消息 */ func (a *WsClient) receive() { defer func() { @@ -443,7 +443,7 @@ func (a *WsClient) receive() { } /* - 开启了深度数据管理功能后,系统会自动合并深度信息 +开启了深度数据管理功能后,系统会自动合并深度信息 */ func (a *WsClient) MergeDepth(depData DepthData) (err error) { if !a.autoDepthMgr { @@ -496,7 +496,7 @@ func (a *WsClient) MergeDepth(depData DepthData) (err error) { } /* - 通过ErrorCode判断事件类型 +通过ErrorCode判断事件类型 */ func GetInfoFromErrCode(data ErrData) Event { switch data.Code { @@ -528,9 +528,10 @@ func GetInfoFromErrCode(data ErrData) Event { } /* - 从error返回中解析出对应的channel - error信息样例 - {"event":"error","msg":"channel:index-tickers,instId:BTC-USDT1 doesn't exist","code":"60018"} + 从error返回中解析出对应的channel + error信息样例 + +{"event":"error","msg":"channel:index-tickers,instId:BTC-USDT1 doesn't exist","code":"60018"} */ func GetInfoFromErrMsg(raw string) (channel string) { reg := regexp.MustCompile(`channel:(.*?),`) @@ -547,7 +548,7 @@ func GetInfoFromErrMsg(raw string) (channel string) { } /* - 解析消息类型 +解析消息类型 */ func (a *WsClient) parseMessage(raw []byte) (evt Event, data interface{}, err error) { evt = EVENT_UNKNOWN @@ -660,7 +661,7 @@ func (a *WsClient) Stop() error { } a.isStarted = false - + if a.conn != nil { a.conn.Close() } @@ -678,7 +679,7 @@ func (a *WsClient) Stop() error { } /* - 添加全局消息处理的回调函数 +添加全局消息处理的回调函数 */ func (a *WsClient) AddMessageHook(fn ReceivedDataCallback) error { a.onMessageHook = fn @@ -686,7 +687,7 @@ func (a *WsClient) AddMessageHook(fn ReceivedDataCallback) error { } /* - 添加订阅消息处理的回调函数 +添加订阅消息处理的回调函数 */ func (a *WsClient) AddBookMsgHook(fn ReceivedMsgDataCallback) error { a.onBookMsgHook = fn @@ -694,9 +695,9 @@ func (a *WsClient) AddBookMsgHook(fn ReceivedMsgDataCallback) error { } /* - 添加深度消息处理的回调函数 - 例如: - cli.AddDepthHook(func(ts time.Time, data DepthData) error { return nil }) +添加深度消息处理的回调函数 +例如: +cli.AddDepthHook(func(ts time.Time, data DepthData) error { return nil }) */ func (a *WsClient) AddDepthHook(fn ReceivedDepthDataCallback) error { a.onDepthHook = fn @@ -704,7 +705,7 @@ func (a *WsClient) AddDepthHook(fn ReceivedDepthDataCallback) error { } /* - 添加错误类型消息处理的回调函数 +添加错误类型消息处理的回调函数 */ func (a *WsClient) AddErrMsgHook(fn ReceivedDataCallback) error { a.OnErrorHook = fn @@ -712,7 +713,7 @@ func (a *WsClient) AddErrMsgHook(fn ReceivedDataCallback) error { } /* - 判断连接是否存活 +判断连接是否存活 */ func (a *WsClient) IsAlive() bool { res := false diff --git a/ws/ws_jrpc.go b/ws/ws_jrpc.go index b27480e..af63e23 100644 --- a/ws/ws_jrpc.go +++ b/ws/ws_jrpc.go @@ -2,19 +2,20 @@ package ws import ( "context" + . "github.com/eddddiez/OKEX_V5SDK_GO/ws/wImpl" "log" "time" - . "v5sdk_go/ws/wImpl" ) /* - websocket交易 通用请求 - 参数说明: - evtId:封装的事件类型 - id: 请求ID - op: 请求参数op - params: 请求参数 - timeOut: 超时时间 +websocket交易 通用请求 +参数说明: + + evtId:封装的事件类型 + id: 请求ID + op: 请求参数op + params: 请求参数 + timeOut: 超时时间 */ func (a *WsClient) jrpcReq(evtId Event, op string, id string, params []map[string]interface{}, timeOut ...int) (res bool, detail *ProcessDetail, err error) { res = true @@ -56,11 +57,12 @@ func (a *WsClient) jrpcReq(evtId Event, op string, id string, params []map[strin } /* - 单个下单 - 参数说明: - id: 请求ID - params: 请求参数 - timeOut: 超时时间 +单个下单 +参数说明: + + id: 请求ID + params: 请求参数 + timeOut: 超时时间 */ func (a *WsClient) PlaceOrder(id string, param map[string]interface{}, timeOut ...int) (res bool, detail *ProcessDetail, err error) { op := "order" @@ -74,11 +76,12 @@ func (a *WsClient) PlaceOrder(id string, param map[string]interface{}, timeOut . } /* - 批量下单 - 参数说明: - id: 请求ID - params: 请求参数 - timeOut: 超时时间 +批量下单 +参数说明: + + id: 请求ID + params: 请求参数 + timeOut: 超时时间 */ func (a *WsClient) BatchPlaceOrders(id string, params []map[string]interface{}, timeOut ...int) (res bool, detail *ProcessDetail, err error) { @@ -89,11 +92,12 @@ func (a *WsClient) BatchPlaceOrders(id string, params []map[string]interface{}, } /* - 单个撤单 - 参数说明: - id: 请求ID - params: 请求参数 - timeOut: 超时时间 +单个撤单 +参数说明: + + id: 请求ID + params: 请求参数 + timeOut: 超时时间 */ func (a *WsClient) CancelOrder(id string, param map[string]interface{}, timeOut ...int) (res bool, detail *ProcessDetail, err error) { @@ -108,11 +112,12 @@ func (a *WsClient) CancelOrder(id string, param map[string]interface{}, timeOut } /* - 批量撤单 - 参数说明: - id: 请求ID - params: 请求参数 - timeOut: 超时时间 +批量撤单 +参数说明: + + id: 请求ID + params: 请求参数 + timeOut: 超时时间 */ func (a *WsClient) BatchCancelOrders(id string, params []map[string]interface{}, timeOut ...int) (res bool, detail *ProcessDetail, err error) { @@ -123,11 +128,12 @@ func (a *WsClient) BatchCancelOrders(id string, params []map[string]interface{}, } /* - 单个改单 - 参数说明: - id: 请求ID - params: 请求参数 - timeOut: 超时时间 +单个改单 +参数说明: + + id: 请求ID + params: 请求参数 + timeOut: 超时时间 */ func (a *WsClient) AmendOrder(id string, param map[string]interface{}, timeOut ...int) (res bool, detail *ProcessDetail, err error) { @@ -142,11 +148,12 @@ func (a *WsClient) AmendOrder(id string, param map[string]interface{}, timeOut . } /* - 批量改单 - 参数说明: - id: 请求ID - params: 请求参数 - timeOut: 超时时间 +批量改单 +参数说明: + + id: 请求ID + params: 请求参数 + timeOut: 超时时间 */ func (a *WsClient) BatchAmendOrders(id string, params []map[string]interface{}, timeOut ...int) (res bool, detail *ProcessDetail, err error) { diff --git a/ws/ws_jrpc_test.go b/ws/ws_jrpc_test.go index da8fa70..cfe14d8 100644 --- a/ws/ws_jrpc_test.go +++ b/ws/ws_jrpc_test.go @@ -2,9 +2,9 @@ package ws import ( "fmt" + . "github.com/eddddiez/OKEX_V5SDK_GO/ws/wImpl" "testing" "time" - . "v5sdk_go/ws/wImpl" ) func PrintDetail(d *ProcessDetail) { @@ -55,7 +55,7 @@ func (r *WsClient) makeOrder(instId string, tdMode string, side string, ordType } /* - 单个下单 +单个下单 */ func TestPlaceOrder(t *testing.T) { r := prework_pri(CROSS_ACCOUNT) @@ -86,7 +86,7 @@ func TestPlaceOrder(t *testing.T) { } /* - 批量下单 +批量下单 */ func TestPlaceBatchOrder(t *testing.T) { r := prework_pri(CROSS_ACCOUNT) @@ -128,7 +128,7 @@ func TestPlaceBatchOrder(t *testing.T) { } /* - 撤销订单 +撤销订单 */ func TestCancelOrder(t *testing.T) { r := prework_pri(CROSS_ACCOUNT) @@ -155,7 +155,7 @@ func TestCancelOrder(t *testing.T) { } /* - 修改订单 +修改订单 */ func TestAmendlOrder(t *testing.T) { r := prework_pri(CROSS_ACCOUNT) diff --git a/ws/ws_op.go b/ws/ws_op.go index f785850..1970364 100644 --- a/ws/ws_op.go +++ b/ws/ws_op.go @@ -3,19 +3,19 @@ package ws import ( "context" "errors" + . "github.com/eddddiez/OKEX_V5SDK_GO/config" + "github.com/eddddiez/OKEX_V5SDK_GO/rest" + . "github.com/eddddiez/OKEX_V5SDK_GO/utils" + . "github.com/eddddiez/OKEX_V5SDK_GO/ws/wImpl" + . "github.com/eddddiez/OKEX_V5SDK_GO/ws/wInterface" "log" "sync" "time" - . "v5sdk_go/config" - "v5sdk_go/rest" - . "v5sdk_go/utils" - . "v5sdk_go/ws/wImpl" - . "v5sdk_go/ws/wInterface" ) /* - Ping服务端保持心跳。 - timeOut:超时时间(毫秒),如果不填默认为5000ms +Ping服务端保持心跳。 +timeOut:超时时间(毫秒),如果不填默认为5000ms */ func (a *WsClient) Ping(timeOut ...int) (res bool, detail *ProcessDetail, err error) { tm := 5000 @@ -54,7 +54,7 @@ func (a *WsClient) Ping(timeOut ...int) (res bool, detail *ProcessDetail, err er } /* - 登录私有频道 +登录私有频道 */ func (a *WsClient) Login(apiKey, secKey, passPhrase string, timeOut ...int) (res bool, detail *ProcessDetail, err error) { @@ -140,7 +140,7 @@ func (a *WsClient) Login(apiKey, secKey, passPhrase string, timeOut ...int) (res } /* - 等待结果响应 +等待结果响应 */ func (a *WsClient) waitForResult(e Event, timeOut int) (data interface{}, err error) { @@ -168,7 +168,7 @@ func (a *WsClient) waitForResult(e Event, timeOut int) (data interface{}, err er } /* - 发送消息到服务端 +发送消息到服务端 */ func (a *WsClient) Send(ctx context.Context, op WSReqData) (err error) { select { @@ -289,8 +289,8 @@ func (a *WsClient) process(ctx context.Context, e Event, op WSReqData) (data []* } /* - 根据args请求参数判断请求类型 - 如:{"channel": "account","ccy": "BTC"} 类型为 EVENT_BOOK_ACCOUNT +根据args请求参数判断请求类型 +如:{"channel": "account","ccy": "BTC"} 类型为 EVENT_BOOK_ACCOUNT */ func GetEventByParam(param map[string]string) (evtId Event) { evtId = EVENT_UNKNOWN @@ -304,8 +304,8 @@ func GetEventByParam(param map[string]string) (evtId Event) { } /* - 订阅频道。 - req:请求json字符串 +订阅频道。 +req:请求json字符串 */ func (a *WsClient) Subscribe(param map[string]string, timeOut ...int) (res bool, detail *ProcessDetail, err error) { res = true @@ -355,8 +355,8 @@ func (a *WsClient) Subscribe(param map[string]string, timeOut ...int) (res bool, } /* - 取消订阅频道。 - req:请求json字符串 +取消订阅频道。 +req:请求json字符串 */ func (a *WsClient) UnSubscribe(param map[string]string, timeOut ...int) (res bool, detail *ProcessDetail, err error) { res = true @@ -404,7 +404,7 @@ func (a *WsClient) UnSubscribe(param map[string]string, timeOut ...int) (res boo } /* - jrpc请求 +jrpc请求 */ func (a *WsClient) Jrpc(id, op string, params []map[string]interface{}, timeOut ...int) (res bool, detail *ProcessDetail, err error) { res = true diff --git a/ws/ws_priv_channel.go b/ws/ws_priv_channel.go index 650d5ec..5031312 100644 --- a/ws/ws_priv_channel.go +++ b/ws/ws_priv_channel.go @@ -1,39 +1,39 @@ package ws import ( - . "v5sdk_go/ws/wImpl" + . "github.com/eddddiez/OKEX_V5SDK_GO/ws/wImpl" ) /* - 订阅账户频道 +订阅账户频道 */ func (a *WsClient) PrivAccout(op string, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { return a.PubChannel(EVENT_BOOK_ACCOUNT, op, params, PERIOD_NONE, timeOut...) } /* - 订阅持仓频道 +订阅持仓频道 */ func (a *WsClient) PrivPostion(op string, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { return a.PubChannel(EVENT_BOOK_POSTION, op, params, PERIOD_NONE, timeOut...) } /* - 订阅订单频道 +订阅订单频道 */ func (a *WsClient) PrivBookOrder(op string, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { return a.PubChannel(EVENT_BOOK_ORDER, op, params, PERIOD_NONE, timeOut...) } /* - 订阅策略委托订单频道 +订阅策略委托订单频道 */ func (a *WsClient) PrivBookAlgoOrder(op string, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { return a.PubChannel(EVENT_BOOK_ALG_ORDER, op, params, PERIOD_NONE, timeOut...) } /* - 订阅账户余额和持仓频道 +订阅账户余额和持仓频道 */ func (a *WsClient) PrivBalAndPos(op string, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { return a.PubChannel(EVENT_BOOK_B_AND_P, op, params, PERIOD_NONE, timeOut...) diff --git a/ws/ws_pub_channel.go b/ws/ws_pub_channel.go index 7d23219..487e67c 100644 --- a/ws/ws_pub_channel.go +++ b/ws/ws_pub_channel.go @@ -2,11 +2,11 @@ package ws import ( "errors" - . "v5sdk_go/ws/wImpl" + . "github.com/eddddiez/OKEX_V5SDK_GO/ws/wImpl" ) /* - 产品频道 +产品频道 */ func (a *WsClient) PubInstruemnts(op string, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { @@ -18,7 +18,7 @@ func (a *WsClient) PubStatus(op string, timeOut ...int) (res bool, msg []*Msg, e } /* - 行情频道 +行情频道 */ func (a *WsClient) PubTickers(op string, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { @@ -26,14 +26,14 @@ func (a *WsClient) PubTickers(op string, params []map[string]string, timeOut ... } /* - 持仓总量频道 +持仓总量频道 */ func (a *WsClient) PubOpenInsterest(op string, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { return a.PubChannel(EVENT_BOOK_OPEN_INTEREST, op, params, PERIOD_NONE, timeOut...) } /* - K线频道 +K线频道 */ func (a *WsClient) PubKLine(op string, period Period, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { @@ -41,7 +41,7 @@ func (a *WsClient) PubKLine(op string, period Period, params []map[string]string } /* - 交易频道 +交易频道 */ func (a *WsClient) PubTrade(op string, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { @@ -49,7 +49,7 @@ func (a *WsClient) PubTrade(op string, params []map[string]string, timeOut ...in } /* - 预估交割/行权价格频道 +预估交割/行权价格频道 */ func (a *WsClient) PubEstDePrice(op string, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { @@ -58,7 +58,7 @@ func (a *WsClient) PubEstDePrice(op string, params []map[string]string, timeOut } /* - 标记价格频道 +标记价格频道 */ func (a *WsClient) PubMarkPrice(op string, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { @@ -66,7 +66,7 @@ func (a *WsClient) PubMarkPrice(op string, params []map[string]string, timeOut . } /* - 标记价格K线频道 +标记价格K线频道 */ func (a *WsClient) PubMarkPriceCandle(op string, pd Period, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { @@ -74,7 +74,7 @@ func (a *WsClient) PubMarkPriceCandle(op string, pd Period, params []map[string] } /* - 限价频道 +限价频道 */ func (a *WsClient) PubLimitPrice(op string, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { @@ -82,7 +82,7 @@ func (a *WsClient) PubLimitPrice(op string, params []map[string]string, timeOut } /* - 深度频道 +深度频道 */ func (a *WsClient) PubOrderBooks(op string, channel string, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { @@ -108,7 +108,7 @@ func (a *WsClient) PubOrderBooks(op string, channel string, params []map[string] } /* - 期权定价频道 +期权定价频道 */ func (a *WsClient) PubOptionSummary(op string, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { @@ -116,7 +116,7 @@ func (a *WsClient) PubOptionSummary(op string, params []map[string]string, timeO } /* - 资金费率频道 +资金费率频道 */ func (a *WsClient) PubFundRate(op string, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { @@ -124,7 +124,7 @@ func (a *WsClient) PubFundRate(op string, params []map[string]string, timeOut .. } /* - 指数K线频道 +指数K线频道 */ func (a *WsClient) PubKLineIndex(op string, pd Period, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { @@ -132,7 +132,7 @@ func (a *WsClient) PubKLineIndex(op string, pd Period, params []map[string]strin } /* - 指数行情频道 +指数行情频道 */ func (a *WsClient) PubIndexTickers(op string, params []map[string]string, timeOut ...int) (res bool, msg []*Msg, err error) { diff --git a/ws/ws_pub_channel_test.go b/ws/ws_pub_channel_test.go index 4e65a35..cab52fc 100644 --- a/ws/ws_pub_channel_test.go +++ b/ws/ws_pub_channel_test.go @@ -3,11 +3,11 @@ package ws import ( "encoding/json" "fmt" + . "github.com/eddddiez/OKEX_V5SDK_GO/ws/wImpl" "log" "strings" "testing" "time" - . "v5sdk_go/ws/wImpl" ) func prework() *WsClient { diff --git a/ws/ws_test.go b/ws/ws_test.go index aff6cbe..568054b 100644 --- a/ws/ws_test.go +++ b/ws/ws_test.go @@ -2,10 +2,10 @@ package ws import ( "fmt" + . "github.com/eddddiez/OKEX_V5SDK_GO/ws/wImpl" "log" "testing" "time" - . "v5sdk_go/ws/wImpl" "github.com/stretchr/testify/assert" ) @@ -218,7 +218,7 @@ func TestWsClient_Jrpc(t *testing.T) { } /* - 测试 添加全局消息回调函数 +测试 添加全局消息回调函数 */ func TestAddMessageHook(t *testing.T) { @@ -235,7 +235,7 @@ func TestAddMessageHook(t *testing.T) { } /* - 普通推送数据回调函数 +普通推送数据回调函数 */ func TestAddBookedDataHook(t *testing.T) { var r *WsClient @@ -313,7 +313,6 @@ func TestGetInfoFromErrMsg(t *testing.T) { } /* - */ func TestParseMessage(t *testing.T) { r := prework() @@ -329,7 +328,7 @@ func TestParseMessage(t *testing.T) { } /* - 原始方式 深度订阅 测试 +原始方式 深度订阅 测试 */ func TestSubscribeTBT(t *testing.T) { r := prework() @@ -361,7 +360,6 @@ func TestSubscribeTBT(t *testing.T) { } /* - */ func TestSubscribeBalAndPos(t *testing.T) { r := prework_pri(CROSS_ACCOUNT)