Refactor AccountHistory into its own separate module

The ultimate goal is to replace the node logic behind the JSON endpoint completely with this library. The library part there and has specs, but I haven't yet tested it in place of the current web server code yet.