     {:account :e-groceries, :amount 2000, :note "Food"}
     {:account :e-alcohol, :amount 1000, :note "Beer"}
     {:account :a-cash, :amount -3000}]}
+  {:date "2015/02/20", :description "Ameritrade", :parts
+    [{:account :a-ameritrade, :amount 1000, :unit :SLV}
+     {:account :a-ameritrade, :amount -16000}
+     {:account :e-commission, :amount 1000}]}
 ])
+
+(def sample-prices
+  [{:date "2015/02/20", :SLV 15}])
 
 (defn str->fixpt [s]
   (* s 100))

   {:account "", :amount ""}])

(def app-state (atom 
  {:screen :import
   :txs sample-txs 
   :register-parts []
   :entry-parts empty-entry-parts}))

(defn store-event [ev]
  {:target (aget ev "target")
   :key-code (.-keyCode ev)
   :target-value (aget ev "target" "value")})

(defn send! 
  ([type] (send! type {}))
  ([type arg]
    (fn [ev]
      (put! channel [type (store-event ev) arg]))))
      
(defn summarize [txs]
  (->> txs
       (map :parts)

    (compare (Math/abs n2) (Math/abs n1))
    (compare n1 n2)))
    
(defn display-amount
  ([amount] (display-amount amount nil nil))
  ([amount unit] (display-amount amount unit nil))
  ([amount unit neg]
   (str (if unit (str (subs (str unit) 1) " ") "$") 
        (fixpt->str (if neg (- amount) amount)))))

(defn tx-tds [tx]
  (let [[from-part to-part :as parts] (sort-by :amount cmp-sign-abs (:parts tx))]
