Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add KuCoin exchange #50

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ known-xchange-coinone = { module = 'org.knowm.xchange:xchange-coinone', version.
known-xchange-independentreserve = { module = 'org.knowm.xchange:xchange-independentreserve', version.ref = 'knowm-xchange-lib' }
known-xchange-kraken = { module = 'org.knowm.xchange:xchange-kraken', version.ref = 'knowm-xchange-lib' }
known-xchange-luno = { module = 'org.knowm.xchange:xchange-luno', version.ref = 'knowm-xchange-lib' }
known-xchange-kucoin = { module = 'org.knowm.xchange:xchange-kucoin', version.ref = 'knowm-xchange-lib' }
known-xchange-mercadobitcoin = { module = 'org.knowm.xchange:xchange-mercadobitcoin', version.ref = 'knowm-xchange-lib' }
known-xchange-paribu = { module = 'org.knowm.xchange:xchange-paribu', version.ref = 'knowm-xchange-lib' }
logback-core = { module = 'ch.qos.logback:logback-core', version.ref = 'logback-lib' }
Expand All @@ -45,7 +46,7 @@ knowm-xchange-libs = [
'knowm-xchange-binance', 'known-xchange-bitfinex',
'known-xchange-bitflyer', 'known-xchange-bitstamp', 'known-xchange-btcmarkets',
'known-xchange-coinbasepro', 'known-xchange-coinone',
'known-xchange-independentreserve',
'known-xchange-independentreserve','known-xchange-kucoin',
'known-xchange-kraken', 'known-xchange-luno', 'known-xchange-mercadobitcoin', 'known-xchange-paribu'
]

Expand Down
46 changes: 46 additions & 0 deletions src/main/java/bisq/price/spot/providers/KuCoin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/

package bisq.price.spot.providers;

import bisq.price.spot.ExchangeRate;
import bisq.price.spot.ExchangeRateProvider;

import org.knowm.xchange.kucoin.KucoinExchange;

import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

import java.time.Duration;

import java.util.Set;

@Component
class KuCoin extends ExchangeRateProvider {

public KuCoin(Environment env) {
super(env, "KUCOIN", "kucoin", Duration.ofMinutes(1));
}

@Override
public Set<ExchangeRate> doGet() {
// Supported fiat: EUR, BRL, GBP
// Supported alts: - DASH, DCR, DOGE, ERG, ETC, ETH, LTC, UNO, XMR, ZEC
// Supported alts: - DAI, TUSD, USDC, USDT
return doGet(KucoinExchange.class);
}
}
33 changes: 33 additions & 0 deletions src/test/java/bisq/price/spot/providers/KuCoinTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/

package bisq.price.spot.providers;

import bisq.price.AbstractExchangeRateProviderTest;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.core.env.StandardEnvironment;

@Slf4j
public class KuCoinTest extends AbstractExchangeRateProviderTest {

@Test
public void doGet_successfulCall() {
doGet_successfulCall(new KuCoin(new StandardEnvironment()));
}

}