Skip to content

Commit

Permalink
refactor: Better name vars (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
gazbert committed Nov 30, 2024
1 parent 13a4aa4 commit e14734a
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
*
* <p>This adapter only supports the Coinbase Advanced Trade <a
* href="https://docs.cdp.coinbase.com/advanced-trade/docs/api-overview">REST API</a>. The design of
* the API and documentation is excellent.
* the Coinbase API and documentation is excellent.
*
* @author gazbert, davidhuertas
* @since 1.0
Expand All @@ -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";
Expand Down Expand Up @@ -140,24 +139,24 @@ public MarketOrderBook getMarketOrders(String marketId)
gson.fromJson(response.getPayload(), CoinbaseProductBookWrapper.class);

final List<MarketOrder> 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<MarketOrder> 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);
Expand Down

0 comments on commit e14734a

Please sign in to comment.