From 191a1b729ffbd6e242c20c846d01332ca296e328 Mon Sep 17 00:00:00 2001 From: dmichalowicz Date: Wed, 3 May 2017 15:23:38 -0400 Subject: [PATCH] BUG: Gold and silver futures contracts only trade certain months --- zipline/assets/continuous_futures.pyx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zipline/assets/continuous_futures.pyx b/zipline/assets/continuous_futures.pyx index 3e71c8b8..ad573668 100644 --- a/zipline/assets/continuous_futures.pyx +++ b/zipline/assets/continuous_futures.pyx @@ -64,6 +64,12 @@ CHAIN_PREDICATES = { 'CD': march_cycle_delivery_predicate, 'AD': march_cycle_delivery_predicate, 'BP': march_cycle_delivery_predicate, + + # Gold and silver contracts trade on an unusual specific set of months. + 'GC': partial(delivery_predicate, set(['G', 'J', 'M', 'Q', 'V', 'Z'])), + 'XG': partial(delivery_predicate, set(['G', 'J', 'M', 'Q', 'V', 'Z'])), + 'SV': partial(delivery_predicate, set(['H', 'K', 'N', 'U', 'Z'])), + 'YS': partial(delivery_predicate, set(['H', 'K', 'N', 'U', 'Z'])), } ADJUSTMENT_STYLES = {'add', 'mul', None}