Skip to content

Commit eac6a03

Browse files
committed
update AbstractTransaction
spacious-team/investbook#363
1 parent ca46274 commit eac6a03

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

src/main/java/org/spacious_team/broker/report_parser/api/AbstractTransaction.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
@EqualsAndHashCode(cacheStrategy = LAZY)
4141
public abstract class AbstractTransaction {
4242
protected static final BigDecimal minValue = BigDecimal.valueOf(0.01);
43+
protected final Integer id;
4344
protected final String tradeId;
4445
protected final String portfolio;
4546
protected final String security;
@@ -52,6 +53,7 @@ public abstract class AbstractTransaction {
5253

5354
public Transaction getTransaction() {
5455
return Transaction.builder()
56+
.id(id)
5557
.tradeId(tradeId)
5658
.portfolio(portfolio)
5759
.security(security)
@@ -70,6 +72,7 @@ public List<TransactionCashFlow> getTransactionCashFlows() {
7072
protected Optional<TransactionCashFlow> getValueCashFlow(CashFlowType type) {
7173
if (value != null && value.abs().compareTo(minValue) >= 0) {
7274
return Optional.of(TransactionCashFlow.builder()
75+
.transactionId(id)
7376
.eventType(type)
7477
.value(value)
7578
.currency(valueCurrency)
@@ -81,6 +84,7 @@ protected Optional<TransactionCashFlow> getValueCashFlow(CashFlowType type) {
8184
protected Optional<TransactionCashFlow> getCommissionCashFlow() {
8285
if (commission != null && commission.abs().compareTo(minValue) >= 0) {
8386
return Optional.of(TransactionCashFlow.builder()
87+
.transactionId(id)
8488
.eventType(CashFlowType.COMMISSION)
8589
.value(commission)
8690
.currency(commissionCurrency)

src/main/java/org/spacious_team/broker/report_parser/api/DerivativeTransaction.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public List<TransactionCashFlow> getTransactionCashFlows() {
5151
protected Optional<TransactionCashFlow> getValueInPointsCashFlow() {
5252
if (valueInPoints != null) {
5353
return Optional.of(TransactionCashFlow.builder()
54+
.transactionId(id)
5455
.eventType(CashFlowType.DERIVATIVE_QUOTE)
5556
.value(valueInPoints)
5657
.currency(QUOTE_CURRENCY)
@@ -63,6 +64,7 @@ protected Optional<TransactionCashFlow> getValueInPointsCashFlow() {
6364
protected Optional<TransactionCashFlow> getValueCashFlow(CashFlowType type) {
6465
if (value != null) {
6566
return Optional.of(TransactionCashFlow.builder()
67+
.transactionId(id)
6668
.eventType(type)
6769
.value(value)
6870
.currency(valueCurrency)

src/main/java/org/spacious_team/broker/report_parser/api/SecurityTransaction.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ private Optional<TransactionCashFlow> getAccruedInterestCashFlow() {
5151
// for securities accrued interest = 0
5252
if (accruedInterest != null && accruedInterest.abs().compareTo(minValue) >= 0) {
5353
return Optional.of(TransactionCashFlow.builder()
54+
.transactionId(id)
5455
.eventType(CashFlowType.ACCRUED_INTEREST)
5556
.value(accruedInterest)
5657
.currency(valueCurrency)

0 commit comments

Comments
 (0)