         _ (trading/sell storage-spec (-> context
                                          sale-attributes
                                          (assoc :shares 100M :value 850M)))
-        gains-items (->> {:account-id (:id capital-loss)}
+        gains-items (->> {:i.account-id (:id capital-loss)}
                          (transactions/search-items storage-spec)
                          (map #(dissoc % :id
                                          :entity-id

                                         (assoc :shares 25M
                                                :value 375M
                                                :trade-date (t/local-date 2017 3 1))))
        gains-items (->> {:account-id (:id st-capital-gains)}
                         (transactions/search-items storage-spec)
                         (map #(dissoc % :id
                                         :entity-id

                   :memo "Sell 100 shares of AAPL at 8.500"
                   :balance 150M
                   :index 0}]]
    (if-not (= expected gains-items)
      (pprint {:expected expected
               :actual gains-items
               :diff (diff expected gains-items)}))
    (is (= expected gains-items) "The capital loss account is credited the correct amount")))

; Selling a commodity updates a lot record (FILO updates the most recent, FIFO updates the oldest)
