|
| 1 | +/** |
| 2 | + * Copyright 2022 Nord Pool. |
| 3 | + * This library is intended to aid integration with Nord Pool’s Intraday API and comes without any warranty. Users of this library are responsible for separately testing and ensuring that it works according to their own standards. |
| 4 | + * Please send feedback to idapi@nordpoolgroup.com. |
| 5 | + */ |
| 6 | + |
| 7 | +package com.nordpool.id.publicapi.v1.statistic; |
| 8 | + |
| 9 | +import java.time.ZonedDateTime; |
| 10 | +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
| 11 | +import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| 12 | +import org.apache.commons.lang3.builder.EqualsBuilder; |
| 13 | +import org.apache.commons.lang3.builder.HashCodeBuilder; |
| 14 | +import org.apache.commons.lang3.builder.ToStringBuilder; |
| 15 | + |
| 16 | +/** |
| 17 | + * Represents aggregated private statistical data for a specific contract in a delivery area, |
| 18 | + * including portfolio, buy/sell quantities and prices, net position, and last trade information. |
| 19 | + * |
| 20 | + */ |
| 21 | +public class PrivateStatisticRow extends BaseStatisticRow { |
| 22 | + |
| 23 | + private String portfolioId; |
| 24 | + private Long ownBuyQuantity; |
| 25 | + private Long ownBuyAveragePrice; |
| 26 | + private Long ownSellQuantity; |
| 27 | + private Long ownSellAveragePrice; |
| 28 | + private Long netQuantity; |
| 29 | + private Long netPosition; |
| 30 | + /** |
| 31 | + * Time of the last trade |
| 32 | + */ |
| 33 | + @JsonDeserialize(using = com.nordpool.id.publicapi.v1.serialize.DateDeserializer.class) |
| 34 | + @JsonSerialize(using = com.nordpool.id.publicapi.v1.serialize.DateSerializer.class) |
| 35 | + private ZonedDateTime lastTradeTime; |
| 36 | + /** |
| 37 | + * If false: update information with the contents received, If true: delete entity indicated in the message |
| 38 | + */ |
| 39 | + private Boolean deleted; |
| 40 | + |
| 41 | + /** |
| 42 | + * No args constructor for use in serialization |
| 43 | + */ |
| 44 | + public PrivateStatisticRow() {} |
| 45 | + |
| 46 | + /** |
| 47 | + * |
| 48 | + * @param portfolioId |
| 49 | + * @param ownBuyQuantity |
| 50 | + * @param ownBuyAveragePrice |
| 51 | + * @param ownSellQuantity |
| 52 | + * @param ownSellAveragePrice |
| 53 | + * @param netQuantity |
| 54 | + * @param netPosition |
| 55 | + * @param lastTradeTime |
| 56 | + * @param deliveryAreaId |
| 57 | + * @param contractId |
| 58 | + * @param updatedAt |
| 59 | + * @param deleted |
| 60 | + */ |
| 61 | + public PrivateStatisticRow(String portfolioId, Long ownBuyQuantity, Long ownBuyAveragePrice, Long ownSellQuantity, Long ownSellAveragePrice, Long netQuantity, Long netPosition, ZonedDateTime lastTradeTime, Long deliveryAreaId, String contractId, ZonedDateTime updatedAt, Boolean deleted) { |
| 62 | + super(deliveryAreaId, contractId, updatedAt); |
| 63 | + this.portfolioId = portfolioId; |
| 64 | + this.ownBuyQuantity = ownBuyQuantity; |
| 65 | + this.ownBuyAveragePrice = ownBuyAveragePrice; |
| 66 | + this.ownSellQuantity = ownSellQuantity; |
| 67 | + this.ownSellAveragePrice = ownSellAveragePrice; |
| 68 | + this.netQuantity = netQuantity; |
| 69 | + this.netPosition = netPosition; |
| 70 | + this.lastTradeTime = lastTradeTime; |
| 71 | + this.deleted = deleted; |
| 72 | + } |
| 73 | + |
| 74 | + public String getPortfolioId() { |
| 75 | + return portfolioId; |
| 76 | + } |
| 77 | + |
| 78 | + public void setPortfolioId(String portfolioId) { |
| 79 | + this.portfolioId = portfolioId; |
| 80 | + } |
| 81 | + |
| 82 | + public PrivateStatisticRow withPortfolioId(String portfolioId) { |
| 83 | + this.portfolioId = portfolioId; |
| 84 | + return this; |
| 85 | + } |
| 86 | + |
| 87 | + public Long getOwnBuyQuantity() { |
| 88 | + return ownBuyQuantity; |
| 89 | + } |
| 90 | + |
| 91 | + public void setOwnBuyQuantity(Long ownBuyQuantity) { |
| 92 | + this.ownBuyQuantity = ownBuyQuantity; |
| 93 | + } |
| 94 | + |
| 95 | + public PrivateStatisticRow withOwnBuyQuantity(Long ownBuyQuantity) { |
| 96 | + this.ownBuyQuantity = ownBuyQuantity; |
| 97 | + return this; |
| 98 | + } |
| 99 | + |
| 100 | + public Long getOwnBuyAveragePrice() { |
| 101 | + return ownBuyAveragePrice; |
| 102 | + } |
| 103 | + |
| 104 | + public void setOwnBuyAveragePrice(Long ownBuyAveragePrice) { |
| 105 | + this.ownBuyAveragePrice = ownBuyAveragePrice; |
| 106 | + } |
| 107 | + |
| 108 | + public PrivateStatisticRow withOwnBuyAveragePrice(Long ownBuyAveragePrice) { |
| 109 | + this.ownBuyAveragePrice = ownBuyAveragePrice; |
| 110 | + return this; |
| 111 | + } |
| 112 | + |
| 113 | + public Long getOwnSellQuantity() { |
| 114 | + return ownSellQuantity; |
| 115 | + } |
| 116 | + |
| 117 | + public void setOwnSellQuantity(Long ownSellQuantity) { |
| 118 | + this.ownSellQuantity = ownSellQuantity; |
| 119 | + } |
| 120 | + |
| 121 | + public PrivateStatisticRow withOwnSellQuantity(Long ownSellQuantity) { |
| 122 | + this.ownSellQuantity = ownSellQuantity; |
| 123 | + return this; |
| 124 | + } |
| 125 | + |
| 126 | + public Long getOwnSellAveragePrice() { |
| 127 | + return ownSellAveragePrice; |
| 128 | + } |
| 129 | + |
| 130 | + public void setOwnSellAveragePrice(Long ownSellAveragePrice) { |
| 131 | + this.ownSellAveragePrice = ownSellAveragePrice; |
| 132 | + } |
| 133 | + |
| 134 | + public PrivateStatisticRow withOwnSellAveragePrice(Long ownSellAveragePrice) { |
| 135 | + this.ownSellAveragePrice = ownSellAveragePrice; |
| 136 | + return this; |
| 137 | + } |
| 138 | + |
| 139 | + public Long getNetQuantity() { |
| 140 | + return netQuantity; |
| 141 | + } |
| 142 | + |
| 143 | + public void setNetQuantity(Long netQuantity) { |
| 144 | + this.netQuantity = netQuantity; |
| 145 | + } |
| 146 | + |
| 147 | + public PrivateStatisticRow withNetQuantity(Long netQuantity) { |
| 148 | + this.netQuantity = netQuantity; |
| 149 | + return this; |
| 150 | + } |
| 151 | + |
| 152 | + public Long getNetPosition() { |
| 153 | + return netPosition; |
| 154 | + } |
| 155 | + |
| 156 | + public void setNetPosition(Long netPosition) { |
| 157 | + this.netPosition = netPosition; |
| 158 | + } |
| 159 | + |
| 160 | + public PrivateStatisticRow withNetPosition(Long netPosition) { |
| 161 | + this.netPosition = netPosition; |
| 162 | + return this; |
| 163 | + } |
| 164 | + |
| 165 | + /** |
| 166 | + * Time of the last trade |
| 167 | + * |
| 168 | + */ |
| 169 | + public ZonedDateTime getLastTradeTime() { |
| 170 | + return lastTradeTime; |
| 171 | + } |
| 172 | + |
| 173 | + /** |
| 174 | + * Time of the last trade |
| 175 | + * |
| 176 | + */ |
| 177 | + public void setLastTradeTime(ZonedDateTime lastTradeTime) { |
| 178 | + this.lastTradeTime = lastTradeTime; |
| 179 | + } |
| 180 | + |
| 181 | + /** |
| 182 | + * Time of the last trade |
| 183 | + * |
| 184 | + */ |
| 185 | + public PrivateStatisticRow withLastTradeTime(ZonedDateTime lastTradeTime) { |
| 186 | + this.lastTradeTime = lastTradeTime; |
| 187 | + return this; |
| 188 | + } |
| 189 | + |
| 190 | + public Boolean getDeleted() { |
| 191 | + return deleted; |
| 192 | + } |
| 193 | + |
| 194 | + public void setDeleted(Boolean deleted) { |
| 195 | + this.deleted = deleted; |
| 196 | + } |
| 197 | + |
| 198 | + public PrivateStatisticRow withDeleted(Boolean deleted) { |
| 199 | + this.deleted = deleted; |
| 200 | + return this; |
| 201 | + } |
| 202 | + |
| 203 | + @Override |
| 204 | + public PrivateStatisticRow withDeliveryAreaId(Long deliveryAreaId) { |
| 205 | + super.withDeliveryAreaId(deliveryAreaId); |
| 206 | + return this; |
| 207 | + } |
| 208 | + |
| 209 | + @Override |
| 210 | + public PrivateStatisticRow withContractId(String contractId) { |
| 211 | + super.withContractId(contractId); |
| 212 | + return this; |
| 213 | + } |
| 214 | + |
| 215 | + @Override |
| 216 | + public PrivateStatisticRow withUpdatedAt(ZonedDateTime updatedAt) { |
| 217 | + super.withUpdatedAt(updatedAt); |
| 218 | + return this; |
| 219 | + } |
| 220 | + |
| 221 | + @Override |
| 222 | + public String toString() { |
| 223 | + return new ToStringBuilder(this) |
| 224 | + .appendSuper(super.toString()) |
| 225 | + .append("portfolioId", portfolioId) |
| 226 | + .append("ownBuyQuantity", ownBuyQuantity) |
| 227 | + .append("ownBuyAveragePrice", ownBuyAveragePrice) |
| 228 | + .append("ownSellQuantity", ownSellQuantity) |
| 229 | + .append("ownSellAveragePrice", ownSellAveragePrice) |
| 230 | + .append("netQuantity", netQuantity) |
| 231 | + .append("netPosition", netPosition) |
| 232 | + .append("lastTradeTime", lastTradeTime) |
| 233 | + .append("deleted", deleted) |
| 234 | + .toString(); |
| 235 | + } |
| 236 | + |
| 237 | + @Override |
| 238 | + public int hashCode() { |
| 239 | + return new HashCodeBuilder() |
| 240 | + .appendSuper(super.hashCode()) |
| 241 | + .append(portfolioId) |
| 242 | + .append(ownBuyQuantity) |
| 243 | + .append(ownBuyAveragePrice) |
| 244 | + .append(ownSellQuantity) |
| 245 | + .append(ownSellAveragePrice) |
| 246 | + .append(netQuantity) |
| 247 | + .append(netPosition) |
| 248 | + .append(lastTradeTime) |
| 249 | + .append(deleted) |
| 250 | + .toHashCode(); |
| 251 | + } |
| 252 | + |
| 253 | + @Override |
| 254 | + public boolean equals(Object other) { |
| 255 | + if (other == this) { |
| 256 | + return true; |
| 257 | + } |
| 258 | + if (!(other instanceof PrivateStatisticRow)) { |
| 259 | + return false; |
| 260 | + } |
| 261 | + PrivateStatisticRow rhs = (PrivateStatisticRow) other; |
| 262 | + return new EqualsBuilder() |
| 263 | + .appendSuper(super.equals(other)) |
| 264 | + .append(portfolioId, rhs.portfolioId) |
| 265 | + .append(ownBuyQuantity, rhs.ownBuyQuantity) |
| 266 | + .append(ownBuyAveragePrice, rhs.ownBuyAveragePrice) |
| 267 | + .append(ownSellQuantity, rhs.ownSellQuantity) |
| 268 | + .append(ownSellAveragePrice, rhs.ownSellAveragePrice) |
| 269 | + .append(netQuantity, rhs.netQuantity) |
| 270 | + .append(netPosition, rhs.netPosition) |
| 271 | + .append(lastTradeTime, rhs.lastTradeTime) |
| 272 | + .append(deleted, rhs.deleted) |
| 273 | + .isEquals(); |
| 274 | + } |
| 275 | +} |
0 commit comments