Daily engine changes

1) Although gRPC does server side validation currently, validate basic things
on gctcli before relaying the request to the gRPC server
2) Make pair format consistent for the exchange sycner
3) Fix OKEX ticker failure due to thinking futures info is authenticated
4) Start filling out config tests
5) Extend timeout for golangci config so that AppVeyor has time to
complete (Travis is fine)
6) Add IsSupported exchange func for easy lookup
This commit is contained in:
Adrian Gallagher
2019-09-10 17:07:00 +10:00
parent 0824ee04c9
commit e8b517ef0a
11 changed files with 490 additions and 174 deletions

View File

@@ -207,7 +207,7 @@ func (o *OKEX) GetFuturesOrderBook(request okgroup.GetFuturesOrderBookRequest) (
// GetAllFuturesTokenInfo Get the last traded price, best bid/ask price, 24 hour trading volume and more info of all contracts.
func (o *OKEX) GetAllFuturesTokenInfo() (resp []okgroup.GetFuturesTokenInfoResponse, _ error) {
requestURL := fmt.Sprintf("%v/%v", okgroup.OKGroupInstruments, okgroup.OKGroupTicker)
return resp, o.SendHTTPRequest(http.MethodGet, okGroupFuturesSubsection, requestURL, nil, &resp, true)
return resp, o.SendHTTPRequest(http.MethodGet, okGroupFuturesSubsection, requestURL, nil, &resp, false)
}
// GetFuturesTokenInfoForCurrency Get the last traded price, best bid/ask price, 24 hour trading volume and more info of a contract.

View File

@@ -1045,7 +1045,9 @@ func TestGetAllFuturesTokenInfo(t *testing.T) {
TestSetDefaults(t)
t.Parallel()
_, err := o.GetAllFuturesTokenInfo()
testStandardErrorHandling(t, err)
if err != nil {
t.Error(err)
}
}
// TestGetAllFuturesTokenInfo API endpoint test

View File

@@ -1,5 +1,17 @@
package exchange
import "strings"
// IsSupported returns whether or not a specific exchange is supported
func IsSupported(exchangeName string) bool {
for x := range Exchanges {
if strings.EqualFold(exchangeName, Exchanges[x]) {
return true
}
}
return false
}
// Exchanges stores a list of supported exchanges
var Exchanges = []string{
"anx",

13
exchanges/support_test.go Normal file
View File

@@ -0,0 +1,13 @@
package exchange
import "testing"
func TestIsSupported(t *testing.T) {
if ok := IsSupported("BiTStaMp"); !ok {
t.Error("supported exchange should be valid")
}
if ok := IsSupported("meowexch"); ok {
t.Error("non-supported exchange should be in valid")
}
}