<?php 
defined('BASEPATH') OR exit('No direct script access allowed');

?><!DOCTYPE html>
<html lang="en"><head>
	<meta charset="utf-8">
<meta name="robots" content="noindex">
<meta name="googlebot" content="noindex">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">

<!-- jQuery library -->
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    
    <!-- Latest compiled JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js"></script>
     <link href="https://fonts.googleapis.com/css?family=Arimo" rel="stylesheet"> <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">    
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.6.3/css/bootstrap-select.min.css" />
     <script>
// 	 setInterval(function(){ 
//	 	window.location.href = "<?php // echo base_url();?>home/live";
//	 }, 120000);
	//return false;
	 var socket=io.connect("https://swarajtraders.in:4003");
	 $(document).ready(function(){
		setInterval(function(){ 
		<?php if(!($_GET['apikey']) || $_GET['apikey']!='SUdjer1120Opls'){?>$('#fullMcxPriceTable').html("<h4 class='text-danger'>Invalid or Expired API Key</h4>");return false;<?php }?>
		//var gold=$("tr#GOLD td:nth-child(2)").text();
		var gold=$("tr#GOLD td:nth-child(2)").text();
		var goldm=$("tr#GOLDM td:nth-child(2)").text();
		var silver=$("tr#SILVER td:nth-child(2)").text();
		var silverm=$("tr#SILVERM td:nth-child(2)").text();
		var copper=$("tr#COPPER td:nth-child(2)").text();
		var copperm=$("tr#COPPERM td:nth-child(2)").text();
		var aluminium=$("tr#ALUMINIUM td:nth-child(2)").text();
		var alumini=$("tr#ALUMINI td:nth-child(2)").text();
		var crudeoil=$("tr#CRUDEOIL td:nth-child(2)").text();
		var crudeoilm=$("tr#CRUDEOILM td:nth-child(2)").text();
		var lead=$("tr#LEAD td:nth-child(2)").text();
		var leadmini=$("tr#LEADMINI td:nth-child(2)").text();
		var zinc=$("tr#ZINC td:nth-child(2)").text();
		var zincm=$("tr#ZINCMINI td:nth-child(2)").text();
		var nickel=$("tr#NICKEL td:nth-child(2)").text();
		var nickelm=$("tr#NICKELM td:nth-child(2)").text();
		var naturalgas=$("tr#NATURALGAS td:nth-child(2)").text();
		var menthaoil=$("tr#MENTHAOIL td:nth-child(2)").text();
		$.ajax({
		   url: 'https://mcxdata.in/',
		   type: 'GET',headers: { 'Access-Control-Allow-Origin': '*' },
		   success: function(res) {
					var data = $.parseHTML(res); 
					$(data).find('#fullMcxPriceTable').each(function(){
					$('#fullMcxPriceTable').html($(this).html());
					
					//Start Removing ad rows here//
					$("table#fullMcxPriceTable tr:nth-child(7)").remove();
					$("table#fullMcxPriceTable tr:nth-child(17)").remove();
					$("table#fullMcxPriceTable tr:nth-child(15)").remove();
					$("tr#USDINR").remove();$("tr#EURINR").remove();
					$("tr#JPYINR").remove();$("tr#GBPINR").remove();
					
					$("tr#ALUMINI").remove();
					$("tr#LEADMINI").remove();
					$("tr#NICKELM").remove();
					$("tr#ZINCMINI").remove();
					$("tr#CRUDEOILM").remove();
					//End Removing ad rows here 
					var tdata=$('#fullMcxPriceTable').html();
					//socket.emit("rate_update",{table:tdata});
					
					var goldnew=$("tr#GOLD td:nth-child(2)").text();
					var goldmnew=$("tr#GOLDM td:nth-child(2)").text();
				    var silvernew=$("tr#SILVER td:nth-child(2)").text();
					var silvermnew=$("tr#SILVERM td:nth-child(2)").text();
					var coppernew=$("tr#COPPER td:nth-child(2)").text();
					var coppermnew=$("tr#COPPERM td:nth-child(2)").text();
					var aluminiumnew=$("tr#ALUMINIUM td:nth-child(2)").text();
					var alumininew=$("tr#ALUMINI td:nth-child(2)").text();
					var crudeoilnew=$("tr#CRUDEOIL td:nth-child(2)").text();
					var crudeoilmnew=$("tr#CRUDEOILM td:nth-child(2)").text();
					var leadnew=$("tr#LEAD td:nth-child(2)").text();
					var leadmininew=$("tr#LEADMINI td:nth-child(2)").text();
					var zincnew=$("tr#ZINC td:nth-child(2)").text();
					var zincmnew=$("tr#ZINCMINI td:nth-child(2)").text();
					var nickelnew=$("tr#NICKEL td:nth-child(2)").text();
					var nickelmnew=$("tr#NICKELM td:nth-child(2)").text();
					var naturalgasnew=$("tr#NATURALGAS td:nth-child(2)").text();
					var menthaoilnew=$("tr#MENTHAOIL td:nth-child(2)").text();
					
					if(gold!=goldnew){
						var newgoldtr=$("tr#GOLD").html();
						check_new("GOLD",gold,goldnew,100);
					}else{socket.emit("tr_emit",{trdata:$("tr#GOLD").html(),trid:"GOLD",color:"none",single_val:goldnew,trimg:'gold.jpg'});}
					if(goldm!=goldmnew){
						var newgoldtr=$("tr#GOLDM").html();
						check_new("GOLDM",goldm,goldmnew,10);
					}else{socket.emit("tr_emit",{trdata:$("tr#GOLDM").html(),trid:"GOLDM",color:"none",single_val:goldmnew,trimg:'gold.jpg'});}
					if(silver!=silvernew){
						var newsilvertr=$("tr#SILVER").html();
						check_new("SILVER",silver,silvernew,30);
					}else{socket.emit("tr_emit",{trdata:$("tr#SILVER").html(),trid:"SILVER",color:"none",single_val:silvernew,trimg:'silver.jpg'});}
					if(silverm!=silvermnew){
						var newsilvertr=$("tr#SILVERM").html();
						check_new("SILVERM",silverm,silvermnew,5);
					}else{socket.emit("tr_emit",{trdata:$("tr#SILVERM").html(),trid:"SILVERM",color:"none",single_val:silvermnew,trimg:'silver.jpg'});}
					if(copper!=coppernew){
						var newcoppertr=$("tr#COPPER").html();
						check_new("COPPER",copper,coppernew,2500);
					}else{socket.emit("tr_emit",{trdata:$("tr#COPPER").html(),trid:"COPPER",color:"none",single_val:coppernew,trimg:'copper.jpg'});}
					//if(copperm!=coppermnew){
//						var newcoppertr=$("tr#COPPERM").html();
//						check_new("COPPERM",copperm,coppermnew,250);
//					}else{socket.emit("tr_emit",{trdata:$("tr#COPPERM").html(),trid:"COPPERM",color:"none",single_val:coppermnew});}
					if(aluminium!=aluminiumnew){
						var newaluminiumtr=$("tr#ALUMINIUM").html();
						check_new("ALUMINIUM",aluminium,aluminiumnew,5000);
					}else{socket.emit("tr_emit",{trdata:$("tr#ALUMINIUM").html(),trid:"ALUMINIUM",color:"none",single_val:aluminiumnew,trimg:'aluminium.jpg'});}
					//if(alumini!=alumininew){
//						var newaluminitr=$("tr#ALUMINI").html();
//						check_new("ALUMINI",alumini,alumininew,1000);
//					}else{socket.emit("tr_emit",{trdata:$("tr#ALUMINI").html(),trid:"ALUMINI",color:"none",single_val:alumininew});}
					if(crudeoil!=crudeoilnew){
						var crudeoiltr=$("tr#CRUDEOIL").html();
						check_new("CRUDEOIL",crudeoil,crudeoilnew,100);
					}else{socket.emit("tr_emit",{trdata:$("tr#CRUDEOIL").html(),trid:"CRUDEOIL",color:"none",single_val:crudeoilnew,trimg:'crudeoil.jpg'});}
					//if(crudeoilm!=crudeoilmnew){
//						var crudeoilmtr=$("tr#CRUDEOILM").html();
//						check_new("CRUDEOILM",crudeoilm,crudeoilmnew,10);
//					}else{socket.emit("tr_emit",{trdata:$("tr#CRUDEOILM").html(),trid:"CRUDEOILM",color:"none",single_val:crudeoilmnew});}
					if(lead!=leadnew){
						var leadtr=$("tr#LEAD").html();
						check_new("LEAD",lead,leadnew,5000);
					}else{socket.emit("tr_emit",{trdata:$("tr#LEAD").html(),trid:"LEAD",color:"none",single_val:leadnew,trimg:'lead.jpg'});}
					//if(leadmini!=leadmininew){
//						var leadminitr=$("tr#LEADMINI").html();
//						check_new("LEADMINI",leadmini,leadmininew,1000);
//					}else{socket.emit("tr_emit",{trdata:$("tr#LEADMINI").html(),trid:"LEADMINI",color:"none",single_val:leadmininew});}
					if(zinc!=zincnew){
						var zinctr=$("tr#ZINC").html();
						//console.log(zinctr);
						check_new("ZINC",zinc,zincnew,5000);
					}else{socket.emit("tr_emit",{trdata:$("tr#ZINC").html(),trid:"ZINC",color:"none",single_val:zincnew,trimg:'zinc.jpg'});}
					//if(zincm!=zincmnew){
//					    var trdata=$("tr:nth-child(14)").html();
//						//console.log(single_val);
//						//console.log(trdata);
//					 if(parseInt(zincmnew)>parseInt(zincm)){
//						var color="green"; 
//					 }else{
//						var color="red";
//					 }
//					 //var color=getRandomColor();
//					 var trdata=$("tr:nth-child(14)").html();
//					 $("tr:nth-child(14)").css("background-color",color);
//					 socket.emit("tr_emit",{trdata:trdata,trid:"ZINCMINI",color:color,single_val:zincmnew});
//					 setTimeout(function(){ $("tr:nth-child(14)").css("background","none"); }, 5000);
//					 $.ajax({
//							 type: "POST",
//							 url: '<?php echo base_url();?>welcome/check_new',
//							 data: {metal:"ZINCMINI",rate:zincmnew,lotsize:1000},
//							 success: function(res){
//								 //console.log(res);
//								 //alert(response);
//							//	 console.log(response)
//							//	$("#rate_return").html(response);
//								}
//							 });
//		
//					}else{socket.emit("tr_emit",{trdata:$("tr:nth-child(14)").html(),trid:"ZINKMINI",color:"none",single_val:zincmnew});}
					
					
					if(nickel!=nickelnew){
						var nickeltr=$("tr#NICKEL").html();
						check_new("NICKEL",nickel,nickelnew,1500);
					}else{socket.emit("tr_emit",{trdata:$("tr#NICKEL").html(),trid:"NICKEL",color:"none",single_val:nickelnew,trimg:'nickel.jpg'});}
					if(nickelm!=nickelmnew){
						var nickelmtr=$("tr#NICKELM").html();
						check_new("NICKELM",nickelm,nickelmnew,100);
					}else{socket.emit("tr_emit",{trdata:$("tr#NICKELM").html(),trid:"NICKELM",color:"none",single_val:nickelmnew,trimg:'nickel.jpg'});}
					if(naturalgas!=naturalgasnew){
						var naturalgastr=$("tr#NATURALGAS").html();
						check_new("NATURALGAS",naturalgas,naturalgasnew,1250);
					}else{socket.emit("tr_emit",{trdata:$("tr#NATURALGAS").html(),trid:"NATURALGAS",color:"none",single_val:naturalgasnew,trimg:'naturalgas.jpg'});}
					if(menthaoil!=menthaoilnew){
						var menthaoiltr=$("tr#MENTHAOIL").html();
						check_new("MENTHAOIL",menthaoil,menthaoilnew,1);
					}else{socket.emit("tr_emit",{trdata:$("tr#MENTHAOIL").html(),trid:"MENTHAOIL",color:"none",single_val:menthaoilnew,trimg:'menthaoil.jpg'});}
					});
			   }
			});
		 }, 1000); 
		 function check_new(metal,oldrate,rate,lotsize){
	     var trdata=$("tr#"+metal).html();
		 var single_val= $("tr#"+metal + " td:nth-child(2)").text();
		 var timee= $("tr#"+metal + " td:nth-child(8)").text();
		 var openn= $("tr#"+metal + " td:nth-child(5)").text();
		 var highh= $("tr#"+metal + " td:nth-child(6)").text();
		 var loww= $("tr#"+metal + " td:nth-child(7)").text();
		 var trimg=metal.toLowerCase()+'.jpg';
		 //console.log(single_val);
		// console.log(trdata);
		 if(parseInt(rate)>parseInt(oldrate)){
			var color="green"; 
		 }else{
			var color="red";
		 }
		 //var color=getRandomColor();
		 $("tr#"+metal+" td:nth-child(2)").css("background-color",color);
		 socket.emit("tr_emit",{trdata:trdata,trid:metal,color:color,single_val:single_val,trimg:trimg});
		 setTimeout(function(){ $("tr#"+metal+" td:nth-child(2)").css("background","none"); 
		 $.ajax({
				 type: "POST",
				 url: '<?php echo base_url();?>welcome/check_newc',
				 data: {metal:metal,color:'#000'},
				 success: function(res){
					 console.log(res);
					 //alert(response);
				//	 console.log(response)
				//	$("#rate_return").html(response);
					}
				 });
		 }, 5000);
		 $.ajax({
				 type: "POST",
				 url: '<?php echo base_url();?>welcome/check_new',
				 data: {metal:metal,rate:rate,lotsize:lotsize,tt:new Date().getTime(),openn:openn,highh:highh,loww:loww,color:color},
				 success: function(res){
					 console.log(res);
					 //alert(response);
				//	 console.log(response)
				//	$("#rate_return").html(response);
					}
				 });
		}
			$("#metal_select").change(function(){
				var vall=$(this).val();
				var t=vall.split("-");
				$("#cur_rate").attr("class",t[0]);
			//	$("#limit").attr("class",t[0]+"_ticker form-control");
			});
			$("#marketprice").click(function(){
				if ($('input[type="checkbox"]').is(':checked')){
					$("#limit").attr('disabled',true);
				}else{
					$("#limit").removeAttr('disabled');
				}
				//
			});
			$("#test_trade").click(function(){
				$("#test_trade_form").toggle();
			});
			setInterval(function(){
				var cur_rate_class=$("#cur_rate").attr("class");
				//console.log(cur_rate_class);
				//$(".GOLD_ticker").text($("tr#GOLD td:nth-child(2)").text());
				if(cur_rate_class!=""){
				var v=$("tr#"+cur_rate_class+" td:nth-child(2)").text();
				}
				$("#cur_rate").val(v);
				}, 1000);
			//Live Trades
			setInterval(function(){
				$.ajax({
				 type: "POST",
				 url: '<?php echo base_url();?>welcome/live_trades',
				 data: {},
				 success: function(res){
					 $("#live_trades").html(res);
					}
				 });
			 }, 1000);
			 $(".exits").click(function(e){e.preventDefault();
			     var id=$(this).attr("id");
				 var date="<?php echo date("Y-m-d");?>";
				 $.ajax({
				 type: "POST",
				 url: '<?php echo base_url();?>welcome/exit_positions',
				 data: {id:id,date:date},
				 success: function(res){
					 $("#table_"+id).html(res);
					}
				 });
			 });
			 $(".manual_val").click(function(){
				var metal=$("#selected_metal").val().split('-');
				var oldrate=$("#"+metal[0]).text();
				var metal_val=parseFloat($("#metal_val").val());
				if(metal[0]=="" || metal_val==""){alert("Please Select Metal an Put Rate.");return false;}
				///$("tr#"+metal).text(metal_val);
				//var high=parseFloat($("tr#"+metal[0]+" td:nth-child(6)").text());
				//var low=parseFloat($("tr#"+metal[0]+" td:nth-child(7)").text());
				//alert(low);alert(metal_val);
				//if(metal_val>=low && high>=metal_val){
				//$("tr#"+metal[0]+" td:nth-child(2)").text(metal_val);
				check_new(metal[0],oldrate,metal_val,metal[1]);
				//}else{
				//	alert("Incorrect Value");	
				//}
			 });
			 $("#marketprice").click(function(){
				if ($('input[type="checkbox"]').is(':checked')){
					$("#limit").attr('disabled',true);
				}else{
					$("#limit").removeAttr('disabled');
				}
				//
			});
			setInterval(function(){
				var cur_rate_class=$("#cur_rate").attr("class");
				//console.log(cur_rate_class);
				//$(".GOLD_ticker").text($("tr#GOLD td:nth-child(2)").text());
				if(cur_rate_class!=""){
				var v=$("tr#"+cur_rate_class+" td:nth-child(2)").text();
				}
				$("#cur_rate").val(v);
				}, 1000);
			$("#metal_select").change(function(){
				var vall=$(this).val();
				var t=vall.split("-");
				$("#cur_rate").attr("class",t[0]);
			//	$("#limit").attr("class",t[0]+"_ticker form-control");
			});
			$("#marketprice").click(function(){
				if ($('input[type="checkbox"]').is(':checked')){
					$("#limit").attr('disabled',true);
				}else{
					$("#limit").removeAttr('disabled');
				}
				//
			});
		 });
		//function getRandomColor() {
