mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-17 23:16:52 +00:00
* init * surprise train commit * basic distinctions * the terms of binance are confusing * renames and introduction of allocatedMargin * add new margin funcs * pulling out wires * implement proper getposition stuff * bad coding day * investigate order manager next * a broken mess, but a progressing one * finally completes some usdtmargined stuff * coinMfutures eludes me * expand to okx * imports fix * completes okx wrapper implementations * cleans and polishes before rpc implementations * rpc setup, order manager features, exch features * more rpc, collateral and margin things * mini test * looking at rpc response, expansion of features * reorganising before the storm * changing how futures requests work * cleanup and tests of cli usage * remove silly client side logic * cleanup * collateral package, typo fix, margin err, rpc derive * uses convert.StringToFloat ONLY ON STRUCTS FROM THIS PR * fix binance order history bug * niteroos * adds new funcs to exchange standards testing * more post merge fixes * fix binance * replace simepletimeformat * fix for merge * merge fixes * micro fixes * order side now required for leverage * fix up the rest * global -> portfolio collateral * Update exchanges/collateral/collateral_test.go Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io> * adds fields and todos * rm field redundancy * lint fix oopsie daisy * fixes panic, expands error and cli explanations (sorry shaz) * ensures casing is appropriate for underlying * Adds a shiny TODO --------- Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
65 lines
1.8 KiB
Go
65 lines
1.8 KiB
Go
//go:build mock_test_off
|
|
|
|
// This will build if build tag mock_test_off is parsed and will do live testing
|
|
// using all tests in (exchange)_test.go
|
|
package binance
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/thrasher-corp/gocryptotrader/config"
|
|
exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/request"
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues"
|
|
)
|
|
|
|
var mockTests = false
|
|
|
|
func TestMain(m *testing.M) {
|
|
cfg := config.GetConfig()
|
|
err := cfg.LoadConfig("../../testdata/configtest.json", true)
|
|
if err != nil {
|
|
log.Fatal("Binance load config error", err)
|
|
}
|
|
binanceConfig, err := cfg.GetExchangeConfig("Binance")
|
|
if err != nil {
|
|
log.Fatal("Binance Setup() init error", err)
|
|
}
|
|
|
|
binanceConfig.API.AuthenticatedSupport = true
|
|
binanceConfig.API.Credentials.Key = apiKey
|
|
binanceConfig.API.Credentials.Secret = apiSecret
|
|
b.SetDefaults()
|
|
b.Websocket = sharedtestvalues.NewTestWebsocket()
|
|
if useTestNet {
|
|
err = b.API.Endpoints.SetRunning(exchange.RestUSDTMargined.String(), testnetFutures)
|
|
if err != nil {
|
|
log.Fatal("Binance setup error", err)
|
|
}
|
|
err = b.API.Endpoints.SetRunning(exchange.RestCoinMargined.String(), testnetFutures)
|
|
if err != nil {
|
|
log.Fatal("Binance setup error", err)
|
|
}
|
|
err = b.API.Endpoints.SetRunning(exchange.RestSpot.String(), testnetSpotURL)
|
|
if err != nil {
|
|
log.Fatal("Binance setup error", err)
|
|
}
|
|
}
|
|
err = b.Setup(binanceConfig)
|
|
if err != nil {
|
|
log.Fatal("Binance setup error", err)
|
|
}
|
|
b.setupOrderbookManager()
|
|
request.MaxRequestJobs = 100
|
|
b.Websocket.DataHandler = sharedtestvalues.GetWebsocketInterfaceChannelOverride()
|
|
log.Printf(sharedtestvalues.LiveTesting, b.Name)
|
|
err = b.UpdateTradablePairs(context.Background(), true)
|
|
if err != nil {
|
|
log.Fatal("Binance setup error", err)
|
|
}
|
|
os.Exit(m.Run())
|
|
}
|