Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Add method for Current Average Price #423

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,11 @@ public interface BinanceApiAsyncRestClient {
* @param callback the callback that handles the response which contains a listenKey
*/
void closeUserDataStream(String listenKey, BinanceApiCallback<Void> callback);

/**
* Get current average price for a symbol <code>symbol</code> (asynchronous).
*
* @param symbol ticker symbol (e.g. ETHBTC)
*/
void getCurrentAveragePrice(String symbol);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.binance.api.client.domain.market;

import com.binance.api.client.constant.BinanceApiConstants;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.apache.commons.lang3.builder.ToStringBuilder;

@JsonIgnoreProperties(ignoreUnknown = true)
public class CurrentAveragePrice {

private Long mins;

private String price;

public Long getMins() {
return mins;
}

public void setMins(Long mins) {
this.mins = mins;
}

public String getPrice() {
return price;
}

public void setPrice(String price) {
this.price = price;
}

@Override
public String toString() {
return new ToStringBuilder(this, BinanceApiConstants.TO_STRING_BUILDER_STYLE)
.append("mins", mins)
.append("price", price)
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,9 @@ public void keepAliveUserDataStream(String listenKey, BinanceApiCallback<Void> c
public void closeUserDataStream(String listenKey, BinanceApiCallback<Void> callback) {
binanceApiService.closeAliveUserDataStream(listenKey).enqueue(new BinanceApiCallbackAdapter<>(callback));
}

@Override
public void getCurrentAveragePrice(String symbol) {
binanceApiService.getCurrentAveragePrice(symbol);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ Call<List<AggTrade>> getAggTrades(@Query("symbol") String symbol, @Query("fromId
Call<List<Candlestick>> getCandlestickBars(@Query("symbol") String symbol, @Query("interval") String interval, @Query("limit") Integer limit,
@Query("startTime") Long startTime, @Query("endTime") Long endTime);

@GET("/api/v3/avgPrice")
Call<CurrentAveragePrice> getCurrentAveragePrice(@Query("symbol") String symbol);

@GET("/api/v1/ticker/24hr")
Call<TickerStatistics> get24HrPriceStatistics(@Query("symbol") String symbol);

Expand Down