Transactions.create constructor

Transactions.create({
  1. required String symbol,
  2. required double amount,
  3. required int buyDate,
})

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);