github.com/frankrap/okex-api@v1.0.4/README.md (about)

     1  # okex-api
     2  OKEx Open API V3 SDK (Golang Version)
     3  
     4  -----
     5  
     6  ### 1.Downloads or updates OKEX code's dependencies, in your command line:
     7  
     8  ```
     9  go get -u github.com/frankrap/okex-api
    10  ```
    11  ### 2.Write the go file. warm tips: test go file, must suffix *_test.go, eg: okex_open_api_v3_test.go
    12  ```
    13  package gotest
    14  
    15  import (
    16  	"fmt"
    17  	"github.com/frankrap/okex-api"
    18  	"testing"
    19  )
    20  
    21  func TestOKExServerTime(t *testing.T) {
    22  	serverTime, err := okex.NewOKExClient().GetServerTime()
    23  	if err != nil {
    24  		t.Error(err)
    25  	}
    26  	fmt.Println("OKEx's server time: ", serverTime)
    27  }
    28  
    29  func NewOKExClient() *okex.Client {
    30  	var config okex.Config
    31  	config.Endpoint = "https://www.okex.com/"
    32  	config.ApiKey = ""
    33  	config.SecretKey = ""
    34  	config.Passphrase = ""
    35  	config.TimeoutSecond = 45
    36  	config.IsPrint = true
    37  	config.I18n = okex.ENGLISH
    38  
    39  	client := okex.NewClient(config)
    40  	return client
    41  }
    42  ```
    43  ### 3. run test go:
    44  ```
    45  go test -v -run TestOKExServerTime okex_open_api_v3_test.go
    46  ```