Skip to content

Commit

Permalink
Merge Coinbase Pro exchange adapter to master (#134)
Browse files Browse the repository at this point in the history
* Merge David Huertas Coinbase Pro exchange adapter work into new coinbase-pro feature branch (#133)

* Created Coinbase Pro Exchange Adapter (#1)

* Added PowerMock tests to Coinbase Pro ExchangeAdapter, version working, closes #1

Co-authored-by: David Huertas <[email protected]>

* #132 : Updated Travis badge

* #132 : Exclude SpotBugs false positives + checkstyle fixes

* #132 : Removed deprecated OKCoin exchange adapter

* #132 : Added Coinbase Pro adapter to Gradle coverage exclusions

* #132 : Add author to MIT

* #132 : Added IT test

* #132 : README update

* #132 : README tweak

* #132 : Removed GDAX code + config; added CoinbasePro sample config

* #132 : Corrected location of time-server-bias config

Co-authored-by: David Huertas <[email protected]>
  • Loading branch information
gazbert and DavidHuertas committed Feb 6, 2021
1 parent a0a6a40 commit b843cbb
Show file tree
Hide file tree
Showing 40 changed files with 267 additions and 4,624 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BX-bot

[![Build Status](https://travis-ci.com/gazbert/bxbot.svg?branch=master)](https://travis-ci.com/gazbert/bxbot)
[![Build Status](https://travis-ci.com/gazbert/bxbot.svg?branch=coinbase-pro)](https://travis-ci.com/gazbert/bxbot)
[![Sonarcloud Status](https://sonarcloud.io/api/project_badges/measure?project=gazbert_bxbot&metric=alert_status)](https://sonarcloud.io/dashboard?id=gazbert_bxbot)
[![Join the chat at https://gitter.im/BX-bot/Lobby](https://badges.gitter.im/BX-bot/Lobby.svg)](https://gitter.im/BX-bot/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Expand All @@ -18,7 +18,8 @@ except for the trading strategies - you'll need to write those yourself! A simpl
Trading API - take a look [here](https://github.com/ta4j/ta4j) for more ideas.

Exchange Adapters for using [Bitstamp](https://www.bitstamp.net), [Bitfinex](https://www.bitfinex.com),
[itBit](https://www.itbit.com/), [Kraken](https://www.kraken.com), and [Gemini](https://gemini.com/) are included.
[itBit](https://www.itbit.com/), [Kraken](https://www.kraken.com), [Gemini](https://gemini.com/),
and [Coinbase Pro](https://pro.coinbase.com/) are included.
Feel free to improve these or contribute new adapters to the project; that would be
[shiny!](https://en.wikipedia.org/wiki/Firefly_(TV_series))

Expand Down
3 changes: 1 addition & 2 deletions bxbot-exchanges/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,12 @@ jacocoTestCoverageVerification {
excludes = [
'com.gazbert.bxbot.exchanges.BitfinexExchangeAdapter*',
'com.gazbert.bxbot.exchanges.BitstampExchangeAdapter*',
'com.gazbert.bxbot.exchanges.GdaxExchangeAdapter*',
'com.gazbert.bxbot.exchanges.GeminiExchangeAdapter*',
'com.gazbert.bxbot.exchanges.ItBitExchangeAdapter*',
'com.gazbert.bxbot.exchanges.KrakenExchangeAdapter*',
'com.gazbert.bxbot.exchanges.OkCoinExchangeAdapter*',
'com.gazbert.bxbot.exchanges.TestExchangeAdapter*',
'com.gazbert.bxbot.exchanges.AbstractExchangeAdapter*',
'com.gazbert.bxbot.exchanges.CoinbaseProExchangeAdapter*',
]
limit {
counter = 'LINE'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 Gareth Jon Lynch
* Copyright (c) 2021 Gareth Jon Lynch
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
Expand Down Expand Up @@ -47,15 +47,11 @@
import org.junit.Test;

/**
* Basic integration testing with GDAX exchange.
*
* <p>DO NOT USE: See https://github.com/gazbert/bxbot/pull/120
* Basic integration testing with Coinbase Pro exchange.
*
* @author gazbert
* @deprecated #120 : GDAX exchange has been superseded by Coinbase Pro: https://pro.coinbase.com/
*/
@Deprecated(forRemoval = true)
public class GdaxIT {
public class CoinbaseProIT {

private static final String MARKET_ID = "BTC-GBP";
private static final BigDecimal BUY_ORDER_PRICE = new BigDecimal("450.176");
Expand Down Expand Up @@ -92,6 +88,7 @@ public void setupForEachTest() {
otherConfig = createMock(OtherConfig.class);
expect(otherConfig.getItem("buy-fee")).andReturn("0.25");
expect(otherConfig.getItem("sell-fee")).andReturn("0.25");
expect(otherConfig.getItem("time-server-bias")).andReturn("1");

exchangeConfig = createMock(ExchangeConfig.class);
expect(exchangeConfig.getAuthenticationConfig()).andReturn(authenticationConfig);
Expand All @@ -103,7 +100,7 @@ public void setupForEachTest() {
public void testPublicApiCalls() throws Exception {
replay(authenticationConfig, networkConfig, otherConfig, exchangeConfig);

final ExchangeAdapter exchangeAdapter = new GdaxExchangeAdapter();
final ExchangeAdapter exchangeAdapter = new CoinbaseProExchangeAdapter();
exchangeAdapter.init(exchangeConfig);

assertNotNull(exchangeAdapter.getLatestMarketPrice(MARKET_ID));
Expand All @@ -120,7 +117,7 @@ public void testPublicApiCalls() throws Exception {
assertNotNull(ticker.getLow());
assertNotNull(ticker.getOpen());
assertNotNull(ticker.getVolume());
assertNull(ticker.getVwap()); // not provided by GDAX
assertNull(ticker.getVwap()); // not provided by Coinbase Pro
assertNotNull(ticker.getTimestamp());

verify(authenticationConfig, networkConfig, otherConfig, exchangeConfig);
Expand All @@ -134,7 +131,7 @@ public void testPublicApiCalls() throws Exception {
public void testAuthenticatedApiCalls() throws Exception {
replay(authenticationConfig, networkConfig, otherConfig, exchangeConfig);

final ExchangeAdapter exchangeAdapter = new GdaxExchangeAdapter();
final ExchangeAdapter exchangeAdapter = new CoinbaseProExchangeAdapter();
exchangeAdapter.init(exchangeConfig);

final BalanceInfo balanceInfo = exchangeAdapter.getBalanceInfo();
Expand Down

This file was deleted.

Loading

0 comments on commit b843cbb

Please sign in to comment.