XChange is a Java library providing a streamlined API for interacting with 60+ Bitcoin and Altcoin exchanges providing a consistent interface for trading and accessing market data.
Hi,
the getOpenPositions for coin based positions will display in the notional amoutns i.e. number of contracts * multiplier but for the usdt based positions it will display contracts.
I suggest we always display contract position by changing this
public static OpenPositions adaptOpenPositions(OkexResponse<List<OkexPosition>> positions, ExchangeMetaData exchangeMetaData) {
List<OpenPosition> openPositions = new ArrayList<>();
positions.getData().forEach(okexPosition -> openPositions.add(
new OpenPosition.Builder().instrument(adaptOkexInstrumentId(okexPosition.getInstrumentId()))
.liquidationPrice(okexPosition.getLiquidationPrice()).price(okexPosition.getAverageOpenPrice()).type(adaptOpenPositionType(okexPosition))
.size(okexPosition.getPosition().abs()
.multiply(exchangeMetaData.getInstruments().get(adaptOkexInstrumentId(okexPosition.getInstrumentId())).getContractValue()))
.unRealisedPnl(okexPosition.getUnrealizedPnL()).build()));
return new OpenPositions(openPositions);
}
to
public static OpenPositions adaptOpenPositions(OkexResponse<List<OkexPosition>> positions, ExchangeMetaData exchangeMetaData) {
List<OpenPosition> openPositions = new ArrayList<>();
positions.getData().forEach(okexPosition -> openPositions.add(
new OpenPosition.Builder().instrument(adaptOkexInstrumentId(okexPosition.getInstrumentId()))
.liquidationPrice(okexPosition.getLiquidationPrice()).price(okexPosition.getAverageOpenPrice()).type(adaptOpenPositionType(okexPosition))
.size(okexPosition.getPosition())
.unRealisedPnl(okexPosition.getUnrealizedPnL()).build()));
return new OpenPositions(openPositions);
}}
Hi, the getOpenPositions for coin based positions will display in the notional amoutns i.e. number of contracts * multiplier but for the usdt based positions it will display contracts.
I suggest we always display contract position by changing this
to