diff --git a/client/css/optiTrainer.css b/client/css/optiTrainer.css index 4650afe..a6bd8e9 100644 --- a/client/css/optiTrainer.css +++ b/client/css/optiTrainer.css @@ -82,6 +82,14 @@ body { background-color: #cccccc; } +#frmChangePrice { + position: absolute; + width: 200px; + background-color: #FF0000; + border-radius: 4px; + padding: 10px; +} + #frmOrder { background-color:#ccff00; position:fixed; diff --git a/client/js/masterFilter.js b/client/js/masterFilter.js index ee222a1..d653dfe 100644 --- a/client/js/masterFilter.js +++ b/client/js/masterFilter.js @@ -93,6 +93,7 @@ let createMasterFilterFrame=()=>{ return(_filterContext.theSymbol); } me.symbolChanged=(newSymbol)=>{ + localStorage["defaults"]=JSON.stringify({Symbol:newSymbol}); newSymbol=me.toBrokerName(newSymbol); console.log("symbolChanged",newSymbol); _filterContext.theSymbol=newSymbol diff --git a/client/js/optiTrainer.js b/client/js/optiTrainer.js index 1cd7426..23d7e25 100644 --- a/client/js/optiTrainer.js +++ b/client/js/optiTrainer.js @@ -5,10 +5,20 @@ $(document).ready(_=>{ dta={}; createOrderFrame(); createMasterFilterFrame(); + let selectDataFirst=_=>{ return {enabled:false, tooltip:"Select a Ticker!"}; } $("#datePicker").datepicker({beforeShowDay:selectDataFirst}); + + let selectedSymbol; + try { + selectedSymbol=JSON.parse(localStorage["defaults"]).Symbol; + document.getElementById("frmMasterFilter").symbolChanged(selectedSymbol); + } catch (ex) { + console.log("No symbol found to preset",ex); + } + }); diff --git a/client/js/orderFrame.js b/client/js/orderFrame.js index 5006f9b..ee85315 100644 --- a/client/js/orderFrame.js +++ b/client/js/orderFrame.js @@ -9,6 +9,17 @@ let createOrderFrame=()=>{
0
+ `; $('#app').append(me); @@ -32,6 +43,7 @@ let createOrderFrame=()=>{ } if (me.getElementsByClassName("quantity")[0] !== undefined) { me.getElementsByClassName("quantity")[0].innerText = me.quantity; + me.getElementsByClassName("singlePrice")[0].innerText = me.singleCostAmount.toLocaleString('en',{minimumFractionDigits: 0, maximumFractionDigits: 2}).padStart(7,"\xa0"); me.getElementsByClassName("totalCost")[0].innerText = me.totalCostAmount.toLocaleString('en',{minimumFractionDigits: 0, maximumFractionDigits: 2}); } }; @@ -49,6 +61,19 @@ let createOrderFrame=()=>{ } } + me.displayFrmPriceChange=_=>{ + $("#changePriceValue").val(parseInt(me.price*100,10)); + let clickElePos=$(event.target).position(); + $("#frmChangePrice").css("left",clickElePos.left).css("top",clickElePos.top); + $("#frmChangePrice").data('targetLine',event.target.parentElement); + $("#frmChangePrice").show(); + } + + me.changePrice=newPrice=>{ + me.price=newPrice; + me.updateNumbers(); + } + me.removeFromOrder=_=>{ me.quantity=0; me.updateNumbers(); @@ -70,12 +95,13 @@ let createOrderFrame=()=>{ let optionDetails=splitOptionDetails(optionData.symbol); me.innerHTML=` - [X] ${myMasterFilter.selectedDate}|${myMasterFilter.selectedTime.substr(0,5)}|${((openType==="buy")?" ":"") + openType}@${Math.abs(me.singleCostAmount).toLocaleString('en',{minimumFractionDigits: 0, maximumFractionDigits: 2}).padStart(7,"\xa0")}|${me.quantity} + [X]${myMasterFilter.selectedDate}|${myMasterFilter.selectedTime.substr(0,5)}|${((openType==="buy")?" ":"") + openType}@${Math.abs(me.singleCostAmount).toLocaleString('en',{minimumFractionDigits: 0, maximumFractionDigits: 2}).padStart(7,"\xa0")}|${me.quantity}
- [+][-] + [+][-]
- ${optionDetails.symbol} ${optionDetails.date} ${optionDetails.putCall} ${optionDetails.strike} => ${me.totalCostAmount.toLocaleString('en',{minimumFractionDigits: 0, maximumFractionDigits: 2})} + ${optionDetails.symbol} ${optionDetails.date} ${optionDetails.putCall} ${optionDetails.strike} => + ${me.totalCostAmount.toLocaleString('en',{minimumFractionDigits: 0, maximumFractionDigits: 2})}
`;