Skip to content

Commit

Permalink
[bybit-stream] fix, add CumRealisedPnl
Browse files Browse the repository at this point in the history
  • Loading branch information
rizer1980 committed Oct 16, 2024
1 parent d82616f commit 6fb1934
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@Getter
@Setter
@ToString
@ToString(callSuper = true)
public class BybitComplexPositionChanges extends OpenPosition {

private int positionIdx;
Expand All @@ -29,6 +29,7 @@ public class BybitComplexPositionChanges extends OpenPosition {
private BigDecimal stopLoss;
private BigDecimal trailingStop;
private BigDecimal curRealisedPnl;
private BigDecimal cumRealisedPnl;
private BigDecimal sessionAvgPrice; //USDC contract session avg price
private String positionStatus;
private int adlRankIndicator;
Expand All @@ -42,14 +43,15 @@ public class BybitComplexPositionChanges extends OpenPosition {
public BybitComplexPositionChanges(Instrument instrument, Type type, BigDecimal size,
BigDecimal liquidationPrice, BigDecimal unRealisedPnl,
BigDecimal positionValue, BigDecimal entryPrice, BigDecimal leverage, BigDecimal takeProfit,
BigDecimal stopLoss, BigDecimal curRealisedPnl, long createdTime, long updatedTime,
BigDecimal stopLoss, BigDecimal curRealisedPnl, BigDecimal cumRealisedPnl,long createdTime, long updatedTime,
long seq) {
super(instrument, type, size, entryPrice, liquidationPrice, unRealisedPnl);
this.positionValue = positionValue;
this.leverage = leverage;
this.takeProfit = takeProfit;
this.stopLoss = stopLoss;
this.curRealisedPnl = curRealisedPnl;
this.cumRealisedPnl = cumRealisedPnl;
this.createdTime = createdTime;
this.updatedTime = updatedTime;
this.seq = seq;
Expand Down Expand Up @@ -80,6 +82,7 @@ public BybitComplexPositionChanges(BybitComplexPositionChanges changes) {
this.stopLoss = changes.stopLoss;
this.trailingStop = changes.trailingStop;
this.curRealisedPnl = changes.curRealisedPnl;
this.cumRealisedPnl = changes.cumRealisedPnl;
this.sessionAvgPrice = changes.sessionAvgPrice;
this.positionStatus = changes.positionStatus;
this.adlRankIndicator = changes.adlRankIndicator;
Expand All @@ -97,7 +100,7 @@ public BybitComplexPositionChanges(Instrument instrument, Type type, BigDecimal
BigDecimal positionBalance, int autoAddMargin, BigDecimal positionMM, BigDecimal positionIM,
BigDecimal bustPrice, BigDecimal positionValue, BigDecimal leverage,
BigDecimal takeProfit, BigDecimal stopLoss, BigDecimal trailingStop,
BigDecimal curRealisedPnl,
BigDecimal curRealisedPnl,BigDecimal cumRealisedPnl,
BigDecimal sessionAvgPrice, String positionStatus, int adlRankIndicator, boolean isReduceOnly,
String mmrSysUpdatedTime, String leverageSysUpdatedTime, long createdTime, long updatedTime,
long seq) {
Expand All @@ -118,6 +121,7 @@ public BybitComplexPositionChanges(Instrument instrument, Type type, BigDecimal
this.stopLoss = stopLoss;
this.trailingStop = trailingStop;
this.curRealisedPnl = curRealisedPnl;
this.cumRealisedPnl = cumRealisedPnl;
this.sessionAvgPrice = sessionAvgPrice;
this.positionStatus = positionStatus;
this.adlRankIndicator = adlRankIndicator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ bustPrice, new BigDecimal(position.getPositionValue()),
new BigDecimal(position.getLeverage()),
new BigDecimal(position.getTakeProfit()), new BigDecimal(position.getStopLoss()),
new BigDecimal(position.getTrailingStop()),
new BigDecimal(position.getCurRealisedPnl()),
new BigDecimal(position.getCurRealisedPnl()),new BigDecimal(position.getCumRealisedPnl()),
sessionAvgPrice, position.getPositionStatus(),
position.getAdlRankIndicator(), position.isReduceOnly(),
position.getMmrSysUpdatedTime(), position.getLeverageSysUpdatedTime(),
Expand Down

0 comments on commit 6fb1934

Please sign in to comment.