     :start-date (t/local-date 2017 1 1)
     :period :month
     :period-count 12
-    :items [{:account-id "1b71fd298aeca1a18d35b04a7618e76e"
+    :items [{:account-id (:salary ids)
              :periods #{{:index 0
                          :amount 1000M}
                         {:index 1

                         :amount 1000M}
                        {:index 11
                         :amount 1000M}}}
            {:account-id "835bfe9b2728976d06e63b90aea8c090"
             :periods #{{:index 0
                         :amount 200M}
                        {:index 1

(def ^:private extended-commodities-input
  (io/input-stream "resources/fixtures/sample_with_commodities_ext.gnucash"))

(deftest read-gnucash-source-with-trading-actions
  (let [found (reduce track-record {} (read-source
                                        :gnucash
                                        extended-commodities-input))
        expected-transactions [{:transaction-date (t/local-date 2015 1 16)
                                :description "Retirement"
                                :items [{:action :debit
                                         :account-id (:401k ids)
                                         :amount 1000M
                                         :reconciled false}
                                        {:action :credit
                                         :account-id (:checking ids)
                                         :amount 1000M
                                         :reconciled false}]}
                               {:transaction-date (t/local-date 2015 1 17)
                                :description "Purchase shares AAPL"
                                :action :buy
                                :symbol "AAPL"
                                :exchange :nasdaq
                                :shares 100M
                                :account-id (:401k ids)
                                :commodity-account-id (:apple-401k ids)
                                :items [{:action :debit
                                         :account-id (:apple-401k ids)
                                         :amount 1000M
                                         :reconciled false}
                                        {:action :credit
                                         :account-id (:401k ids)
                                         :amount 1000M
                                         :reconciled false}]}
                               {:transaction-date (t/local-date 2015 3 2)
                                :description "Transfer shares of AAPL"
                                :action :transfer
                                :shares 100M
                                :from-account-id (:apple-401k ids)
                                :to-account-id (:ira ids) ; or maybe :apple-ira?
                                :items [{:action :debit
                                         :account-id (:apple-ira ids)
                                         :amount 1000M
                                         :reconciled false}
                                        {:action :credit
                                         :account-id (:apple-401k ids)
                                         :amount 1000M
                                         :reconciled false}]}
                               {:transaction-date (t/local-date 2015 4 1)
                                :description "Stock Split"
                                :action :split
                                :shares-gained 100M
                                :commodity-account-id (:apple-ira ids)
                                :items [{:action :debit
                                         :account-id (:apple-ira ids)
                                         ; TODO add some shares here
                                         :amount 0M}
                                        {:action :debit
                                         :account-id (:ira ids)
                                         :amount 1M}
                                        {:action :credit
                                         :account-id (:other-inc ids)
                                         :amount 1M}]}]
        inv-account-ids (->> [:ira :apple-ira :401k :apple-401k]
                             (map #(% ids))
                             set)
        actual-transactions (filter (fn [transaction]
                                      (some #(inv-account-ids (:account-id %))
                                            (:items transaction)))
                                    (:transaction found))]
    (pprint-diff expected-transactions actual-transactions)
    (is (= expected-transactions actual-transactions)
        "The correct transactions are found")))
