Skip to content

Commit a5dcfef

Browse files
committed
Extend the Derivatives Status Message to contain all values
1 parent 374d9b9 commit a5dcfef

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

lib/status_messages_deriv.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ const fields = {
1010
price: 3,
1111
priceSpot: 4,
1212
fundBal: 6,
13+
fundingEventTimestamp: 8,
1314
fundingAccrued: 9,
1415
fundingStep: 10,
16+
currentFunding: 12,
17+
markprice: 15,
18+
openInterest: 18,
1519
clampMin: 22,
1620
clampMax: 23
1721
}
@@ -27,8 +31,12 @@ class StatusMessagesDeriv extends Model {
2731
* @param {string} data.price - price
2832
* @param {string} data.priceSpot - spot price
2933
* @param {string} data.fundBal - funding balance
34+
* @param {number} data.fundingEventTimestamp - timestamp
3035
* @param {string} data.fundingAccrued - accrued funding
3136
* @param {string} data.fundingStep - funding step
37+
* @param {number} data.currentFunding - funding applied in the current 8h period,
38+
* @param {number} data.markprice - markprice,
39+
* @param {number} data.openInterest - total number of outstanding derivative contracts,
3240
* @param {number} data.clampMin - min clamp
3341
* @param {number} data.clampMax - max clamp
3442
*/
@@ -60,8 +68,12 @@ class StatusMessagesDeriv extends Model {
6068
price: priceValidator,
6169
priceSpot: priceValidator,
6270
fundBal: priceValidator,
71+
fundingEventTimestamp: stringValidator,
6372
fundingAccrued: priceValidator,
6473
fundingStep: priceValidator,
74+
currentFunding: priceValidator,
75+
markprice: priceValidator,
76+
openInterest: priceValidator,
6577
clampMin: priceValidator,
6678
clampMax: priceValidator
6779
}

test/lib/models/status_messages_deriv.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ describe('Derivatives Status Message model', () => {
1313
model: StatusMessagesDeriv,
1414
orderedFields: [
1515
'key', 'timestamp', null, 'price', 'priceSpot', null, 'fundBal', null,
16-
null, 'fundingAccrued', 'fundingStep', null, null, null, null, null,
17-
null, null, null, null, null, null, 'clampMin', 'clampMax'
16+
'fundingEventTimestamp', 'fundingAccrued', 'fundingStep', null,
17+
'currentFunding', null, null, 'markprice', null, null, 'openInterest',
18+
null, null, null, 'clampMin', 'clampMax'
1819
]
1920
})
2021

@@ -26,8 +27,12 @@ describe('Derivatives Status Message model', () => {
2627
price: new Array(5).fill().map(Math.random),
2728
priceSpot: new Array(5).fill().map(Math.random),
2829
fundBal: new Array(5).fill().map(Math.random),
30+
fundingEventTimestamp: VALID_STRINGS,
2931
fundingAccrued: new Array(5).fill().map(Math.random),
3032
fundingStep: new Array(5).fill().map(Math.random),
33+
currentFunding: new Array(5).fill().map(Math.random),
34+
markprice: new Array(5).fill().map(Math.random),
35+
openInterest: new Array(5).fill().map(Math.random),
3136
clampMin: new Array(5).fill().map(Math.random),
3237
clampMax: new Array(5).fill().map(Math.random)
3338
}

0 commit comments

Comments
 (0)