Skip to content
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 @@ -118,6 +118,16 @@ public AccountBuilder dividend(String date, long amount, long taxes, Security se
return transaction(Type.DIVIDENDS, date, amount, taxes, security);
}

public AccountBuilder sellOption(String date, long amount, Security security)
{
return transaction(Type.SELL_OPTION, date, amount, 0L, security);
}

public AccountBuilder buyOption(String date, long amount, long taxes, Security security)
{
return transaction(Type.BUY_OPTION, date, amount, taxes, security);
}

private AccountBuilder transaction(Type type, String date, long amount)
{
return transaction(type, asDateTime(date), amount, 0L, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,18 @@ public static Matcher<Extractor.Item> dividend(Matcher<Transaction>... propertie
return new AccountTransactionMatcher("dividend", AccountTransaction.Type.DIVIDENDS, properties); //$NON-NLS-1$
}

@SafeVarargs
public static Matcher<Extractor.Item> sellOption(Matcher<Transaction>... properties)
{
return new AccountTransactionMatcher("sellOption", AccountTransaction.Type.SELL_OPTION, properties); //$NON-NLS-1$
}

@SafeVarargs
public static Matcher<Extractor.Item> buyOption(Matcher<Transaction>... properties)
{
return new AccountTransactionMatcher("buyOption", AccountTransaction.Type.BUY_OPTION, properties); //$NON-NLS-1$
}

@SafeVarargs
public static Matcher<Extractor.Item> interest(Matcher<Transaction>... properties)
{
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<FlexQueryResponse queryName="PP" type="AF">
<FlexStatements count="1">
<FlexStatement accountId="U1234567" fromDate="20250609" toDate="20250701" period="" whenGenerated="20250702;155838">
<Trades>
<Trade accountId="U1234567" acctAlias="Main" model="" currency="USD" fxRateToBase="1" assetCategory="OPT" subCategory="P" symbol="SPX 250620P05150000" description="SPX 20JUN25 5150 P" conid="637420736" securityID="" securityIDType="" cusip="" isin="" figi="BBG01H0GZQG2" listingExchange="CBOE" underlyingConid="416904" underlyingSymbol="SPX" underlyingSecurityID="" underlyingListingExchange="" issuer="" issuerCountryCode="" tradeID="123" multiplier="100" relatedTradeID="" strike="5150" reportDate="20250617" expiry="20250620" dateTime="20250617;160458" putCall="P" tradeDate="20250617" principalAdjustFactor="" settleDateTarget="20250618" transactionType="ExchTrade" exchange="CBOE" quantity="-3" tradePrice="0.4" tradeMoney="-120" proceeds="120" taxes="0" ibCommission="-3.84135" ibCommissionCurrency="USD" netCash="116.15865" closePrice="0.4581" openCloseIndicator="O" notes="P" cost="-116.15865" fifoPnlRealized="0" mtmPnl="-17.43" origTradePrice="0" origTradeDate="" origTradeID="" origOrderID="0" origTransactionID="0" buySell="SELL" clearingFirmID="" ibOrderID="123" transactionID="123" ibExecID="123" relatedTransactionID="" rtn="123" brokerageOrderID="123" orderReference="" volatilityOrderLink="" exchOrderId="N/A" extExecID="123" orderTime="20250617;160458" openDateTime="" holdingPeriodDateTime="" whenRealized="" whenReopened="" levelOfDetail="EXECUTION" changeInPrice="0" changeInQuantity="0" orderType="LMT" traderID="" isAPIOrder="N" accruedInt="0" initialInvestment="" serialNumber="" deliveryType="" commodityType="" fineness="0.0" weight="0.0" />
<Trade accountId="U1234567" acctAlias="Main" model="" currency="USD" fxRateToBase="1" assetCategory="OPT" subCategory="P" symbol="SPX 250620P05150000" description="SPX 20JUN25 5150 P" conid="637420736" securityID="" securityIDType="" cusip="" isin="" figi="BBG01H0GZQG2" listingExchange="CBOE" underlyingConid="416904" underlyingSymbol="SPX" underlyingSecurityID="" underlyingListingExchange="" issuer="" issuerCountryCode="" tradeID="123" multiplier="100" relatedTradeID="" strike="5150" reportDate="20250617" expiry="20250620" dateTime="20250617;160458" putCall="P" tradeDate="20250617" principalAdjustFactor="" settleDateTarget="20250618" transactionType="ExchTrade" exchange="CBOE" quantity="-2" tradePrice="0.4" tradeMoney="-80" proceeds="80" taxes="0" ibCommission="-2.5609" ibCommissionCurrency="USD" netCash="77.4391" closePrice="0.4581" openCloseIndicator="O" notes="P" cost="-77.4391" fifoPnlRealized="0" mtmPnl="-11.62" origTradePrice="0" origTradeDate="" origTradeID="" origOrderID="0" origTransactionID="0" buySell="SELL" clearingFirmID="" ibOrderID="123" transactionID="123" ibExecID="123" relatedTransactionID="" rtn="123" brokerageOrderID="123" orderReference="" volatilityOrderLink="" exchOrderId="N/A" extExecID="123" orderTime="20250617;160458" openDateTime="" holdingPeriodDateTime="" whenRealized="" whenReopened="" levelOfDetail="EXECUTION" changeInPrice="0" changeInQuantity="0" orderType="LMT" traderID="" isAPIOrder="N" accruedInt="0" initialInvestment="" serialNumber="" deliveryType="" commodityType="" fineness="0.0" weight="0.0" />
<Trade accountId="U1234567" acctAlias="Main" model="" currency="USD" fxRateToBase="1" assetCategory="OPT" subCategory="P" symbol="SPXW 250613P05605000" description="SPXW 13JUN25 5605 P" conid="783310588" securityID="" securityIDType="" cusip="" isin="" figi="BBG01TY0PLQ5" listingExchange="CBOE" underlyingConid="416904" underlyingSymbol="SPX" underlyingSecurityID="" underlyingListingExchange="" issuer="" issuerCountryCode="" tradeID="123" multiplier="100" relatedTradeID="" strike="5605" reportDate="20250616" expiry="20250613" dateTime="20250613;162000" putCall="P" tradeDate="20250613" principalAdjustFactor="" settleDateTarget="20250616" transactionType="BookTrade" exchange="--" quantity="1" tradePrice="0" tradeMoney="0" proceeds="0" taxes="0" ibCommission="0" ibCommissionCurrency="USD" netCash="0" closePrice="0" openCloseIndicator="C" notes="Ep" cost="28.43955" fifoPnlRealized="28.43955" mtmPnl="0" origTradePrice="0" origTradeDate="" origTradeID="" origOrderID="0" origTransactionID="0" buySell="BUY" clearingFirmID="" ibOrderID="123" transactionID="123" ibExecID="123" brokerageOrderID="123" exchOrderId="N/A" extExecID="123/A" orderTime="" openDateTime="" holdingPeriodDateTime="" whenRealized="" whenReopened="" levelOfDetail="EXECUTION" changeInPrice="0" changeInQuantity="0" orderType="" traderID="" isAPIOrder="N" accruedInt="0" initialInvestment="" serialNumber="" deliveryType="" commodityType="" fineness="0.0" weight="0.0" />
<Trade accountId="U1234567" acctAlias="Main" model="" currency="USD" fxRateToBase="1" assetCategory="OPT" subCategory="P" symbol="SPXW 250613P05680000" description="SPXW 13JUN25 5680 P" conid="781048519" securityID="" securityIDType="" cusip="" isin="" figi="BBG01TRPXV96" listingExchange="CBOE" underlyingConid="416904" underlyingSymbol="SPX" underlyingSecurityID="" underlyingListingExchange="" issuer="" issuerCountryCode="" tradeID="123" multiplier="100" relatedTradeID="" strike="5680" reportDate="20250612" expiry="20250613" dateTime="20250612;152710" putCall="P" tradeDate="20250612" principalAdjustFactor="" settleDateTarget="20250613" transactionType="ExchTrade" exchange="CBOE" quantity="-1" tradePrice="0.15" tradeMoney="-15" proceeds="15" taxes="0" ibCommission="-1.56045" ibCommissionCurrency="USD" netCash="13.43955" closePrice="0.0028" openCloseIndicator="O" notes="" cost="-13.43955" fifoPnlRealized="0" mtmPnl="14.72" origTradePrice="0" origTradeDate="" origTradeID="" origOrderID="0" origTransactionID="0" buySell="SELL" clearingFirmID="" ibOrderID="123" transactionID="123" ibExecID="123" relatedTransactionID="" rtn="123" brokerageOrderID="123" orderReference="" volatilityOrderLink="" exchOrderId="N/A" extExecID="123" orderTime="20250612;152710" openDateTime="" holdingPeriodDateTime="" whenRealized="" whenReopened="" levelOfDetail="EXECUTION" changeInPrice="0" changeInQuantity="0" orderType="LMT" traderID="" isAPIOrder="Y" accruedInt="0" initialInvestment="" serialNumber="" deliveryType="" commodityType="" fineness="0.0" weight="0.0" />
<Trade accountId="U1234567" acctAlias="Main" model="" currency="USD" fxRateToBase="1" assetCategory="OPT" symbol="PAYC 181116C00120000" description="PAYC 16NOV18 120.0 C" conid="311191362" securityID="" securityIDType="" cusip="" isin="" listingExchange="" underlyingConid="148163036" underlyingSymbol="PAYC" underlyingSecurityID="" underlyingListingExchange="NYSE" issuer="" multiplier="100" strike="120" expiry="20181116" tradeID="2107408815" putCall="C" reportDate="20180511" principalAdjustFactor="" tradeDate="20180511" tradeTime="114545" settleDateTarget="20180514" transactionType="ExchTrade" exchange="PEARL" quantity="1" tradePrice="6.9" tradeMoney="690" proceeds="-690" taxes="0" ibCommission="-0.6378" ibCommissionCurrency="USD" netCash="-690.6378" closePrice="6.3959" openCloseIndicator="" notes="P" cost="690.6378" fifoPnlRealized="0" fxPnl="0" mtmPnl="-50.41" origTradePrice="0" origTradeDate="" origTradeID="" origOrderID="0" clearingFirmID="" transactionID="9004815263" buySell="BUY" ibOrderID="1037536580" ibExecID="00010209.5af58c42.01.01" brokerageOrderID="" orderReference="" volatilityOrderLink="" exchOrderId="N/A" extExecID="10316756086329380001" orderTime="20180511;114545" openDateTime="" holdingPeriodDateTime="" whenRealized="" whenReopened="" levelOfDetail="EXECUTION" changeInPrice="0" changeInQuantity="0" orderType="LMT" traderID="" isAPIOrder="N" />
</Trades>
</FlexStatement>
</FlexStatements>
</FlexQueryResponse>
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ public class Messages extends NLS
public static String LabelAccounts;
public static String LabelAccountTransfer;
public static String LabelAccumulatedDividends;
public static String LabelAccumulatedOptionPremiums;
public static String LabelAccumulatedEarnings;
public static String LabelAccumulatedInterest;
public static String LabelAccumulatedInterestCharge;
Expand Down Expand Up @@ -670,6 +671,7 @@ public class Messages extends NLS
public static String LabelDescription;
public static String LabelDividendPerShare;
public static String LabelDividends;
public static String LabelOptionPremiums;
public static String LabelDoImport;
public static String LabelDoNotImport;
public static String LabelDrawdown;
Expand Down Expand Up @@ -1297,6 +1299,8 @@ public class Messages extends NLS
public static String SecurityMenuDeleteSingleSecurity;
public static String SecurityMenuDeleteSingleSecurityConfirm;
public static String SecurityMenuDividends;
public static String SecurityMenuOptionSell;
public static String SecurityMenuOptionBuy;
public static String SecurityMenuEditSecurity;
public static String SecurityMenuEmptyInstrument;
public static String SecurityMenuErrorMessageRoundingMustBeBetween0AndX;
Expand Down Expand Up @@ -1404,6 +1408,9 @@ public class Messages extends NLS
public static String TransactionFilterDeposit;
public static String TransactionFilterDepositAndRemoval;
public static String TransactionFilterDividend;
public static String TransactionFilterOptionSell;
public static String TransactionFilterOptionBuy;
public static String TransactionFilterOptionBuyAndSell;
public static String TransactionFilterFees;
public static String TransactionFilterInterest;
public static String TransactionFilterNone;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ private boolean isTransactionWithSecurity()
if (transaction instanceof PortfolioTransaction.Type)
return true;

return EnumSet.of(AccountTransaction.Type.DIVIDENDS, AccountTransaction.Type.TAXES,
AccountTransaction.Type.TAX_REFUND, AccountTransaction.Type.FEES,
return EnumSet.of(AccountTransaction.Type.DIVIDENDS, AccountTransaction.Type.SELL_OPTION, AccountTransaction.Type.BUY_OPTION,
AccountTransaction.Type.TAXES, AccountTransaction.Type.TAX_REFUND, AccountTransaction.Type.FEES,
AccountTransaction.Type.FEES_REFUND).contains(transaction);
}

Expand Down Expand Up @@ -116,7 +116,9 @@ public List<Element> getElements()
AccountTransaction.Type.FEES_REFUND, //
AccountTransaction.Type.INTEREST, //
AccountTransaction.Type.INTEREST_CHARGE, //
AccountTransaction.Type.DIVIDENDS))
AccountTransaction.Type.DIVIDENDS, //
AccountTransaction.Type.SELL_OPTION, //
AccountTransaction.Type.BUY_OPTION))
{
elements.add(new AccountTransactionElement(AccountTransactionDialog.class, type, selection));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,13 @@ private String getTotalLabel() // NOSONAR
case TAXES:
case FEES:
case INTEREST_CHARGE:
case BUY_OPTION:
case REMOVAL:
return Messages.ColumnDebitNote;
case INTEREST:
case TAX_REFUND:
case DIVIDENDS:
case SELL_OPTION:
case DEPOSIT:
case FEES_REFUND:
return Messages.ColumnCreditNote;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private void checkType()
{
switch (type)
{
case DEPOSIT, REMOVAL, FEES, FEES_REFUND, TAXES, TAX_REFUND, INTEREST, INTEREST_CHARGE, DIVIDENDS:
case DEPOSIT, REMOVAL, FEES, FEES_REFUND, TAXES, TAX_REFUND, INTEREST, INTEREST_CHARGE, DIVIDENDS, SELL_OPTION, BUY_OPTION:
return;
case BUY, SELL, TRANSFER_IN, TRANSFER_OUT:
default:
Expand Down Expand Up @@ -187,6 +187,8 @@ public boolean supportsShares()
public boolean supportsSecurity()
{
return type == Type.DIVIDENDS //
|| type == Type.SELL_OPTION //
|| type == Type.BUY_OPTION //
|| type == Type.TAXES //
|| type == Type.TAX_REFUND //
|| type == Type.FEES //
Expand All @@ -203,12 +205,17 @@ public boolean supportsOptionalSecurity()

public boolean supportsTaxUnits()
{
return type == AccountTransaction.Type.DIVIDENDS || type == AccountTransaction.Type.INTEREST;
return type == AccountTransaction.Type.DIVIDENDS ||
type == AccountTransaction.Type.INTEREST ||
type == AccountTransaction.Type.SELL_OPTION ||
type == AccountTransaction.Type.BUY_OPTION;
}

public boolean supportsFees()
{
return type == AccountTransaction.Type.DIVIDENDS;
return type == AccountTransaction.Type.DIVIDENDS ||
type == AccountTransaction.Type.SELL_OPTION ||
type == AccountTransaction.Type.BUY_OPTION;
}

public void setSource(Account account, AccountTransaction transaction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,8 @@ LabelAccounts = Deposit Accounts

LabelAccumulatedDividends = Dividends (accumulated)

LabelAccumulatedOptionPremiums = Options Premium (accumulated)

LabelAccumulatedEarnings = Earnings (accumulated)

LabelAccumulatedInterest = Interest (accumulated)
Expand Down Expand Up @@ -1332,6 +1334,8 @@ LabelDividendPerShare = dividend payment per shares

LabelDividends = Dividends

LabelOptionPremiums = Options Premium

LabelDoImport = Import

LabelDoNotImport = Do not import
Expand Down Expand Up @@ -2588,6 +2592,10 @@ SecurityMenuDeleteSingleSecurityConfirm = Do you really want to delete the secur

SecurityMenuDividends = Dividend

SecurityMenuOptionBuy = Option Sell

SecurityMenuOptionSell = Option Buy

SecurityMenuEditSecurity = Edit...

SecurityMenuEmptyInstrument = Empty instrument
Expand Down Expand Up @@ -2802,6 +2810,12 @@ TransactionFilterDepositAndRemoval = Deposits and Removals

TransactionFilterDividend = Dividends

TransactionFilterOptionSell = Option sells

TransactionFilterOptionBuy = Option buys

TransactionFilterOptionBuyAndSell = Option Buys and Option Sells

TransactionFilterFees = Transaction with fees

TransactionFilterInterest = Interest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@ else if (tx instanceof AccountTransaction atx)
else
return false;
}), //
BUY_AND_SELL_OPTION(Messages.TransactionFilterOptionBuyAndSell, 0, tx -> {
if (tx instanceof AccountTransaction atx)
return atx.getType() == AccountTransaction.Type.BUY_OPTION || atx.getType() == AccountTransaction.Type.SELL_OPTION;
else
return false;
}), //
SELL_OPTION(Messages.TransactionFilterOptionSell, 1, tx -> {
if (tx instanceof AccountTransaction atx)
return atx.getType() == AccountTransaction.Type.SELL_OPTION;
else
return false;
}), //
BUY_OPTION(Messages.TransactionFilterOptionBuy, 1, tx -> {
if (tx instanceof AccountTransaction atx)
return atx.getType() == AccountTransaction.Type.BUY_OPTION;
else
return false;
}), //
DEPOSIT_AND_REMOVAL(Messages.TransactionFilterDepositAndRemoval, 0, tx -> {
if (tx instanceof AccountTransaction atx)
return atx.getType() == AccountTransaction.Type.DEPOSIT || atx.getType() == AccountTransaction.Type.REMOVAL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,20 @@ public void menuAboutToShow(IMenuManager manager, final Account account, final S
.with(account) //
.with(security) //
.addTo(manager);

new OpenDialogAction(owner, Messages.SecurityMenuOptionSell + "...") //$NON-NLS-1$
.type(AccountTransactionDialog.class) //
.parameters(AccountTransaction.Type.SELL_OPTION) //
.with(account) //
.with(security) //
.addTo(manager);

new OpenDialogAction(owner, Messages.SecurityMenuOptionBuy + "...") //$NON-NLS-1$
.type(AccountTransactionDialog.class) //
.parameters(AccountTransaction.Type.BUY_OPTION) //
.with(account) //
.with(security) //
.addTo(manager);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ private void updateBalance(Account account)
case DEPOSIT:
case INTEREST:
case DIVIDENDS:
case SELL_OPTION:
case TAX_REFUND:
case SELL:
case TRANSFER_IN:
Expand All @@ -372,6 +373,7 @@ private void updateBalance(Account account)
break;
case REMOVAL:
case FEES:
case BUY_OPTION:
case INTEREST_CHARGE:
case TAXES:
case BUY:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,18 @@ private void fillTransactionContextMenu(IMenuManager manager, Security security)
.with(security) //
.addTo(manager);

new OpenDialogAction(view, Messages.SecurityMenuOptionSell + "...") //$NON-NLS-1$
.type(AccountTransactionDialog.class) //
.parameters(AccountTransaction.Type.SELL_OPTION) //
.with(security) //
.addTo(manager);

new OpenDialogAction(view, Messages.SecurityMenuOptionBuy + "...") //$NON-NLS-1$
.type(AccountTransactionDialog.class) //
.parameters(AccountTransaction.Type.BUY_OPTION) //
.with(security) //
.addTo(manager);

new OpenDialogAction(view, AccountTransaction.Type.TAX_REFUND + "...") //$NON-NLS-1$
.type(AccountTransactionDialog.class) //
.parameters(AccountTransaction.Type.TAX_REFUND) //
Expand Down
Loading