Transactions.create constructor
Factory method to create a new Transactions object without specifying the trade direction.
The symbol
parameter is the security symbol.
The amount
parameter is used to determine the trade direction.
The buyDate
parameter is the buy date Unix timestamp.
Implementation
factory Transactions.create(
{required String symbol,
required double amount,
required int buyDate}) =>
Transactions(
symbol: symbol,
amount: amount,
buyDate: buyDate,
tradeDirection:
amount > 0 ? TradeDirection.buy : TradeDirection.sell);