                                                       {:action :debit
                                                        :amount 1000M
                                                        :account-id "APPL"}]}]))))
-
-(deftest buying-a-commodity-reduces-the-balance-of-the-account
-  (is false "need to write the test"))
 
 (deftest sell-a-commodity
   (let [context (serialization/realize storage-spec sell-context)

            [clj-money.serialization :as serialization]
            [clj-money.test-helpers :refer [reset-db]]
            [clj-money.validation :as validation]
            [clj-money.models.lots :as lots]
            [clj-money.models.lot-transactions :as lot-transactions]
            [clj-money.models.prices :as prices]

        "Thhe transaction is valid")))

(deftest selling-a-commodity-increases-the-balance-of-the-account
  (let [context (serialization/realize storage-spec purchase-context)
        ira (-> context :accounts first)
        commodity (-> context :commodities first)
        _ (trading/buy storage-spec {:commodity-id (:id commodity)
                                     :account-id (:id ira)
                                     :trade-date (t/local-date 2016 1 2)
                                     :shares 100M
                                     :value 1000M})
        _ (trading/sell storage-spec {:commodity-id (:id commodity)
                                      :account-id (:id ira)
                                      :trade-date (t/local-date 2017 1 2)
                                      :shares 50M
                                      :value 560M})
        new-balance (->> (accounts/reload storage-spec ira)
                         :balance)]
    (is (= 1560M new-balance) "The account balance decreases by the amount of the purchase")))

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