exchanges: Remove FTX implementation and fix minor test issues (#1100)

* exchanges: Start removal of FTX

* Get tests happy again

* okx: improve logic and add basic coverage

* Fix linterino

* Round 2 plus rm useless assignment in test

* Fix exchange_wrapper_issues test error

* Fix nitters

* Address nitters
This commit is contained in:
Adrian Gallagher
2023-01-25 16:40:04 +11:00
committed by GitHub
parent 05558aabfb
commit c785ae73a7
57 changed files with 211 additions and 9661 deletions

View File

@@ -173,7 +173,7 @@ The following is a screenshot of the relationship between relevant data history
| created | The date the job was created | `2020-01-01T13:33:37Z` |
| conversion_interval | When converting data as a job, this determines the resulting interval | `86400000000000` |
| overwrite_data | If data already exists, the setting allows you to overwrite it | `true` |
| secondary_exchange_id | For a `secondaryvalidatecandles` job, the exchange id of the exchange to compare data to | `ftx` |
| secondary_exchange_id | For a `secondaryvalidatecandles` job, the exchange id of the exchange to compare data to | `bybit` |
| decimal_place_comparison | When validating API candles, this will round the data to the supplied decimal point to check for equality | `3` |
| replace_on_issue | When there is an issue validating candles for a `validatecandles` job, the API data will overwrite the existing candle data | `false` |

View File

@@ -21,7 +21,6 @@ import (
"github.com/thrasher-corp/gocryptotrader/exchanges/coinbasepro"
"github.com/thrasher-corp/gocryptotrader/exchanges/coinut"
"github.com/thrasher-corp/gocryptotrader/exchanges/exmo"
"github.com/thrasher-corp/gocryptotrader/exchanges/ftx"
"github.com/thrasher-corp/gocryptotrader/exchanges/gateio"
"github.com/thrasher-corp/gocryptotrader/exchanges/gemini"
"github.com/thrasher-corp/gocryptotrader/exchanges/hitbtc"
@@ -175,8 +174,6 @@ func (m *ExchangeManager) NewExchangeByName(name string) (exchange.IBotExchange,
exch = new(exmo.EXMO)
case "coinbasepro":
exch = new(coinbasepro.CoinbasePro)
case "ftx":
exch = new(ftx.FTX)
case "gateio":
exch = new(gateio.Gateio)
case "gemini":

View File

@@ -82,7 +82,7 @@ func TestExchangeManagerRemoveExchange(t *testing.T) {
func TestNewExchangeByName(t *testing.T) {
m := SetupExchangeManager()
exchanges := []string{"binanceus", "binance", "bitfinex", "bitflyer", "bithumb", "bitmex", "bitstamp", "bittrex", "btc markets", "btse", "bybit", "coinut", "exmo", "coinbasepro", "ftx", "gateio", "gemini", "hitbtc", "huobi", "itbit", "kraken", "lbank", "localbitcoins", "okcoin international", "okx", "poloniex", "yobit", "zb", "fake"}
exchanges := []string{"binanceus", "binance", "bitfinex", "bitflyer", "bithumb", "bitmex", "bitstamp", "bittrex", "btc markets", "btse", "bybit", "coinut", "exmo", "coinbasepro", "gateio", "gemini", "hitbtc", "huobi", "itbit", "kraken", "lbank", "localbitcoins", "okcoin international", "okx", "poloniex", "yobit", "zb", "fake"}
for i := range exchanges {
exch, err := m.NewExchangeByName(exchanges[i])
if err != nil && exchanges[i] != "fake" {

View File

@@ -1482,7 +1482,7 @@ func TestGetOpenFuturesPosition(t *testing.T) {
}
em := SetupExchangeManager()
exch, err := em.NewExchangeByName("ftx")
exch, err := em.NewExchangeByName("binance")
if err != nil {
t.Fatal(err)
}
@@ -1558,7 +1558,7 @@ func TestProcessFuturesPositions(t *testing.T) {
t.Errorf("received '%v', expected '%v'", err, errFuturesTrackingDisabled)
}
em := SetupExchangeManager()
exch, err := em.NewExchangeByName("ftx")
exch, err := em.NewExchangeByName("binance")
if err != nil {
t.Fatal(err)
}
@@ -1639,7 +1639,7 @@ func TestProcessFuturesPositions(t *testing.T) {
position.Orders[0].AssetType = asset.Futures
position.Asset = asset.Futures
err = o.processFuturesPositions(fakeExchange, position)
if !errors.Is(err, nil) {
t.Errorf("received '%v', expected '%v'", err, nil)
if !errors.Is(err, common.ErrNotYetImplemented) {
t.Errorf("received '%v', expected '%v'", err, common.ErrNotYetImplemented)
}
}

View File

@@ -2210,7 +2210,7 @@ func TestCurrencyStateTradingPair(t *testing.T) {
func TestGetFuturesPositions(t *testing.T) {
t.Parallel()
em := SetupExchangeManager()
exch, err := em.NewExchangeByName("ftx")
exch, err := em.NewExchangeByName("binance")
if err != nil {
t.Fatal(err)
}
@@ -2873,8 +2873,9 @@ func TestGetMarginRatesHistory(t *testing.T) {
func TestGetFundingRates(t *testing.T) {
t.Parallel()
em := SetupExchangeManager()
exch, err := em.NewExchangeByName("ftx")
exch, err := em.NewExchangeByName("binance")
if err != nil {
t.Fatal(err)
}
@@ -2966,7 +2967,7 @@ func TestGetFundingRates(t *testing.T) {
func TestGetManagedPosition(t *testing.T) {
t.Parallel()
em := SetupExchangeManager()
exch, err := em.NewExchangeByName("ftx")
exch, err := em.NewExchangeByName("binance")
if err != nil {
t.Fatal(err)
}
@@ -3103,8 +3104,9 @@ func TestGetManagedPosition(t *testing.T) {
func TestGetAllManagedPositions(t *testing.T) {
t.Parallel()
em := SetupExchangeManager()
exch, err := em.NewExchangeByName("ftx")
exch, err := em.NewExchangeByName("binance")
if err != nil {
t.Fatal(err)
}
@@ -3211,7 +3213,7 @@ func TestGetAllManagedPositions(t *testing.T) {
func TestGetOrderbookMovement(t *testing.T) {
t.Parallel()
em := SetupExchangeManager()
exch, err := em.NewExchangeByName("ftx")
exch, err := em.NewExchangeByName("binance")
if err != nil {
t.Fatal(err)
}
@@ -3318,7 +3320,7 @@ func TestGetOrderbookMovement(t *testing.T) {
func TestGetOrderbookAmountByNominal(t *testing.T) {
t.Parallel()
em := SetupExchangeManager()
exch, err := em.NewExchangeByName("ftx")
exch, err := em.NewExchangeByName("binance")
if err != nil {
t.Fatal(err)
}
@@ -3418,7 +3420,7 @@ func TestGetOrderbookAmountByNominal(t *testing.T) {
func TestGetOrderbookAmountByImpact(t *testing.T) {
t.Parallel()
em := SetupExchangeManager()
exch, err := em.NewExchangeByName("ftx")
exch, err := em.NewExchangeByName("binance")
if err != nil {
t.Fatal(err)
}

View File

@@ -10,20 +10,20 @@ import (
"github.com/thrasher-corp/gocryptotrader/common"
"github.com/thrasher-corp/gocryptotrader/currency"
exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
"github.com/thrasher-corp/gocryptotrader/exchanges/binance"
"github.com/thrasher-corp/gocryptotrader/exchanges/bybit"
"github.com/thrasher-corp/gocryptotrader/portfolio"
"github.com/thrasher-corp/gocryptotrader/portfolio/banking"
"github.com/thrasher-corp/gocryptotrader/portfolio/withdraw"
)
const (
exchangeName = "Binance"
exchangeName = "Bybit"
)
func withdrawManagerTestHelper(t *testing.T) (*ExchangeManager, *portfolioManager) {
t.Helper()
em := SetupExchangeManager()
b := new(binance.Binance)
b := new(bybit.Bybit)
b.SetDefaults()
cfg, err := b.GetDefaultConfig()
if err != nil {