Suppress curses.error exception on addstr()

Annoyingly, it's not possible to write to the bottom-right-hand corner
of a non-scrollable window using addstr() without triggering a
curses.error() exception when it tries to move the cursor outside the
window.

The character is written ok, so suppress this exception.
Variable width columns in stockterminal

Also move the database queries closer to where they are used.