Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instrument financing missing #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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