Misc little changes, fix up the date and time handling, auto select latest date if no date selected. add Vega

This commit is contained in:
Joe Tretter
2020-04-25 20:56:09 -05:00
parent b5f71423b3
commit 17d89d34e3
3 changed files with 47 additions and 17 deletions

View File

@@ -63,12 +63,12 @@ let datesOut=(dateInp)=>{
let date=dateInp.split(':')[0];
let dte=dateInp.split(':')[1];
let attrActive="";
if (optionChainContext.selectedDte === dte) {
if (optionChainContext.selectedDate === date) {
attrActive="active";
//fillChainTable(dateInp,date);
}
return `<li class="nav-item ${attrActive}"><a href="#" id="TAB_${date}" role="tab" class="nav-link" onclick="fillChainTable('${dateInp}','${dte}')">${date}<br><center>(DTE: ${dte})</center></a></li>`
return `<li class="nav-item ${attrActive}"><a href="#" id="TAB_${date}" role="tab" class="nav-link" onclick="fillChainTable('${dateInp}','${date}')">${date}<br><center>(DTE: ${dte})</center></a></li>`
}
let getCallArtifact=(callData,allColumns)=>{
@@ -131,7 +131,7 @@ let getStrikeArtifact=(strike)=>{
let fillChainRow=(rowData)=>{
let theTable=document.getElementById("tblOptionChain");
let theNewRow=theTable.insertRow(-1);
let allColumns=["delta","theta"];
let allColumns=["delta","theta","vega"];
theNewRow.innerHTML=getCallArtifact(rowData.call,allColumns) + getStrikeArtifact(rowData.strike) + getPutArtifact(rowData.put,allColumns);
}
@@ -143,7 +143,7 @@ let clearChainTable=()=>{
}
}
let fillChainTable=(expirationDate,dteOnly)=>{
let fillChainTable=(expirationDate,dateOnly)=>{
// Maintain Active Tab
$(".nav a").on("click", function(){
$(".nav").find(".active").removeClass("active");
@@ -151,7 +151,7 @@ let fillChainTable=(expirationDate,dteOnly)=>{
});
clearChainTable();
optionChainContext.selectedDte=dteOnly;
optionChainContext.selectedDate=dateOnly;
let allCalls=dta.callExpDateMap[expirationDate];
let allPuts=dta.putExpDateMap[expirationDate];
//console.log(expirationDate,allCalls,allPuts);
@@ -185,7 +185,7 @@ let displayOptionChain=()=>{
<th colspan="4" class='center'>CALLS</th><th></th><th colspan="4" class='center'>PUTS</th>
</tr>
<tr>
<th class='ralign'>Delta</th><th class='ralign'>Theta</th><th class='ralign'>Bid</th><th class='ralign'>Ask</th><th class='center'>Strike</th><th class='ralign'>Delta</th><th class='ralign'>Theta</th><th class='ralign'>Bid</th><th class='ralign'>Ask</th>
<th class='ralign'>Delta</th><th class='ralign'>Theta</th><th class='ralign'>Vega</th><th class='ralign'>Bid</th><th class='ralign'>Ask</th><th class='center'>Strike</th><th class='ralign'>Delta</th><th class='ralign'>Theta</th><th class='ralign'>Vega</th><th class='ralign'>Bid</th><th class='ralign'>Ask</th>
</tr>
</thead>
<tbody>