Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
sort exchanges based on what is tested first
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilsaraf committed Mar 28, 2019
1 parent de12bfe commit 8d6d450
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions plugins/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,26 +193,32 @@ func loadExchanges() {
},
}

// add all CCXT exchanges
sortOrderOffset := len(*exchanges)
for i, exchangeName := range sdk.GetExchangeList() {
key := fmt.Sprintf("ccxt-%s", exchangeName)
_, tested := testedCcxtExchanges[exchangeName]
boundExchangeName := exchangeName
// add all CCXT exchanges (tested exchanges first)
sortOrderIndex := len(*exchanges)
for _, t := range []bool{true, false} {
for _, exchangeName := range sdk.GetExchangeList() {
key := fmt.Sprintf("ccxt-%s", exchangeName)
_, tested := testedCcxtExchanges[exchangeName]
if tested != t {
continue
}
boundExchangeName := exchangeName

(*exchanges)[key] = ExchangeContainer{
SortOrder: uint16(i + sortOrderOffset),
Description: exchangeName + " is automatically added via ccxt-rest",
TradeEnabled: true,
Tested: tested,
makeFn: func(exchangeFactoryData exchangeFactoryData) (api.Exchange, error) {
return makeCcxtExchange(
boundExchangeName,
nil,
exchangeFactoryData.apiKeys,
exchangeFactoryData.simMode,
)
},
(*exchanges)[key] = ExchangeContainer{
SortOrder: uint16(sortOrderIndex),
Description: exchangeName + " is automatically added via ccxt-rest",
TradeEnabled: true,
Tested: tested,
makeFn: func(exchangeFactoryData exchangeFactoryData) (api.Exchange, error) {
return makeCcxtExchange(
boundExchangeName,
nil,
exchangeFactoryData.apiKeys,
exchangeFactoryData.simMode,
)
},
}
sortOrderIndex++
}
}
}
Expand Down

0 comments on commit 8d6d450

Please sign in to comment.