Fixed typo that was causing trades to lose money. Cleaned up some code. Added ledger state saving (restarting daemon no longer causes it to start from scratch)