summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pyisda/credit_index.pyx10
1 files changed, 10 insertions, 0 deletions
diff --git a/pyisda/credit_index.pyx b/pyisda/credit_index.pyx
index da9a177..a3c6fe9 100644
--- a/pyisda/credit_index.pyx
+++ b/pyisda/credit_index.pyx
@@ -133,6 +133,16 @@ cdef class CurveList:
Py_INCREF(self)
return out
+ @weights.setter
+ def weights(self, double[::1] val):
+ if val.shape[0] != self._weights.size():
+ raise ValueError("size mismatch")
+
+ cdef size_t i
+ for i in range(self.weights.size()):
+ self.weights[i] = val[i]
+
+
@property
def tickers(self):
cdef np.npy_intp shape = self.names.size()