Learning zero-cost portfolio selection with pattern matching