Skip to content

Commit 84b2976

Browse files
committed
Add missing InstrumentFinancing to Instrument primitive
1 parent c4b8be6 commit 84b2976

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

src/primitives.js

+43
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ class Instrument extends Definition {
167167
this.commission = new InstrumentCommission(data['commission']);
168168
}
169169

170+
if (data['financing'] !== undefined) {
171+
this.financing = new InstrumentFinancing(data['financing']);
172+
}
173+
170174
}
171175
}
172176

@@ -261,6 +265,45 @@ class GuaranteedStopLossOrderLevelRestriction extends Definition {
261265
}
262266
}
263267

268+
const InstrumentFinancing_Properties = [
269+
new Property(
270+
'longRate',
271+
'longRate',
272+
"The financing rate to be used for a long position for the instrument. The value is in decimal rather than percentage points, i.e. 5% is represented as 0.05.",
273+
'primitive',
274+
'primitives.DecimalNumber'
275+
),
276+
new Property(
277+
'shortRate',
278+
'shortRate',
279+
"The financing rate to be used for a short position for the instrument. The value is in decimal rather than percentage points, i.e. 5% is represented as 0.05.",
280+
'primitive',
281+
'primitives.DecimalNumber'
282+
),
283+
];
284+
285+
class InstrumentFinancing extends Definition {
286+
constructor(data) {
287+
super();
288+
289+
this._summaryFormat = "";
290+
291+
this._nameFormat = "";
292+
293+
this._properties = InstrumentFinancing_Properties;
294+
295+
data = data || {};
296+
297+
if (data['longRate'] !== undefined) {
298+
this.longRate = data['longRate'];
299+
}
300+
301+
if (data['shortRate'] !== undefined) {
302+
this.shortRate = data['shortRate'];
303+
}
304+
}
305+
}
306+
264307
class EntitySpec {
265308
constructor(context) {
266309
this.context = context;

0 commit comments

Comments
 (0)