                (-> entry
                    (update-in [:accounts] #(concat %
                                                    [{:name caption
-                                                     :balance value
-                                                     :children-balance 0}]))
+                                                     :value value
+                                                     :children-value 0}]))
                    (update-in [:value] #(+ % value))))))
 
 (def ^:private pseudo-accounts

  [account-group calc-fn]
  (let [updated (update-in account-group [:accounts] calc-fn)]
    (assoc updated :value (reduce #(+ %1
                                      (:balance %2)
                                      (:children-balance %2))
                                  (bigdec 0)
                                  (:accounts updated)))))


(defn- set-balance-delta
  [storage-spec account start end]
  (let [children (set-balance-deltas storage-spec start end (:children account))
        new-children-value (reduce #(+ %1
                                         (:value %2)
                                         (:children-value %2))
                                     0
                                     children)
        new-value (transactions/balance-delta storage-spec
                                              (:id account)
                                              start
                                              end)]
    (assoc account :children children
                   :children-value new-children-value
                   :value new-value)))

; TODO consider removing this function
(defn- set-balance-deltas
