Skip to content

Commit

Permalink
Add missing InstrumentFinancing to Instrument primitive
Browse files Browse the repository at this point in the history
  • Loading branch information
joaocosta committed Jun 3, 2022
1 parent b5fc9c3 commit e7e1c95
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/primitives.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ class Instrument extends Definition {
this.commission = new InstrumentCommission(data['commission']);
}

if (data['financing'] !== undefined) {
this.financing = new InstrumentFinancing(data['financing']);
}

}
}

Expand Down Expand Up @@ -261,6 +265,45 @@ class GuaranteedStopLossOrderLevelRestriction extends Definition {
}
}

const InstrumentFinancing_Properties = [
new Property(
'longRate',
'longRate',
"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.",
'primitive',
'primitives.DecimalNumber'
),
new Property(
'shortRate',
'shortRate',
"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.",
'primitive',
'primitives.DecimalNumber'
),
];

class InstrumentFinancing extends Definition {
constructor(data) {
super();

this._summaryFormat = "";

this._nameFormat = "";

this._properties = InstrumentFinancing_Properties;

data = data || {};

if (data['longRate'] !== undefined) {
this.longRate = data['longRate'];
}

if (data['shortRate'] !== undefined) {
this.shortRate = data['shortRate'];
}
}
}

class EntitySpec {
constructor(context) {
this.context = context;
Expand Down

0 comments on commit e7e1c95

Please sign in to comment.