//		  var letters = '0123456789ABCDEF';
//		  var color = '#';
//		  for (var i = 0; i < 6; i++) {
//			color += letters[Math.floor(Math.random() * 16)];
//		  }
//		  return color;
//		}
	 </script>
     <style>label{color:#999;}</style>
</head>
<body style="font-family: 'Arimo', sans-serif;">
<div class="container-fluid">
	<div class="row">
    	<div class="col-md-5">
        	<h4 class="text-danger">Commodity Live MCX Rates</h4>
             <form class="form-inline" action="">
              <div class="form-group">
              <select id="selected_metal" required class="form-control">
              	<option value="">Select Metal</option>
                <?php $this->db->select("metal,lots");$metals=$this->db->get("metals")->result();
				foreach($metals as $m){?>
                <option value="<?php echo $m->metal.'-'.$m->lots;?>"><?php echo $m->metal;?></option>
                <?php }?>
              </select>
              </div>
              <div class="form-group">
                <input type="number" placeholder="Enter Value" required class="form-control" id="metal_val">
              </div>
              <button type="button" class="btn btn-danger manual_val">Update</button>
            </form> 
            <table id="fullMcxPriceTable" class="table table-condensed table-bordered  table-striped">
                <tr><th>Commodity</th><th>Price</th><th>Chg</th><th>%Chg</th><th>Open</th><th>High</th><th>Low</th><th>Time</th></tr>
				<?php $metals=$this->db->get_where("metals",array("rate!="=>""))->result();
					foreach($metals as $d){?>
                <tr>
                	<td><?php echo $d->metal;?></td>
                    <td><?php echo $d->rate;?></td>
                    <td><?php echo $d->chg;?></td>
                    <td><?php echo $d->per_chg;?></td>
                    <td><?php echo $d->open;?></td>
                    <td><?php echo $d->high;?></td>
                    <td><?php echo $d->low;?></td>
                    <td><?php echo $d->mtime;?></td>
                </tr>
                <?php }?>
                </table>
        </div>
        <div class="col-md-7">
        <h4 class="text-primary">Customer Trades<button type="button" id="test_trade" class="btn btn-sm btn-warning pull-right">Add Test Trade</button></h4>
   		
        <ul class="nav nav-tabs">
          <li class="active"><a data-toggle="tab" href="#home">Live Trades</a></li>
          <li><a data-toggle="tab" href="#menu1" class="exits" id="BUY">BUY EXIT</a></li>
          <li><a data-toggle="tab" href="#menu2" class="exits" id="SELL">SELL EXIT</a></li>
          <li><a data-toggle="tab" href="#menu3">Add Customer Trade</a></li>
        </ul>
        
        <div class="tab-content">
          <div id="home" class="tab-pane fade in active">
            <table class="table table-bordered table-condensed table-responsive table-striped">
            <thead><tr><th>S.No.</th><th>Client</th><th>Metal</th><th>TradeType</th><th>Live</th><th>Limit</th><th>Target</th><th>Stoploss</th><th>Profit/Loss</th><th>Time</th><th>Action</th><th>Square Off</th><th>Hold Request</th><th>Hold Allow</th></tr></thead>
            <tbody id="live_trades">
            <tr><td colspan="10"><h3>Loading Trades...</h3></td></tr>
            </tbody>
        </table>
          </div>
          <div id="menu1" class="tab-pane fade">
            <table class="table table-bordered table-condensed table-striped">
            <thead><tr><th>S.No.</th><th>Client</th><th>Metal</th><th>TradeType</th><th>SqOff</th><th>Limit</th><th>Target</th><th>Stoploss</th><th>Profit/Loss</th><th>Time</th><th>Action</th></tr></thead>
            <tbody id="table_BUY">
            </tbody>
        </table>
          </div>
          <div id="menu2" class="tab-pane fade">
            <table class="table table-bordered table-condensed table-striped">
            <thead><tr><th>S.No.</th><th>Client</th><th>Metal</th><th>TradeType</th><th>SqOff</th><th>Limit</th><th>Target</th><th>Stoploss</th><th>Profit/Loss</th><th>Time</th><th>Action</th></tr></thead>
            <tbody id="table_SELL">
            </tbody>
        </table>
          </div>
          <div id="menu3" class="tab-pane fade">
           <form id="test_trade_form" action="<?php echo base_url();?>home/buynow2" method="post" style="background:#FBFBFB; border:5px solid #5E66E5; padding:10px;">
                        <div class="row">
                        <div class="form-group  col-md-4">
                        	<label>Select Customer</label>
                            <select name="customer"class="selectpicker" data-show-subtext="true" data-live-search="true"required>
                            	<option value="">Select Customer</option>
							<?php $this->db->select("id,first_name,mobile");$this->db->order_by("first_name","asc");
                                    $users=$this->db->get('users')->result();foreach($users as $u){?>
                                    <option data-subtext="<?php echo  $u->id.'-'.$u->first_name.'-'.$u->mobile;?>" value="<?php echo $u->id.'-'.$u->first_name;?>"><?php echo $u->first_name.'-'.$u->mobile;?></option>
                                    <?php }?></select>
                        </div>
                        <div class="form-group col-md-4">
                        	<label>TYPE</label><br/>
                        	<label>
                              <input type="radio" name="type" value="BUY" checked> BUY
                            </label>
                            <label>
                              <input type="radio" name="type" value="SELL"> SELL
                            </label>
                        </div>
                    	<div class="form-group col-md-4">
                        	<label>Asset</label>
                            <select name="metal" class="form-control" required id="metal_select">
                            	<option value="">Select Asset</option>
                                <option value="GOLD-100">GOLD</option>
                                <option value="GOLDM-10">GOLDM</option>
                                <option value="SILVER-30">SILVER</option>
                                <option value="SILVERM-5">SILVERM</option>
                                <option value="COPPER-2500">COPPER</option>
                                <option value="COPPERM-250">COPPERM</option>
                                <option value="ALUMINIUM-5000">ALUMINIUM</option>
                                <option value="ALUMINI-1000">ALUMINI</option>
                                <option value="CRUDEOIL-100">CRUDEOIL</option>
                                <option value="CRUDEOILM-10">CRUDEOILM</option>
                                <option value="ZINC-5000">ZINC</option>
                                <option value="ZINCMINI-1000">ZINCMINI</option>
                                <option value="LEAD-5000">LEAD</option>
                                <option value="LEADMINI-1000">LEADMINI</option>
                                <option value="NICKEL-1500">NICKEL</option>
                                <option value="NICKELM-100">NICKELM</option>
                                <option value="NATURALGAS-1200">NATURALGAS</option>
                            </select>
                            <input type="hidden" name="cur_rate" id="cur_rate" value="" class="" />
                        </div>
                        <div class="form-group col-md-3">
                        	<label>Lot Size</label>
                            <input type="text" name="lotsize" required class="form-control" />
                        </div>
                        <div class="form-group col-md-3">
                        	<label>Limit</label>
       <label class="pull-right"><input id="marketprice" type="checkbox" name="marketprice" value="marketprice" /> Market Rate</label>
                            <input type="text" name="setlimit" id="limit"  required class="form-control" />
                        </div>
                        <div class="form-group col-md-3">
                        	<label>Set Target</label>
                            <input type="text" name="target" class="form-control" />
                        </div>
                        <div class="form-group col-md-3">
                        	<label>Set StopLoss</label>
                            <input type="text" name="stoploss" class="form-control" />
                        </div>
                        </div>
                        <button type="submit" class="btn btn-warning  buybtn">Submit</button>
                        
                    </form>
          </div>
        </div>
        </div>
    </div>
</div>
  <script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.6.3/js/bootstrap-select.min.js"></script>
</body>
</html>