@millistream/millistream-widgets 1.0.24 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/millistream-widgets.js +642 -7
- package/package.json +1 -1
package/millistream-widgets.js
CHANGED
|
@@ -3011,7 +3011,6 @@ function Milli_Chart(settings) {
|
|
|
3011
3011
|
return 1;
|
|
3012
3012
|
};
|
|
3013
3013
|
// Size functions
|
|
3014
|
-
|
|
3015
3014
|
function setChartSize() {
|
|
3016
3015
|
var offset = 0;
|
|
3017
3016
|
// set canvas size to 0 so it does not prevent the div to resize
|
|
@@ -3454,6 +3453,637 @@ function Milli_Chart(settings) {
|
|
|
3454
3453
|
}
|
|
3455
3454
|
});
|
|
3456
3455
|
}
|
|
3456
|
+
function Milli_OptionsList(settings) {
|
|
3457
|
+
let _this = this;
|
|
3458
|
+
let requestid = null;
|
|
3459
|
+
|
|
3460
|
+
_this.settings = {
|
|
3461
|
+
autodraw: true,
|
|
3462
|
+
//fields: ['insref','symbol','derivativeindicator','diff1d','diff1dprc','openinterest', 'quantity', 'bidprice', 'askprice', 'lastprice','strikeprice','strikedate','isin','instrumenttype','expirationtype','dte'],
|
|
3463
|
+
fields: ['openinterest', 'quantity', 'bidprice', 'askprice', 'lastprice'],
|
|
3464
|
+
instrument: 772,
|
|
3465
|
+
instrumenttype: [5],
|
|
3466
|
+
instrumentsubtype: [0],
|
|
3467
|
+
messagetypes: 2,
|
|
3468
|
+
num_decimals: 2,
|
|
3469
|
+
onreadyCallback: null,
|
|
3470
|
+
streaming: false,
|
|
3471
|
+
target: null,
|
|
3472
|
+
flash: true,
|
|
3473
|
+
controlcolumn: 0,
|
|
3474
|
+
stylecolumn: null,
|
|
3475
|
+
strikedatefilter: [],
|
|
3476
|
+
expirationtypefilter: [],
|
|
3477
|
+
custom_columns: {},
|
|
3478
|
+
sortorder: 'asc',
|
|
3479
|
+
strikedateHeader: true,
|
|
3480
|
+
hidePuts: false
|
|
3481
|
+
};
|
|
3482
|
+
MillistreamWidgetApi_AssignObject(MillistreamWidgetSettings, _this.settings);
|
|
3483
|
+
|
|
3484
|
+
if (settings) {
|
|
3485
|
+
MillistreamWidgetApi_AssignObject(settings, _this.settings);
|
|
3486
|
+
}
|
|
3487
|
+
|
|
3488
|
+
_this.unsubscriptions = {};
|
|
3489
|
+
let m_instruments = new Map();
|
|
3490
|
+
let m_cellMap = new Map();
|
|
3491
|
+
let m_currentinsrefs = [];
|
|
3492
|
+
let m_pushfields = [];
|
|
3493
|
+
let m_strikes = [];
|
|
3494
|
+
|
|
3495
|
+
let m_strikepricedecimals = 2;
|
|
3496
|
+
|
|
3497
|
+
let m_lang_en = {
|
|
3498
|
+
askprice: 'Ask',
|
|
3499
|
+
bidprice: 'Bid',
|
|
3500
|
+
askquantity: 'Askquantity',
|
|
3501
|
+
bidquantity: 'Bidquantity',
|
|
3502
|
+
calls: 'CALLS',
|
|
3503
|
+
date: 'Date',
|
|
3504
|
+
dayhighprice: 'High',
|
|
3505
|
+
daylowprice: 'Low',
|
|
3506
|
+
diff1d: '+/-',
|
|
3507
|
+
diff1dprc: '%',
|
|
3508
|
+
lastprice: 'Last',
|
|
3509
|
+
openinterest: 'OI',
|
|
3510
|
+
quantity: 'Quantity',
|
|
3511
|
+
puts: 'PUTS',
|
|
3512
|
+
strikedate: 'Strike date',
|
|
3513
|
+
strikeprice: 'Strike price',
|
|
3514
|
+
symbol: 'Symbol',
|
|
3515
|
+
time: 'Time',
|
|
3516
|
+
rho: 'Rho',
|
|
3517
|
+
theta: 'Theta',
|
|
3518
|
+
delta: 'Delta',
|
|
3519
|
+
vega: 'Vega',
|
|
3520
|
+
gamma: 'Gamma',
|
|
3521
|
+
iv: 'IV',
|
|
3522
|
+
ivask: 'Ask IV',
|
|
3523
|
+
ivbid: 'Bid IV',
|
|
3524
|
+
weeklytype: '(w)',
|
|
3525
|
+
dte: 'DTE',
|
|
3526
|
+
strikes: 'Strikes'
|
|
3527
|
+
};
|
|
3528
|
+
|
|
3529
|
+
let m_lang_sv = {
|
|
3530
|
+
askprice: 'Sälj',
|
|
3531
|
+
bidprice: 'Köp',
|
|
3532
|
+
askquantity: 'Säljvolym',
|
|
3533
|
+
bidquantity: 'Köpvolym',
|
|
3534
|
+
calls: 'Köpoptioner',
|
|
3535
|
+
date: 'Datum',
|
|
3536
|
+
dayhighprice: 'Högst',
|
|
3537
|
+
daylowprice: 'Lägst',
|
|
3538
|
+
diff1d: '+/-',
|
|
3539
|
+
diff1dprc: '%',
|
|
3540
|
+
lastprice: 'Senast',
|
|
3541
|
+
openinterest: 'ÖB',
|
|
3542
|
+
puts: 'Säljoptioner',
|
|
3543
|
+
quantity: 'Volym',
|
|
3544
|
+
strikedate: 'Lösendag',
|
|
3545
|
+
strikeprice: 'Lösenpris',
|
|
3546
|
+
symbol: 'Kortnamn',
|
|
3547
|
+
time: 'Tid',
|
|
3548
|
+
rho: 'Rho',
|
|
3549
|
+
theta: 'Theta',
|
|
3550
|
+
delta: 'Delta',
|
|
3551
|
+
vega: 'Vega',
|
|
3552
|
+
gamma: 'Gamma',
|
|
3553
|
+
iv: 'IV',
|
|
3554
|
+
ivask: 'Sälj IV',
|
|
3555
|
+
ivbid: 'Köp IV',
|
|
3556
|
+
weeklytype: '(v)',
|
|
3557
|
+
dte: 'DTE',
|
|
3558
|
+
strikes: 'Lösenpris'
|
|
3559
|
+
};
|
|
3560
|
+
|
|
3561
|
+
_this.destroyWidget = function() {
|
|
3562
|
+
// if we have subscriptions send in an empty array to unsubscribe all and release it
|
|
3563
|
+
if (MillistreamWidgetApi_isObjectEmpty(_this.unsubscriptions) == false)
|
|
3564
|
+
_this.requestid = _this.settings.streaming.MillistreamWidgetStreamingApi_subscribeInstruments(_this, _this.requestid, []);
|
|
3565
|
+
return 0;
|
|
3566
|
+
};
|
|
3567
|
+
|
|
3568
|
+
_this.get_lang_text = function(string) {
|
|
3569
|
+
if (_this.settings.custom_lang && _this.settings.custom_lang[string]) return _this.settings.custom_lang[string];
|
|
3570
|
+
switch (_this.settings.language) {
|
|
3571
|
+
case 'sv':
|
|
3572
|
+
return m_lang_sv[string];
|
|
3573
|
+
case 'en':
|
|
3574
|
+
return m_lang_en[string];
|
|
3575
|
+
default:
|
|
3576
|
+
return string;
|
|
3577
|
+
}
|
|
3578
|
+
};
|
|
3579
|
+
|
|
3580
|
+
function add_custom_element(el, cl, parent, type, name, onclick, insref) {
|
|
3581
|
+
let element = document.createElement(el);
|
|
3582
|
+
if (cl) element.setAttribute("class", cl);
|
|
3583
|
+
if (parent) parent.appendChild(element);
|
|
3584
|
+
if (onclick) {
|
|
3585
|
+
element.onclick = (function(e) {
|
|
3586
|
+
_this.fire_custom_onclick(onclick, e, insref);
|
|
3587
|
+
});
|
|
3588
|
+
}
|
|
3589
|
+
if (type) element.type = type;
|
|
3590
|
+
if (name) element.value = name;
|
|
3591
|
+
return element;
|
|
3592
|
+
}
|
|
3593
|
+
|
|
3594
|
+
_this.fire_custom_onclick = function(onclick, e, insref) {
|
|
3595
|
+
let instr = m_instruments.get(insref);
|
|
3596
|
+
let obj = {};
|
|
3597
|
+
obj.event = e;
|
|
3598
|
+
obj.source = _this;
|
|
3599
|
+
|
|
3600
|
+
_this.settings.link_field.forEach(function(element) {
|
|
3601
|
+
let info = MillistreamWidgetApi_getColumnInfo(_this, element);
|
|
3602
|
+
if (typeof instr[info[0]] !== 'undefined') obj[element] = instr[info[0]]; // kolla om vi har push
|
|
3603
|
+
else if (typeof instr[element] !== 'undefined') obj[element] = instr[element];
|
|
3604
|
+
});
|
|
3605
|
+
onclick(obj);
|
|
3606
|
+
};
|
|
3607
|
+
|
|
3608
|
+
|
|
3609
|
+
_this.getStrikeDates = function() {
|
|
3610
|
+
return m_strikedates;
|
|
3611
|
+
};
|
|
3612
|
+
|
|
3613
|
+
function getNumDecimals(widget, value) {
|
|
3614
|
+
if (value == null) return 0;
|
|
3615
|
+
let parts = value.toString().split('.');
|
|
3616
|
+
if (parts.length == 2) {
|
|
3617
|
+
while (parts[1].charAt(parts[1].length - 1) == "0") { // remove trailing zeros
|
|
3618
|
+
parts[1] = parts[1].slice(0, -1);
|
|
3619
|
+
}
|
|
3620
|
+
return parts[1].length;
|
|
3621
|
+
}
|
|
3622
|
+
return 0;
|
|
3623
|
+
}
|
|
3624
|
+
|
|
3625
|
+
function sortOptions(resp) {
|
|
3626
|
+
let decimals = 0;
|
|
3627
|
+
let expirys = [];
|
|
3628
|
+
|
|
3629
|
+
for (i = 0; i < resp.instruments.length; i++) {
|
|
3630
|
+
let dec = getNumDecimals(_this, resp.instruments[i].strikeprice);
|
|
3631
|
+
decimals = decimals > dec ? decimals : dec;
|
|
3632
|
+
|
|
3633
|
+
m_instruments.set(resp.instruments[i].insref, resp.instruments[i]);
|
|
3634
|
+
let strike = null;
|
|
3635
|
+
if (typeof expirys[resp.instruments[i].strikedate] === 'undefined') {
|
|
3636
|
+
expirys[resp.instruments[i].strikedate] = 1;
|
|
3637
|
+
let strikedata = {};
|
|
3638
|
+
strikedata.strikedate = resp.instruments[i].strikedate;
|
|
3639
|
+
strikedata.expirationtype = resp.instruments[i].expirationtype;
|
|
3640
|
+
/*let date = new Date(resp.instruments[i].strikedate);
|
|
3641
|
+
let opts;
|
|
3642
|
+
switch (_this.settings.language) {
|
|
3643
|
+
case 'sv':
|
|
3644
|
+
opts = { day: 'numeric', month: 'short' };
|
|
3645
|
+
date = date.toLocaleDateString('sv-SE', opts);
|
|
3646
|
+
let parts = date.split(' ');
|
|
3647
|
+
date = parts[0] + ' ' + parts[1].substring(0, 3);
|
|
3648
|
+
break;
|
|
3649
|
+
default:
|
|
3650
|
+
opts = { month: 'short', day: 'numeric' };
|
|
3651
|
+
date = date.toLocaleDateString('en-US', opts);
|
|
3652
|
+
break;
|
|
3653
|
+
}
|
|
3654
|
+
//strikedata.date = date;*/
|
|
3655
|
+
strikedata.dte = resp.instruments[i].dte;
|
|
3656
|
+
m_strikedates.push(strikedata);
|
|
3657
|
+
}
|
|
3658
|
+
let f = 0;
|
|
3659
|
+
if (resp.instruments[i].strikeprice != null) {
|
|
3660
|
+
for (let s = 0; s < m_strikes.length; s++) {
|
|
3661
|
+
if (m_strikes[s].strikedate == resp.instruments[i].strikedate && m_strikes[s].strikeprice == resp.instruments[i].strikeprice) {
|
|
3662
|
+
strike = m_strikes[s];
|
|
3663
|
+
break;
|
|
3664
|
+
}
|
|
3665
|
+
}
|
|
3666
|
+
} else f = 1;
|
|
3667
|
+
|
|
3668
|
+
if (strike == null) {
|
|
3669
|
+
m_strikes.push({
|
|
3670
|
+
strikedate: resp.instruments[i].strikedate,
|
|
3671
|
+
strikeprice: resp.instruments[i].strikeprice,
|
|
3672
|
+
calls: null,
|
|
3673
|
+
puts: null,
|
|
3674
|
+
future: f
|
|
3675
|
+
});
|
|
3676
|
+
if (resp.instruments[i].expirationtype) m_strikes[m_strikes.length - 1].expirationtype = parseInt(resp.instruments[i].expirationtype);
|
|
3677
|
+
strike = m_strikes[m_strikes.length - 1];
|
|
3678
|
+
}
|
|
3679
|
+
if (resp.instruments[i].derivativeindicator == 0 || resp.instruments[i].derivativeindicator == 3) { // calls and futures
|
|
3680
|
+
strike.calls = resp.instruments[i];
|
|
3681
|
+
} else if (resp.instruments[i].derivativeindicator == 1) { // puts
|
|
3682
|
+
strike.puts = resp.instruments[i];
|
|
3683
|
+
}
|
|
3684
|
+
}
|
|
3685
|
+
m_strikepricedecimals = decimals == 1 ? 2 : decimals;
|
|
3686
|
+
m_strikedates.sort(function(a, b) {
|
|
3687
|
+
return a.strikedate.replace(/-/g, '') - b.strikedate.replace(/-/g, '');
|
|
3688
|
+
});
|
|
3689
|
+
m_strikes.sort(function(a, b) {
|
|
3690
|
+
if (a.strikedate == b.strikedate) {
|
|
3691
|
+
if (a.future == 1 || b.future == 1) {
|
|
3692
|
+
return (b.future - a.future);
|
|
3693
|
+
}
|
|
3694
|
+
return (a.strikeprice - b.strikeprice) * (_this.settings.sortorder == 'asc' ? 1 : -1);
|
|
3695
|
+
}
|
|
3696
|
+
return a.strikedate.replace(/-/g, '') - b.strikedate.replace(/-/g, '');
|
|
3697
|
+
});
|
|
3698
|
+
}
|
|
3699
|
+
_this.applyFilter = function() {
|
|
3700
|
+
check_which_strikes_to_show();
|
|
3701
|
+
};
|
|
3702
|
+
|
|
3703
|
+
function check_which_strikes_to_show() {
|
|
3704
|
+
if (m_strikes.length == 0)
|
|
3705
|
+
return;
|
|
3706
|
+
let strikedate = m_strikes[0].strikedate;
|
|
3707
|
+
let pos = 0;
|
|
3708
|
+
let newinsrefs = [];
|
|
3709
|
+
let s, h1, h2, i;
|
|
3710
|
+
for (i = 0; i < m_strikes.length; i++) {
|
|
3711
|
+
if (m_strikes[i].strikedate != strikedate) {
|
|
3712
|
+
if (_this.settings.strikedateHeader) {
|
|
3713
|
+
h1 = m_strikes[pos].row.parentNode.rows[m_strikes[pos].row.rowIndex - 1];
|
|
3714
|
+
h2 = m_strikes[pos].row.parentNode.rows[m_strikes[pos].row.rowIndex - 2];
|
|
3715
|
+
}
|
|
3716
|
+
if ((_this.settings.strikedatefilter.length != 0 && _this.settings.strikedatefilter.indexOf(strikedate) == -1) || (_this.settings.expirationtypefilter.length != 0 && _this.settings.expirationtypefilter.indexOf(m_strikes[i - 1].expirationtype) == -1) || typeof m_strikes[i].expirationtype === 'undefined') {
|
|
3717
|
+
if (_this.settings.strikedateHeader) {
|
|
3718
|
+
h1.style.display = 'none';
|
|
3719
|
+
h2.style.display = 'none';
|
|
3720
|
+
}
|
|
3721
|
+
for (s = pos; s < i; s++) {
|
|
3722
|
+
m_strikes[s].row.style.display = 'none';
|
|
3723
|
+
}
|
|
3724
|
+
} else {
|
|
3725
|
+
if (_this.settings.strikedateHeader) {
|
|
3726
|
+
h1.style.display = 'table-row';
|
|
3727
|
+
h2.style.display = 'table-row';
|
|
3728
|
+
}
|
|
3729
|
+
for (s = pos; s < i; s++) {
|
|
3730
|
+
m_strikes[s].row.style.display = 'table-row';
|
|
3731
|
+
if (m_strikes[s].calls != null) newinsrefs.push(parseInt(m_strikes[s].calls.insref));
|
|
3732
|
+
if (m_strikes[s].puts != null) newinsrefs.push(parseInt(m_strikes[s].puts.insref));
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3735
|
+
pos = i;
|
|
3736
|
+
strikedate = m_strikes[i].strikedate;
|
|
3737
|
+
}
|
|
3738
|
+
}
|
|
3739
|
+
if (i != 0) {
|
|
3740
|
+
if (_this.settings.strikedateHeader) {
|
|
3741
|
+
h1 = m_strikes[pos].row.parentNode.rows[m_strikes[pos].row.rowIndex - 1];
|
|
3742
|
+
h2 = m_strikes[pos].row.parentNode.rows[m_strikes[pos].row.rowIndex - 2];
|
|
3743
|
+
}
|
|
3744
|
+
for (s = pos; s < i; s++) {
|
|
3745
|
+
if ((_this.settings.strikedatefilter.length != 0 && _this.settings.strikedatefilter.indexOf(m_strikes[s].strikedate) == -1) || (_this.settings.expirationtypefilter.length == 0 && _this.settings.expirationtypefilter.indexOf(m_strikes[s].expirationtype) != -1)) {
|
|
3746
|
+
if (_this.settings.strikedateHeader) {
|
|
3747
|
+
h1.style.display = 'none';
|
|
3748
|
+
h2.style.display = 'none';
|
|
3749
|
+
}
|
|
3750
|
+
for (s = pos; s < i; s++) {
|
|
3751
|
+
m_strikes[s].row.style.display = 'none';
|
|
3752
|
+
}
|
|
3753
|
+
continue;
|
|
3754
|
+
} else {
|
|
3755
|
+
if (_this.settings.strikedateHeader) {
|
|
3756
|
+
h1.style.display = 'table-row';
|
|
3757
|
+
h2.style.display = 'table-row';
|
|
3758
|
+
}
|
|
3759
|
+
}
|
|
3760
|
+
m_strikes[s].row.style.display = 'table-row';
|
|
3761
|
+
if (m_strikes[s].calls != null) newinsrefs.push(parseInt(m_strikes[s].calls.insref));
|
|
3762
|
+
if (m_strikes[s].puts != null) newinsrefs.push(parseInt(m_strikes[s].puts.insref));
|
|
3763
|
+
}
|
|
3764
|
+
}
|
|
3765
|
+
|
|
3766
|
+
if (_this.settings.streaming != false) {
|
|
3767
|
+
const sortedinsrefs = newinsrefs.slice().sort();
|
|
3768
|
+
let comp = (m_currentinsrefs.length === sortedinsrefs.length && m_currentinsrefs.slice().sort().every(function(value, index) {
|
|
3769
|
+
return value === sortedinsrefs[index];
|
|
3770
|
+
}));
|
|
3771
|
+
if (comp == false) {
|
|
3772
|
+
m_currentinsrefs = sortedinsrefs;
|
|
3773
|
+
_this.requestid = _this.settings.streaming.MillistreamWidgetStreamingApi_subscribeInstruments(_this, _this.requestid, m_currentinsrefs);
|
|
3774
|
+
}
|
|
3775
|
+
}
|
|
3776
|
+
}
|
|
3777
|
+
|
|
3778
|
+
_this.streamingCallback = function(insref, mref, json) {
|
|
3779
|
+
let keys = Object.keys(json);
|
|
3780
|
+
for (let s = 0; s < keys.length; s++) {
|
|
3781
|
+
if (m_pushfields.indexOf(parseInt(keys[s])) == -1) {
|
|
3782
|
+
continue; // not needed for display or link
|
|
3783
|
+
}
|
|
3784
|
+
let cellMap = m_cellMap.get(insref + ':' + keys[s]);
|
|
3785
|
+
if (cellMap) {
|
|
3786
|
+
let info = MillistreamWidgetApi_getColumnInfo(_this, keys[s]);
|
|
3787
|
+
_this.settings.stylecolumn = cellMap.stylecolumn;
|
|
3788
|
+
_this.settings.controlcolumn = cellMap.controlcolumn;
|
|
3789
|
+
print_field(_this, cellMap.element, info[0], json[info[0]], _this.settings.num_decimals);
|
|
3790
|
+
}
|
|
3791
|
+
}
|
|
3792
|
+
};
|
|
3793
|
+
|
|
3794
|
+
function buildlist(resp) {
|
|
3795
|
+
m_cellMap.clear();
|
|
3796
|
+
m_instruments.clear();
|
|
3797
|
+
m_strikedates = [];
|
|
3798
|
+
m_strikeprices = [];
|
|
3799
|
+
sortOptions(resp);
|
|
3800
|
+
if (typeof _this.settings.onData !== 'undefined') _this.settings.onData();
|
|
3801
|
+
|
|
3802
|
+
if (m_strikedates.length != 0) {
|
|
3803
|
+
let table = MillistreamWidgetApi_addElement(_this, 'table', 'millistream-optionslist-table', _this.settings.target);
|
|
3804
|
+
let pos = 0;
|
|
3805
|
+
let info;
|
|
3806
|
+
let callheader = null;
|
|
3807
|
+
let putheader = null;
|
|
3808
|
+
let tbody = MillistreamWidgetApi_addElement(_this, 'tbody', null, table);
|
|
3809
|
+
let i;
|
|
3810
|
+
for (i = 0; i < _this.settings.fields.length; i++) {
|
|
3811
|
+
let f = MillistreamWidgetApi_getColumnInfo(_this, _this.settings.fields[i]);
|
|
3812
|
+
if (-1 == m_pushfields.indexOf(f[0])) m_pushfields.push(f[0]);
|
|
3813
|
+
}
|
|
3814
|
+
if (m_strikedates.length == 0) return;
|
|
3815
|
+
for (let s = 0; s < m_strikedates.length; s++) {
|
|
3816
|
+
let display = '';
|
|
3817
|
+
let tr;
|
|
3818
|
+
if (_this.settings.strikedateHeader) {
|
|
3819
|
+
tr = MillistreamWidgetApi_addElement(_this, 'tr', null, tbody);
|
|
3820
|
+
tr.setAttribute('data-strikedate', m_strikedates[s].strikedate);
|
|
3821
|
+
if (_this.settings.strikedatefilter.length != 0 && _this.settings.strikedatefilter.indexOf(m_strikedates[s].strikedate) == -1) {
|
|
3822
|
+
tr.style.display = 'none';
|
|
3823
|
+
display = 'none';
|
|
3824
|
+
}
|
|
3825
|
+
callheader = MillistreamWidgetApi_addElement(_this, 'th', 'millistream-optionslist-header-calls' + ' millistream-string', tr, null, null);
|
|
3826
|
+
putheader = MillistreamWidgetApi_addElement(_this, 'th', 'millistream-optionslist-header-puts' + ' millistream-string', tr, null, null);
|
|
3827
|
+
} else if (_this.settings.strikedatefilter.length != 0 && _this.settings.strikedatefilter.indexOf(m_strikedates[s].strikedate) == -1) {
|
|
3828
|
+
display = 'none';
|
|
3829
|
+
}
|
|
3830
|
+
tr = MillistreamWidgetApi_addElement(_this, 'tr', 'millistream-optionslist-options-table-header', tbody);
|
|
3831
|
+
|
|
3832
|
+
let cpos, added_columns = 0;
|
|
3833
|
+
|
|
3834
|
+
if (display == 'none') tr.style.display = 'none';
|
|
3835
|
+
for (i = 0; i < _this.settings.fields.length; i++) {
|
|
3836
|
+
for (cpos in _this.settings.custom_columns) {
|
|
3837
|
+
if (cpos == added_columns) {
|
|
3838
|
+
MillistreamWidgetApi_addElement(_this, 'th', 'millistream-optionslist-table-th', tr, null, _this.settings.custom_columns[cpos].name);
|
|
3839
|
+
added_columns++;
|
|
3840
|
+
}
|
|
3841
|
+
}
|
|
3842
|
+
info = MillistreamWidgetApi_getColumnInfo(_this, _this.settings.fields[i]);
|
|
3843
|
+
th = MillistreamWidgetApi_addElement(_this, 'th', 'millistream-optionslist-table-th millistream-' + info[1] + ' millistream-' + _this.settings.fields[i], tr, null, info[3]);
|
|
3844
|
+
added_columns++;
|
|
3845
|
+
}
|
|
3846
|
+
for (cpos in _this.settings.custom_columns) {
|
|
3847
|
+
if (cpos == added_columns) {
|
|
3848
|
+
MillistreamWidgetApi_addElement(_this, 'th', 'millistream-optionslist-table-th', tr, null, this.settings.custom_columns[cpos].name);
|
|
3849
|
+
added_columns++;
|
|
3850
|
+
}
|
|
3851
|
+
}
|
|
3852
|
+
th = MillistreamWidgetApi_addElement(_this, 'th', 'millistream-optionslist-table-th millistream-optionslist-yheader millistream-sortable-cursor millistream-sorting-' + _this.settings.sortorder, tr);
|
|
3853
|
+
th.innerHTML = _this.get_lang_text('strikes');
|
|
3854
|
+
th.onclick = (function(e) {
|
|
3855
|
+
_this.settings.sortorder = _this.settings.sortorder == 'asc' ? 'desc' : 'asc';
|
|
3856
|
+
let tmp = [];
|
|
3857
|
+
let first = 0; // ignore first header and future
|
|
3858
|
+
while (first < table.childNodes[0].childNodes.length) {
|
|
3859
|
+
if (table.childNodes[0].childNodes[first].childNodes[0].nodeName == 'TH') {
|
|
3860
|
+
let offset = 0;
|
|
3861
|
+
if (!table.childNodes[0].childNodes[first].classList.contains('millistream-optionslist-options-table-header'))
|
|
3862
|
+
offset = 1;
|
|
3863
|
+
table.childNodes[0].childNodes[first + offset].cells[e.srcElement.cellIndex].classList.remove('millistream-sorting-' + (_this.settings.sortorder == 'asc' ? 'desc' : 'asc'));
|
|
3864
|
+
table.childNodes[0].childNodes[first + offset].cells[e.srcElement.cellIndex].classList.add('millistream-sorting-' + _this.settings.sortorder);
|
|
3865
|
+
for (s = 0; s < tmp.length; s++) {
|
|
3866
|
+
table.childNodes[0].insertBefore(tmp[s], table.childNodes[0].childNodes[first + offset]);
|
|
3867
|
+
}
|
|
3868
|
+
first = first + tmp.length + 1 + offset;
|
|
3869
|
+
tmp = [];
|
|
3870
|
+
}
|
|
3871
|
+
tmp.push(table.childNodes[0].childNodes[first]);
|
|
3872
|
+
table.childNodes[0].removeChild(table.childNodes[0].childNodes[first]);
|
|
3873
|
+
}
|
|
3874
|
+
if (tmp.length > 0) {
|
|
3875
|
+
for (s = 0; s < tmp.length; s++) {
|
|
3876
|
+
table.childNodes[0].insertBefore(tmp[s], table.childNodes[0].childNodes[first]);
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
m_strikes.sort(function(a, b) {
|
|
3880
|
+
if (a.strikedate == b.strikedate) {
|
|
3881
|
+
return (a.strikeprice - b.strikeprice) * (_this.settings.sortorder == 'asc' ? 1 : -1);
|
|
3882
|
+
}
|
|
3883
|
+
return a.strikedate.replace(/-/g, '') - b.strikedate.replace(/-/g, '');
|
|
3884
|
+
});
|
|
3885
|
+
});
|
|
3886
|
+
|
|
3887
|
+
cpos = 0;
|
|
3888
|
+
//added_columns = 0;
|
|
3889
|
+
if (_this.settings.hidePuts == false) {
|
|
3890
|
+
for (i = _this.settings.fields.length - 1; i >= 0; i--) {
|
|
3891
|
+
// flip bid and ask for puts
|
|
3892
|
+
if (_this.settings.fields[i] == 'bidprice' && _this.settings.fields[i].indexOf('askprice') != 0) {
|
|
3893
|
+
info = MillistreamWidgetApi_getColumnInfo(_this, 'askprice');
|
|
3894
|
+
MillistreamWidgetApi_addElement(_this, 'th', 'millistream-optionslist-table-th millistream-' + info[1] + ' millistream-askprice', tr, null, info[3]);
|
|
3895
|
+
} else
|
|
3896
|
+
if (_this.settings.fields[i] == 'askprice' && _this.settings.fields[i].indexOf('bidprice') != 0) {
|
|
3897
|
+
info = MillistreamWidgetApi_getColumnInfo(_this, 'bidprice');
|
|
3898
|
+
MillistreamWidgetApi_addElement(_this, 'th', 'millistream-optionslist-table-th millistream-' + info[1] + ' millistream-bidprice', tr, null, info[3]);
|
|
3899
|
+
} else {
|
|
3900
|
+
info = MillistreamWidgetApi_getColumnInfo(_this, _this.settings.fields[i]);
|
|
3901
|
+
MillistreamWidgetApi_addElement(_this, 'th', 'millistream-optionslist-table-th millistream-' + info[1] + ' millistream-' + _this.settings.fields[i], tr, null, info[3]);
|
|
3902
|
+
}
|
|
3903
|
+
for (cpos in _this.settings.custom_columns) {
|
|
3904
|
+
if (cpos == i + 1) {
|
|
3905
|
+
MillistreamWidgetApi_addElement(_this, 'th', 'millistream-optionslist-table-th', tr, null, _this.settings.custom_columns[cpos].name);
|
|
3906
|
+
added_columns++;
|
|
3907
|
+
}
|
|
3908
|
+
}
|
|
3909
|
+
added_columns++;
|
|
3910
|
+
}
|
|
3911
|
+
for (cpos in _this.settings.custom_columns) {
|
|
3912
|
+
if (cpos == i + 1) {
|
|
3913
|
+
MillistreamWidgetApi_addElement(_this, 'th', 'millistream-optionslist-table-th', tr, null, _this.settings.custom_columns[cpos].name);
|
|
3914
|
+
added_columns++;
|
|
3915
|
+
}
|
|
3916
|
+
}
|
|
3917
|
+
}
|
|
3918
|
+
let numcalls = 0;
|
|
3919
|
+
let numputs = 0;
|
|
3920
|
+
let td;
|
|
3921
|
+
let x;
|
|
3922
|
+
for (i = pos; i < m_strikes.length; i++) {
|
|
3923
|
+
let cellMap;
|
|
3924
|
+
if (m_strikeprices.indexOf(m_strikes[i].strikeprice) == -1) m_strikeprices.push(m_strikes[i].strikeprice);
|
|
3925
|
+
if (m_strikes[i].strikedate == m_strikedates[s].strikedate) {
|
|
3926
|
+
added_columns = 0;
|
|
3927
|
+
let otr = MillistreamWidgetApi_addElement(_this, 'tr', 'millistream-optionlist-row', tbody);
|
|
3928
|
+
otr.onclick = function(e) {
|
|
3929
|
+
if (typeof _this.settings.onRowClick === 'function') {
|
|
3930
|
+
if (e.srcElement.nodeName == 'TD') {
|
|
3931
|
+
if (e.srcElement.cellIndex < _this.settings.fields.length + Object.keys(_this.settings.custom_columns).length) {
|
|
3932
|
+
if (e.srcElement.parentNode.getAttribute('call') !== null)
|
|
3933
|
+
_this.settings.onRowClick(e.srcElement.parentNode.getAttribute('call'));
|
|
3934
|
+
} else
|
|
3935
|
+
if (e.srcElement.cellIndex > _this.settings.fields.length + Object.keys(_this.settings.custom_columns).length) {
|
|
3936
|
+
if (e.srcElement.parentNode.getAttribute('put') !== null)
|
|
3937
|
+
_this.settings.onRowClick(e.srcElement.parentNode.getAttribute('put'));
|
|
3938
|
+
}
|
|
3939
|
+
return;
|
|
3940
|
+
}
|
|
3941
|
+
}
|
|
3942
|
+
};
|
|
3943
|
+
if (display == 'none') otr.style.display = 'none';
|
|
3944
|
+
m_strikes[i].row = otr;
|
|
3945
|
+
if (m_strikes[i].calls) numcalls++;
|
|
3946
|
+
for (x = 0; x < _this.settings.fields.length; x++) {
|
|
3947
|
+
for (cpos in _this.settings.custom_columns) {
|
|
3948
|
+
if (cpos == added_columns) {
|
|
3949
|
+
td = MillistreamWidgetApi_addTableCell2(_this, null, 'millistream-optionslist-call-cell', otr);
|
|
3950
|
+
if (m_strikes[i].calls && (typeof _this.settings.custom_columns[cpos].condition !== 'function' || _this.settings.custom_columns[cpos].condition(m_strikes[i].calls))) {
|
|
3951
|
+
if (_this.settings.custom_columns[cpos].instruments && -1 != _this.settings.custom_columns[cpos].instruments.indexOf(m_strikes[i].insref)) {
|
|
3952
|
+
add_custom_element(_this.settings.custom_columns[cpos].element, _this.settings.custom_columns[cpos].alternate_class, td, _this.settings.custom_columns[cpos].type, _this.settings.custom_columns[cpos].name, _this.settings.custom_columns[cpos].onclick, m_strikes[i].calls.insref);
|
|
3953
|
+
} else {
|
|
3954
|
+
add_custom_element(_this.settings.custom_columns[cpos].element, _this.settings.custom_columns[cpos].class, td, _this.settings.custom_columns[cpos].type, _this.settings.custom_columns[cpos].name, _this.settings.custom_columns[cpos].onclick, m_strikes[i].calls.insref);
|
|
3955
|
+
}
|
|
3956
|
+
}
|
|
3957
|
+
added_columns++;
|
|
3958
|
+
}
|
|
3959
|
+
}
|
|
3960
|
+
|
|
3961
|
+
info = MillistreamWidgetApi_getColumnInfo(_this, _this.settings.fields[x]);
|
|
3962
|
+
td = MillistreamWidgetApi_addTableCell2(_this, _this.settings.fields[x], 'millistream-' + info[1] + ' millistream-optionslist-call-cell ' + ' millistream-' + _this.settings.fields[x], otr, m_strikes[i].calls);
|
|
3963
|
+
if (m_strikes[i].calls) {
|
|
3964
|
+
otr.setAttribute('call', m_strikes[i].calls.insref);
|
|
3965
|
+
cellMap = {
|
|
3966
|
+
insref: m_strikes[i].calls.insref,
|
|
3967
|
+
element: td,
|
|
3968
|
+
stylecolumn: _this.settings.stylecolumn,
|
|
3969
|
+
controlcolumn: _this.settings.controlcolumn
|
|
3970
|
+
};
|
|
3971
|
+
m_cellMap.set(cellMap.insref + ':' + info[0], cellMap);
|
|
3972
|
+
}
|
|
3973
|
+
added_columns++;
|
|
3974
|
+
}
|
|
3975
|
+
for (cpos in _this.settings.custom_columns) {
|
|
3976
|
+
if (cpos == added_columns) {
|
|
3977
|
+
td = MillistreamWidgetApi_addTableCell2(_this, null, 'millistream-optionslist-call-cell', otr);
|
|
3978
|
+
if (m_strikes[i].calls) {
|
|
3979
|
+
if (_this.settings.custom_columns[cpos].instruments && -1 != _this.settings.custom_columns[cpos].instruments.indexOf(m_strikes[i].insref)) {
|
|
3980
|
+
add_custom_element(_this.settings.custom_columns[cpos].element, _this.settings.custom_columns[cpos].alternate_class, td, _this.settings.custom_columns[cpos].type, _this.settings.custom_columns[cpos].name, _this.settings.custom_columns[cpos].onclick, m_strikes[i].calls.insref);
|
|
3981
|
+
} else {
|
|
3982
|
+
add_custom_element(_this.settings.custom_columns[cpos].element, _this.settings.custom_columns[cpos].class, td, _this.settings.custom_columns[cpos].type, _this.settings.custom_columns[cpos].name, _this.settings.custom_columns[cpos].onclick, m_strikes[i].calls.insref);
|
|
3983
|
+
}
|
|
3984
|
+
}
|
|
3985
|
+
added_columns++;
|
|
3986
|
+
}
|
|
3987
|
+
}
|
|
3988
|
+
// add strike column
|
|
3989
|
+
td = MillistreamWidgetApi_addElement(_this, 'td', 'millistream-optionslist-yheader millistream-numeric', otr);
|
|
3990
|
+
td.innerHTML = m_strikes[i].strikeprice == null ? 'Fut | Fwd' : formatNiceNumber(m_strikes[i].strikeprice, _this.settings.thousandseparator, _this.settings.decimalseparator, m_strikepricedecimals);
|
|
3991
|
+
|
|
3992
|
+
if (m_strikes[i].puts) numputs++;
|
|
3993
|
+
let field = null;
|
|
3994
|
+
if (_this.settings.hidePuts == false) {
|
|
3995
|
+
for (x = _this.settings.fields.length - 1; x >= 0; x--) {
|
|
3996
|
+
// flip bid and ask for puts
|
|
3997
|
+
|
|
3998
|
+
field = _this.settings.fields[x];
|
|
3999
|
+
if (_this.settings.fields[x] == 'bidprice' && _this.settings.fields[x].indexOf('askprice') != 0) {
|
|
4000
|
+
info = MillistreamWidgetApi_getColumnInfo(_this, 'askprice');
|
|
4001
|
+
field = 'askprice';
|
|
4002
|
+
} else
|
|
4003
|
+
if (_this.settings.fields[x] == 'askprice' && _this.settings.fields[x].indexOf('bidprice') != 0) {
|
|
4004
|
+
info = MillistreamWidgetApi_getColumnInfo(_this, 'bidprice');
|
|
4005
|
+
field = 'bidprice';
|
|
4006
|
+
} else
|
|
4007
|
+
info = MillistreamWidgetApi_getColumnInfo(_this, _this.settings.fields[x]);
|
|
4008
|
+
|
|
4009
|
+
td = MillistreamWidgetApi_addTableCell2(_this, field, 'millistream-' + info[1] + ' millistream-optionslist-put-cell ' + ' millistream-' + field, otr, m_strikes[i].puts);
|
|
4010
|
+
if (m_strikes[i].puts) {
|
|
4011
|
+
otr.setAttribute('put', m_strikes[i].puts.insref);
|
|
4012
|
+
cellMap = {
|
|
4013
|
+
insref: m_strikes[i].puts.insref,
|
|
4014
|
+
element: td,
|
|
4015
|
+
stylecolumn: _this.settings.stylecolumn == null ? null : _this.settings.stylecolumn.map(x => added_columns + _this.settings.fields.length - x + 2),
|
|
4016
|
+
controlcolumn: _this.settings.controlcolumn == null ? null : added_columns + _this.settings.fields.length - _this.settings.controlcolumn + 2,
|
|
4017
|
+
};
|
|
4018
|
+
m_cellMap.set(cellMap.insref + ':' + info[0], cellMap);
|
|
4019
|
+
}
|
|
4020
|
+
for (cpos in _this.settings.custom_columns) {
|
|
4021
|
+
if (cpos == x + 1) {
|
|
4022
|
+
td = MillistreamWidgetApi_addTableCell2(_this, null, 'millistream-optionslist-put-cell', otr);
|
|
4023
|
+
if (m_strikes[i].puts && (typeof _this.settings.custom_columns[cpos].condition !== 'function' || _this.settings.custom_columns[cpos].condition(m_strikes[i].puts))) {
|
|
4024
|
+
if (_this.settings.custom_columns[cpos].instruments && -1 != _this.settings.custom_columns[cpos].instruments.indexOf(m_strikes[i].insref)) {
|
|
4025
|
+
add_custom_element(_this.settings.custom_columns[cpos].element, _this.settings.custom_columns[cpos].alternate_class, td, _this.settings.custom_columns[cpos].type, _this.settings.custom_columns[cpos].name, _this.settings.custom_columns[cpos].onclick, m_strikes[i].puts.insref);
|
|
4026
|
+
} else {
|
|
4027
|
+
add_custom_element(_this.settings.custom_columns[cpos].element, _this.settings.custom_columns[cpos].class, td, _this.settings.custom_columns[cpos].type, _this.settings.custom_columns[cpos].name, _this.settings.custom_columns[cpos].onclick, m_strikes[i].puts.insref);
|
|
4028
|
+
}
|
|
4029
|
+
}
|
|
4030
|
+
added_columns++;
|
|
4031
|
+
}
|
|
4032
|
+
}
|
|
4033
|
+
}
|
|
4034
|
+
for (cpos in _this.settings.custom_columns) {
|
|
4035
|
+
if (cpos == x + 1) {
|
|
4036
|
+
td = MillistreamWidgetApi_addTableCell2(_this, null, 'millistream-optionslist-put-cell', otr);
|
|
4037
|
+
if (m_strikes[i].puts && (typeof _this.settings.custom_columns[cpos].condition !== 'function' || _this.settings.custom_columns[cpos].condition(m_strikes[i].puts))) {
|
|
4038
|
+
if (_this.settings.custom_columns[cpos].instruments && -1 != _this.settings.custom_columns[cpos].instruments.indexOf(m_strikes[i].insref)) {
|
|
4039
|
+
add_custom_element(_this.settings.custom_columns[cpos].element, _this.settings.custom_columns[cpos].alternate_class, td, _this.settings.custom_columns[cpos].type, _this.settings.custom_columns[cpos].name, _this.settings.custom_columns[cpos].onclick, m_strikes[i].puts.insref);
|
|
4040
|
+
} else {
|
|
4041
|
+
add_custom_element(_this.settings.custom_columns[cpos].element, _this.settings.custom_columns[cpos].class, td, _this.settings.custom_columns[cpos].type, _this.settings.custom_columns[cpos].name, _this.settings.custom_columns[cpos].onclick, m_strikes[i].puts.insref);
|
|
4042
|
+
}
|
|
4043
|
+
}
|
|
4044
|
+
added_columns++;
|
|
4045
|
+
}
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4048
|
+
} else break;
|
|
4049
|
+
}
|
|
4050
|
+
if (_this.settings.strikedateHeader) {
|
|
4051
|
+
callheader.innerHTML = _this.get_lang_text('calls') + ' · ' + m_strikedates[s].strikedate + ' ' + (m_strikedates[s].expirationtype == '2' ? _this.get_lang_text('weeklytype') : ' ') + ' · ' + m_strikedates[s].dte + ' ' + _this.get_lang_text('dte') + ' · ' + numcalls + ' strikes';
|
|
4052
|
+
console.log(callheader.innerHTML);
|
|
4053
|
+
callheader.colSpan = _this.settings.fields.length + 1 + Object.keys(_this.settings.custom_columns).length;
|
|
4054
|
+
putheader.innerHTML = _this.get_lang_text('puts') + ' · ' + m_strikedates[s].strikedate + ' ' + (m_strikedates[s].expirationtype == '2' ? _this.get_lang_text('weeklytype') : ' ') + ' · ' + m_strikedates[s].dte + ' ' + _this.get_lang_text('dte') + ' · ' + numputs + ' strikes';
|
|
4055
|
+
putheader.colSpan = _this.settings.fields.length + Object.keys(_this.settings.custom_columns).length;
|
|
4056
|
+
}
|
|
4057
|
+
pos = i;
|
|
4058
|
+
}
|
|
4059
|
+
check_which_strikes_to_show();
|
|
4060
|
+
}
|
|
4061
|
+
if (_this.settings.onreadyCallback) _this.settings.onreadyCallback();
|
|
4062
|
+
}
|
|
4063
|
+
|
|
4064
|
+
|
|
4065
|
+
_this.drawWidget = function() {
|
|
4066
|
+
|
|
4067
|
+
if (MillistreamWidgetApi_isObjectEmpty(_this.unsubscriptions) == false)
|
|
4068
|
+
_this.requestid = _this.settings.streaming.MillistreamWidgetStreamingApi_subscribeInstruments(_this, _this.requestid, []);
|
|
4069
|
+
|
|
4070
|
+
if (_this.settings.target) {
|
|
4071
|
+
_this.settings.target.innerHTML = '';
|
|
4072
|
+
}
|
|
4073
|
+
|
|
4074
|
+
m_strikes = [];
|
|
4075
|
+
m_pushfields = [];
|
|
4076
|
+
m_currentinsrefs = [];
|
|
4077
|
+
m_cellMap = new Map();
|
|
4078
|
+
|
|
4079
|
+
let url = MillistreamWidgetApi_buildQuery(_this, 'optionslist');
|
|
4080
|
+
millistream_data_api.fetch(url, function(data) {
|
|
4081
|
+
buildlist(data);
|
|
4082
|
+
});
|
|
4083
|
+
};
|
|
4084
|
+
if (this.settings.autodraw == true) this.drawWidget();
|
|
4085
|
+
|
|
4086
|
+
}
|
|
3457
4087
|
var milli_data_api_url = 'https://stage.millistream.com/widgets/3.0.4/data/milli_widget_dataapi.php?';
|
|
3458
4088
|
|
|
3459
4089
|
var millistream_data_api = {
|
|
@@ -3619,10 +4249,10 @@ function MillistreamWidgetApi_buildQuery(widget, type) {
|
|
|
3619
4249
|
}
|
|
3620
4250
|
}
|
|
3621
4251
|
if (typeof widget.settings.headerinterval === 'string' && widget.settings.headerinterval == 'instrumenttype') {
|
|
3622
|
-
if (widget.settings.fields.indexOf('instrumenttype') == -1) {
|
|
4252
|
+
if (widget.settings.fields.indexOf('instrumenttype') == -1 && widget.settings.link_field.indexOf('instrumenttype') == -1) {
|
|
3623
4253
|
url += ',instrumenttype';
|
|
3624
4254
|
}
|
|
3625
|
-
if (widget.settings.fields.indexOf('instrumentsubtype') == -1) {
|
|
4255
|
+
if (widget.settings.fields.indexOf('instrumentsubtype') == -1 && widget.settings.link_field.indexOf('instrumentsubtype') == -1) {
|
|
3626
4256
|
url += ',instrumentsubtype';
|
|
3627
4257
|
}
|
|
3628
4258
|
}
|
|
@@ -3745,7 +4375,7 @@ function MillistreamWidgetApi_buildQuery(widget, type) {
|
|
|
3745
4375
|
if (typeof widget.settings.fundcompany !== 'object' && widget.settings.fundcompany !== null) throw new Error(widget.constructor.name + ': fundcompany is not valid');
|
|
3746
4376
|
url += '&fundcompany=' + widget.settings.fundcompany.join(',');
|
|
3747
4377
|
}
|
|
3748
|
-
if (typeof widget.settings.expirationtype !== 'undefined') {
|
|
4378
|
+
if (typeof widget.settings.expirationtype !== 'undefined' && widget.settings.expirationtype != null) {
|
|
3749
4379
|
if (typeof widget.settings.expirationtype !== 'number' && widget.settings.expirationtype !== null) throw new Error(widget.constructor.name + ': expirationtype is not valid');
|
|
3750
4380
|
url += '&expirationtype=' + widget.settings.expirationtype;
|
|
3751
4381
|
}
|
|
@@ -3796,7 +4426,7 @@ function MillistreamWidgetApi_buildQuery(widget, type) {
|
|
|
3796
4426
|
if (typeof widget.settings.xhr !== 'undefined' && widget.settings.xhr == true) {
|
|
3797
4427
|
url += '&xhr=1';
|
|
3798
4428
|
}
|
|
3799
|
-
|
|
4429
|
+
console.log(url);
|
|
3800
4430
|
return url;
|
|
3801
4431
|
}
|
|
3802
4432
|
|
|
@@ -4012,8 +4642,11 @@ function MillistreamWidgetApi_flashElement(widget, el, newValue, oldValue) {
|
|
|
4012
4642
|
// numeriska funktioner
|
|
4013
4643
|
function MillistreamWidgetApi_isNumber(widget, testsubject) {
|
|
4014
4644
|
if (!testsubject) return;
|
|
4015
|
-
|
|
4016
|
-
|
|
4645
|
+
if(isNaN(testsubject)) {
|
|
4646
|
+
var n = testsubject.replace(widget.settings.decimalseparator, '.').split(widget.settings.thousandseparator).join('');
|
|
4647
|
+
return !isNaN(parseFloat(n)) && isFinite(n);
|
|
4648
|
+
}
|
|
4649
|
+
return !isNaN(parseFloat(testsubject)) && isFinite(testsubject);
|
|
4017
4650
|
}
|
|
4018
4651
|
|
|
4019
4652
|
function MillistreamWidgetApi_getNumDecimals(widget, value, current, validfields) {
|
|
@@ -5108,6 +5741,7 @@ function MillistreamWidgetApi_addTableCell2(widget, key, cl, parent, json, decim
|
|
|
5108
5741
|
if (cl) td.setAttribute('class', cl);
|
|
5109
5742
|
if (info[1] == 'numeric' && json && json[key]) {
|
|
5110
5743
|
var v = 0;
|
|
5744
|
+
if(!isNaN(json[key])) json[key] = json[key].toString();
|
|
5111
5745
|
var res = parseFloat(json[key].replace(widget.settings.decimalseparator, '.').split(widget.settings.thousandseparator).join(''));
|
|
5112
5746
|
if (!isNaN(parseFloat(res)) && isFinite(res)) v = res;
|
|
5113
5747
|
/*if (typeof widget.settings.positiveclass === 'string' && typeof widget.settings.negativeclass) {
|
|
@@ -5858,6 +6492,7 @@ function MillistreamWidgetStreamingApi(settings) {
|
|
|
5858
6492
|
milli_stream_connect();
|
|
5859
6493
|
}
|
|
5860
6494
|
exports.Milli_Chart = Milli_Chart;
|
|
6495
|
+
exports.Milli_OptionsList = Milli_OptionsList;
|
|
5861
6496
|
exports.MillistreamWidgetSettings = MillistreamWidgetSettings;
|
|
5862
6497
|
exports.formatDate = formatDate;
|
|
5863
6498
|
exports.MillistreamWidgetStreamingApi = MillistreamWidgetStreamingApi;
|