okx: GetDefaultConfig fix & ticker field improvements (#1227)

* okx: updaterooo (cherry pick)

* okx: add in target currency handling in spot market orders

* okx:don't adjust order.Submit variables.

* spell checker

* okx_wrapper: updateTradablePairs true bool

* thrasher: nits

* purge default env vars

* point to CI env var

* print out environment

* lol

---------

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
This commit is contained in:
Ryan O'Hara-Reid
2023-06-19 15:58:58 +10:00
committed by GitHub
parent 92839ebaa2
commit 17cefe6956
5 changed files with 68 additions and 9 deletions

View File

@@ -1,12 +1,15 @@
package engine
import (
"context"
"errors"
"os"
"testing"
"time"
"github.com/thrasher-corp/gocryptotrader/common"
"github.com/thrasher-corp/gocryptotrader/config"
exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
)
func TestLoadConfigWithSettings(t *testing.T) {
@@ -338,3 +341,42 @@ func TestSettingsPrint(t *testing.T) {
s = &Settings{}
s.PrintLoadedSettings()
}
func TestGetDefaultConfigurations(t *testing.T) {
t.Parallel()
man := NewExchangeManager()
for x := range exchange.Exchanges {
target := exchange.Exchanges[x]
t.Run(target, func(t *testing.T) {
t.Parallel()
exch, err := man.NewExchangeByName(target)
if err != nil {
t.Fatal(err)
}
if isCITest() && common.StringDataContains(blockedCIExchanges, target) {
t.Skipf("skipping %s due to CI test restrictions", target)
}
cfg, err := exch.GetDefaultConfig(context.Background())
if err != nil {
t.Fatal(err)
}
if cfg == nil {
t.Fatal("expected config")
}
})
}
}
func isCITest() bool {
ci := os.Getenv("CI")
return ci == "true" /* github actions */ || ci == "True" /* appveyor */
}
// blockedCIExchanges are exchanges that are not able to be tested on CI
var blockedCIExchanges = []string{
"binance", // binance API is banned from executing within the US where github Actions is ran
}