From e14734aa530f10437df4c9f6f13333ff125dbdf9 Mon Sep 17 00:00:00 2001 From: gazbert Date: Sat, 30 Nov 2024 23:30:43 +0000 Subject: [PATCH] refactor: Better name vars (#165) --- .../exchanges/CoinbaseExchangeAdapter.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/bxbot-exchanges/src/main/java/com/gazbert/bxbot/exchanges/CoinbaseExchangeAdapter.java b/bxbot-exchanges/src/main/java/com/gazbert/bxbot/exchanges/CoinbaseExchangeAdapter.java index 8ea5624f..d8838115 100644 --- a/bxbot-exchanges/src/main/java/com/gazbert/bxbot/exchanges/CoinbaseExchangeAdapter.java +++ b/bxbot-exchanges/src/main/java/com/gazbert/bxbot/exchanges/CoinbaseExchangeAdapter.java @@ -59,7 +59,7 @@ * *

This adapter only supports the Coinbase Advanced Trade REST API. The design of - * the API and documentation is excellent. + * the Coinbase API and documentation is excellent. * * @author gazbert, davidhuertas * @since 1.0 @@ -68,7 +68,6 @@ public class CoinbaseExchangeAdapter extends AbstractExchangeAdapter implements ExchangeAdapter { private static final String EXCHANGE_ADAPTER_NAME = "Coinbase Advanced Trade REST API v3"; - private static final String PUBLIC_API_BASE_URL = "https://api.coinbase.com/api/v3/brokerage"; private static final String PRODUCT_BOOK = "/market/product_book"; @@ -140,24 +139,24 @@ public MarketOrderBook getMarketOrders(String marketId) gson.fromJson(response.getPayload(), CoinbaseProductBookWrapper.class); final List buyOrders = new ArrayList<>(); - for (CoinbasePriceBookOrder coinbaseProBuyOrder : productBookWrapper.pricebook.bids) { + for (CoinbasePriceBookOrder coinbasePricebookBid : productBookWrapper.pricebook.bids) { final MarketOrder buyOrder = new MarketOrderImpl( OrderType.BUY, - coinbaseProBuyOrder.price, - coinbaseProBuyOrder.size, - coinbaseProBuyOrder.price.multiply(coinbaseProBuyOrder.size)); + coinbasePricebookBid.price, + coinbasePricebookBid.size, + coinbasePricebookBid.price.multiply(coinbasePricebookBid.size)); buyOrders.add(buyOrder); } final List sellOrders = new ArrayList<>(); - for (CoinbasePriceBookOrder coinbaseProSellOrder : productBookWrapper.pricebook.asks) { + for (CoinbasePriceBookOrder coinbasePricebookAsk : productBookWrapper.pricebook.asks) { final MarketOrder sellOrder = new MarketOrderImpl( OrderType.SELL, - coinbaseProSellOrder.price, - coinbaseProSellOrder.size, - coinbaseProSellOrder.price.multiply(coinbaseProSellOrder.size)); + coinbasePricebookAsk.price, + coinbasePricebookAsk.size, + coinbasePricebookAsk.price.multiply(coinbasePricebookAsk.size)); sellOrders.add(sellOrder); } return new MarketOrderBookImpl(marketId, sellOrders, buyOrders);