The logic of security markets