 (defui App
   static om/IQueryParams
   (params [this]
-    {:start-date (js/Date. 2016) :end-date (js/Date. 2017)})
+    {:start-date (js/Date. 2016) :end-date (js/Date. 2017) :sort-key :created :compare-fn >})
   static om/IQuery
   (query [this]
-    '[:transactions
+    '[(:transactions/list {:sort-key ?sort-key :compare-fn ?compare-fn})
       (:account/balance {:start-date ?start-date :end-date ?end-date})])
   Object
   (componentWillMount [this]

                                  :created (.getTime (js/Date.))
                                        ;:date #_(.getTime input-date)
                                  :type (if input-type-toggle :expense :income)
                                  :value input-value}]
                      (do
                        (om/transact! component `[(transactions/add ~new-tx)])
                        (om/update-state! component assoc :input-value nil)

      {:value value}
      {:value :not-found})))

(defmethod read :transactions/list
  [{:keys [state]} key {:keys [sort-key compare-fn]}]
  (let [st @state]
    (if-let [[_ txs] (find st :transactions)]
      (let [process-tx (comp
                        (map (fn [[k v]] (assoc v :id k)))
                        (map (fn [tx] (update-in tx [:value]
                                                 #(/ % 100)))))]
        {:value (sort-by sort-key compare-fn (transduce process-tx conj [] txs))})
      {:value []})))

(def process-tx-value
  (comp (remove nil?)
        (map
