Temporal Representation Learning for Stock Similarities and Its Applications in Investment Management