Şuanki Dizin: /home/wwwdreamtechnolo/www/sharemarkettraders.com/software/lib/ |
Şuanki Dosya : /home/wwwdreamtechnolo/www/sharemarkettraders.com/software/lib/function.php |
<?php date_default_timezone_set("Asia/Kolkata"); $project_title = "www.ShareMarketTraders.com"; session_start(); class login_function { private $con; function __construct() { //$this->con = new mysqli("localhost","root","","sandixalgotrader_main_db"); $this->con = new mysqli("localhost","wwwdreamtechnolo_share_market_admin","48uu1didxtt1","wwwdreamtechnolo_share_market"); } function get_all_last_candles_data_for_ema($var_symbol_token) { if($stmt = $this->con->prepare("SELECT `close` FROM `candle_data` WHERE `interval`='FIVE_MINUTE' AND `symbol_token`='$var_symbol_token' ORDER BY `id` DESC LIMIT 29")) { $stmt->bind_result($close_price); if($stmt->execute()) { $data = array(); $counter = 0; while($stmt->fetch()) { $data[$counter]['Close'] = $close_price; $counter++; } if(!empty($data)) { return $data; } else { return false; } } } } function get_all_last_candles_data_for_ema_new($var_symbol_token) { if($stmt = $this->con->prepare("SELECT `close` FROM `candle_data` WHERE `interval`='FIVE_MINUTE' AND `symbol_token`='$var_symbol_token' ORDER BY `id` DESC LIMIT 30")) { $stmt->bind_result($close_price); if($stmt->execute()) { $data = array(); $counter = 0; while($stmt->fetch()) { $data[$counter] = $close_price; $counter++; } if(!empty($data)) { return $data; } else { return false; } } } } function update_user_trade_on_off_status($status,$symbol_token,$mobile_no) { if($stmt = $this->con->prepare("UPDATE `user_stock_quantity` SET `status`=? WHERE `symbol_token` = ? AND `mobile_no`=?")) { $stmt->bind_param("sss",$status,$symbol_token,$mobile_no); if($stmt->execute()) { return true; } else { echo $stmt->error; } return false; } } function update_trade_token_and_quantity($stock_quantity,$isexist) { $date = date("Y-m-d"); $time = date("H:i:s A"); if($stmt_select = $this->con->prepare("UPDATE `user_stock_quantity` SET `quantity`=?,`date`=?,`time`=? WHERE `id`=?")) { $stmt_select->bind_param("sssi",$stock_quantity,$date,$time,$isexist); if($stmt_select->execute()) { return true; } return false; } } function update_trade_token_and_quantity_api($stock_quantity,$isexist,$status) { $date = date("Y-m-d"); $time = date("H:i:s A"); if($stmt_select = $this->con->prepare("UPDATE `user_stock_quantity` SET `quantity`=?,`date`=?,`time`=?,`status`=? WHERE `id`=?")) { $stmt_select->bind_param("ssssi",$stock_quantity,$date,$time,$status,$isexist); if($stmt_select->execute()) { return true; } return false; } } function insert_trade_token_and_quantity($stock_quantity,$stock_symbol_token,$current_login_admin) { $current_date = date("Y-m-d"); $current_time = date("h:i:s A"); $status = "OFF"; if($stmt = $this->con->prepare("INSERT INTO `user_stock_quantity`(`mobile_no`, `symbol_token`, `quantity`, `status`, `date`, `time`) VALUES (?,?,?,?,?,?)")) { $stmt->bind_param("ssssss",$current_login_admin,$stock_symbol_token,$stock_quantity,$status,$current_date,$current_time); if($stmt->execute()) { return true; } } return false; } function insert_trade_token_and_quantity_api($stock_quantity,$stock_symbol_token,$current_login_admin,$status) { $current_date = date("Y-m-d"); $current_time = date("h:i:s A"); //$status = "OFF"; if($stmt = $this->con->prepare("INSERT INTO `user_stock_quantity`(`mobile_no`, `symbol_token`, `quantity`, `status`, `date`, `time`) VALUES (?,?,?,?,?,?)")) { $stmt->bind_param("ssssss",$current_login_admin,$stock_symbol_token,$stock_quantity,$status,$current_date,$current_time); if($stmt->execute()) { return true; } } return false; } function get_trade_stock_quantity($stock_symbol_token,$current_login_admin) { if($stmt_select = $this->con->prepare("SELECT `quantity` FROM `user_stock_quantity` WHERE `symbol_token`=? AND `mobile_no`=?")) { $stmt_select->bind_param("ss",$stock_symbol_token,$current_login_admin); $stmt_select->bind_result($result_quantity); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_quantity; } } return false; } } function get_id_of_stock_exist_quantity($stock_symbol_token,$current_login_admin) { if($stmt_select = $this->con->prepare("SELECT `id` FROM `user_stock_quantity` WHERE `symbol_token`=? AND `mobile_no`=?")) { $stmt_select->bind_param("ss",$stock_symbol_token,$current_login_admin); $stmt_select->bind_result($result_quantity); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_quantity; } } return false; } } function get_trade_stock_status($stock_symbol_token,$current_login_admin) { if($stmt_select = $this->con->prepare("SELECT `status` FROM `user_stock_quantity` WHERE `symbol_token`=? AND `mobile_no`=?")) { $stmt_select->bind_param("ss",$stock_symbol_token,$current_login_admin); $stmt_select->bind_result($result_status); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_status; } } return false; } } function get_trade_stock_quantity_and_status($stock_symbol_token,$current_login_admin) { if($stmt_select = $this->con->prepare("SELECT `status`,`quantity` FROM `user_stock_quantity` WHERE `symbol_token`=? AND `mobile_no`=?")) { $stmt_select->bind_param("ss",$stock_symbol_token,$current_login_admin); $stmt_select->bind_result($result_status,$quantity); if($stmt_select->execute()) { if($stmt_select->fetch()) { $data = array(); $data[0] = $result_status; $data[1] = $quantity; return $data; } return false; } return false; } } function get_current_symbol_token_from_string($request_option_string) { if($stmt_select = $this->con->prepare("Select `token_no` from `symbol_tokens_chart` where `symbol_name` = ?")) { $stmt_select->bind_param("s",$request_option_string); $stmt_select->bind_result($result_token); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_token; } } return false; } } function get_token_no_exist_in_symbol_token_chart($token) { if($stmt_select = $this->con->prepare("Select `id` from `symbol_tokens_chart` where `token_no` = ?")) { $stmt_select->bind_param("s",$token); $stmt_select->bind_result($result_id); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_id; } } return false; } } function update_symbol_token_data_in_chart($token,$symbol_name,$stock_name,$exch_seg) { $date = date("Y-m-d"); $time = date("H:i:s A"); if($stmt_select = $this->con->prepare("update `symbol_tokens_chart` set `symbol_name`='".$symbol_name."',`stock_name`='".$stock_name."',`exch_seg`='".$exch_seg."',`date`='".$date."',`time`='".$time."' where `token_no` = '".$token."'")) { if($stmt_select->execute()) { return true; } return false; } } function import_save_symbol_tokens_data($token,$symbol_name,$stock_name,$exch_seg) { $current_date = date("Y-m-d"); $current_time = date("h:i:s A"); if($stmt = $this->con->prepare("INSERT INTO `symbol_tokens_chart`( `token_no`, `symbol_name`, `stock_name`, `exch_seg`, `date`, `time`) VALUES (?,?,?,?,?,?)")) { $stmt->bind_param("ssssss",$token,$symbol_name,$stock_name,$exch_seg,$current_date,$current_time); if($stmt->execute()) { return true; } } return false; } function get_all_symbol_tokens_chart_data() { if($stmt = $this->con->prepare("SELECT `token_no`, `symbol_name`, `stock_name`, `exch_seg`, `date`, `time`,`id` FROM `symbol_tokens_chart`")) { $stmt->bind_result($token_no, $symbol_name, $stock_name, $exch_seg,$date,$time,$res_id); if($stmt->execute()) { $data = array(); $counter = 0; while($stmt->fetch()) { $data[$counter][0] = $token_no; $data[$counter][1] = $symbol_name; $data[$counter][2] = $stock_name; $data[$counter][3] = $exch_seg; $data[$counter][4] = $date; $data[$counter][5] = $time; $data[$counter][6] = $res_id; $counter++; } if(!empty($data)) { return $data; } else { return false; } } } } function add_market($var_strategy_name,$var_symbol_token,$var_variety,$var_exchange,$var_transaction_type,$var_order_type,$var_quantity,$var_product_type,$var_squareoff_points,$var_stoploss_points,$var_duration,$var_status,$no_of_trades_limit) { $current_date = date("Y-m-d"); $current_time = date("h:i:s A"); if($stmt = $this->con->prepare("INSERT INTO `market_strategies`( `strategy_name`, `symbol_token`, `variety`, `exchange`, `transaction_type`, `order_type`, `quantity`, `product_type`, `squareoff_points`, `stoploss_points`, `duration`, `status`, `date`, `time`,`no_of_trades_limit`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")) { $stmt->bind_param("sssssssssssssss",$var_strategy_name,$var_symbol_token,$var_variety,$var_exchange,$var_transaction_type,$var_order_type,$var_quantity,$var_product_type,$var_squareoff_points,$var_stoploss_points,$var_duration,$var_status,$current_date,$current_time,$no_of_trades_limit); if($stmt->execute()) { return true; } } return false; } function get_all_market_info() { if($stmt = $this->con->prepare("SELECT `id`, `strategy_name`, `symbol_token`, `variety`, `exchange`, `transaction_type`, `order_type`, `quantity`, `product_type`, `squareoff_points`, `stoploss_points`, `duration`, `status`, `date`, `time`,`no_of_trades_limit` FROM `market_strategies` ")) { $stmt->bind_result($res_id,$res_strategy_name,$res_symbol_token,$res_variety,$res_exchange,$res_transaction_type,$res_order_type,$res_quantity,$res_product_type,$res_squareoff_points,$res_stoploss_points,$res_duration,$res_status,$res_date,$res_time,$no_of_trades_limit); if($stmt->execute()) { $data = array(); $counter = 0; while($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $res_strategy_name; $data[$counter][2] = $res_symbol_token; $data[$counter][3] = $res_variety; $data[$counter][4] = $res_exchange; $data[$counter][5] = $res_transaction_type; $data[$counter][6] = $res_order_type; $data[$counter][7] = $res_quantity; $data[$counter][8] = $res_product_type; $data[$counter][9] = $res_squareoff_points; $data[$counter][10]= $res_stoploss_points; $data[$counter][11] =$res_duration; $data[$counter][12]= $res_status; $data[$counter][13]=$res_date; $data[$counter][14]=$res_time; $data[$counter][15]=$no_of_trades_limit; $counter++; } if(!empty($data)) { return $data; } else { return false; } } } } function get_stock_setting_data($symboltoken,$strategy_type) { if($stmt = $this->con->prepare("SELECT `id`, `strategy_name`, `symbol_token`, `variety`, `exchange`, `transaction_type`, `order_type`, `quantity`, `product_type`, `squareoff_points`, `stoploss_points`, `duration`, `status`, `date`, `time` FROM `market_strategies` WHERE `strategy_name`=? AND `symbol_token`=?")) { $stmt->bind_param("ss",$strategy_type,$symboltoken); $stmt->bind_result($res_id,$res_strategy_name,$res_symbol_token,$res_variety,$res_exchange,$res_transaction_type,$res_order_type,$res_quantity,$res_product_type,$res_squareoff_points,$res_stoploss_points,$res_duration,$res_status,$res_date,$res_time); if($stmt->execute()) { if($stmt->fetch()) { $data = array(); $data['id'] = $res_id; $data['strategy_name'] = $res_strategy_name; $data['symboltoken'] = $res_symbol_token; $data['variety'] = $res_variety; $data['exchange'] = $res_exchange; $data['transactiontype'] = $res_transaction_type; $data['ordertype'] = $res_order_type; $data['quantity'] = $res_quantity; $data['producttype'] = $res_product_type; $data['squareoff'] = $res_squareoff_points; $data['stoploss']= $res_stoploss_points; $data['duration'] =$res_duration; $data['trade_execute_on_off']= $res_status; return $data; } return false; } } } function delete_student_form($delete_id) { if($stmt = $this->con->prepare("DELETE FROM `market_strategies` WHERE `id`=?")) { $stmt->bind_param("i",$delete_id); if($stmt->execute()) { return true; } return false; } } function delete_previous_candle_data($delete_date) { if($stmt = $this->con->prepare("DELETE FROM `candle_data` WHERE `date` < ?")) { $stmt->bind_param("s",$delete_date); if($stmt->execute()) { return true; } return false; } } function delete_all_previous_tokens() { if($stmt = $this->con->prepare("DELETE FROM `symbol_tokens_chart`")) { if($stmt->execute()) { return true; } return false; } } function delete_strategy_data($delete_id) { if($stmt = $this->con->prepare("DELETE FROM `market_strategies` WHERE `id`=?")) { $stmt->bind_param("i",$delete_id); if($stmt->execute()) { return true; } return false; } } function update_market_details($var_strategy_name,$var_symbol_token,$var_variety,$var_exchange,$var_transaction_type,$var_order_type,$var_quantity,$var_product_type,$var_squareoff_points,$var_stoploss_points,$var_duration,$var_status,$var_edit_id,$no_of_trades_limit) { $current_date = date("Y-m-d"); $current_time = date("h:i:s A"); if($stmt = $this->con->prepare("UPDATE `market_strategies` SET `strategy_name`=?,`symbol_token`=?,`variety`=?,`exchange`=?,`transaction_type`=?,`order_type`=?,`quantity`=?,`product_type`=?,`squareoff_points`=?,`stoploss_points`=?,`duration`=?,`status`=?,`date`=?,`time`=?,`no_of_trades_limit`=? WHERE `id`=?")) { $stmt->bind_param("sssssssssssssssi",$var_strategy_name,$var_symbol_token,$var_variety,$var_exchange,$var_transaction_type,$var_order_type,$var_quantity,$var_product_type,$var_squareoff_points,$var_stoploss_points,$var_duration,$var_status,$current_date,$current_time,$no_of_trades_limit,$var_edit_id); if($stmt->execute()) { return true; } else { echo $stmt->error; } return false; } } function update_market_strategy_status($market_status,$strategy_id) { if($stmt = $this->con->prepare("UPDATE `market_strategies` SET `status`=? WHERE `id`=?")) { $stmt->bind_param("si",$market_status,$strategy_id); if($stmt->execute()) { return true; } else { echo $stmt->error; } return false; } } function update_target_or_stoploss_status($target_stoploss,$order_number) { if($stmt = $this->con->prepare("UPDATE `trading_history` SET `target_stoploss`=? WHERE `order_number`=?")) { $stmt->bind_param("ss",$target_stoploss,$order_number); if($stmt->execute()) { return true; } else { echo $stmt->error; } return false; } } function get_market_form_details($var_edit_id) { if($stmt = $this->con->prepare("SELECT `id`, `strategy_name`, `symbol_token`, `variety`, `exchange`, `transaction_type`, `order_type`, `quantity`, `product_type`, `squareoff_points`, `stoploss_points`, `duration`, `status`, `date`, `time`,`no_of_trades_limit` FROM `market_strategies` WHERE `id`=?")) { $stmt->bind_param("i",$var_edit_id); $stmt->bind_result($res_id,$res_strategy_name,$res_symbol_token,$res_variety,$res_exchange,$res_transaction_type,$res_order_type,$res_quantity,$res_product_type,$res_squareoff_points,$res_stoploss_points,$res_duration,$res_status,$res_date,$res_time,$no_of_trades_limit); if($stmt->execute()) { $data = array(); $counter = 0; if($stmt->fetch()) { $data[0] = $res_id; $data[1] = $res_strategy_name; $data[2] = $res_symbol_token; $data[3] = $res_variety; $data[4] = $res_exchange; $data[5] = $res_transaction_type; $data[6] = $res_order_type; $data[7] = $res_quantity; $data[8] = $res_product_type; $data[9] = $res_squareoff_points; $data[10]=$res_stoploss_points; $data[11] =$res_duration; $data[12]=$res_status; $data[13]=$res_date; $data[14]=$res_time; $data[15]=$no_of_trades_limit; return $data; } return false; } } } function stock_entry($var_stock_name,$var_symbol_token,$var_exchange_type,$var_time_interval,$var_next_expiry,$one_minute_five_minute_status,$order_limit_points) { $current_date = date("Y-m-d"); $current_time = date("h:i:s A"); if($stmt = $this->con->prepare("INSERT INTO `stocks`( `stock_name`, `symbol_token`, `exchange_type`, `time_interval`, `date`, `time`,`next_expiry`, `one_minute_five_minute`, `order_limit_points`) VALUES (?,?,?,?,?,?,?,?,?)")) { $stmt->bind_param("sssssssss",$var_stock_name,$var_symbol_token,$var_exchange_type,$var_time_interval,$current_date,$current_time,$var_next_expiry,$one_minute_five_minute_status,$order_limit_points); if($stmt->execute()) { return $stmt->insert_id; } else{ echo $stmt->error; return false; } } } function get_all_stock_entry() { if($stmt = $this->con->prepare("SELECT `id`, `stock_name`, `symbol_token`, `exchange_type`, `time_interval`, `date`, `time`,`next_expiry`, `one_minute_five_minute`, `order_limit_points` FROM `stocks`")) { $stmt->bind_result($res_id,$stock_name,$symbol_token,$exchange_type,$time_interval,$date,$time,$next_expiry, $one_minute_five_minute, $order_limit_points); if($stmt->execute()) { $data = array(); $counter = 0; while($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $stock_name; $data[$counter][2] = $symbol_token; $data[$counter][3] = $exchange_type; $data[$counter][4] = $time_interval; $data[$counter][5] = $date; $data[$counter][6] = $time; $data[$counter][7] = $next_expiry; $data[$counter][8] = $one_minute_five_minute; $data[$counter][9] = $order_limit_points; $counter++; } if(!empty($data)) { return $data; } else { return false; } } } } function get_all_stock_entry_api() { if($stmt = $this->con->prepare("SELECT `id`, `stock_name`, `symbol_token`, `exchange_type`, `time_interval`, `date`, `time`,`next_expiry`, `one_minute_five_minute`, `order_limit_points` FROM `stocks`")) { $stmt->bind_result($res_id,$stock_name,$symbol_token,$exchange_type,$time_interval,$date,$time,$next_expiry, $one_minute_five_minute, $order_limit_points); if($stmt->execute()) { $data = array(); $counter = 0; while($stmt->fetch()) { $data[$counter]['market_id'] = $res_id; $data[$counter]['stock_name'] = $stock_name; $data[$counter]['symbol_token'] = $symbol_token; $data[$counter]['exchange_type'] = $exchange_type; $data[$counter]['interval'] = $time_interval; //$data[$counter][5] = $date; //$data[$counter][6] = $time; //$data[$counter][7] = $next_expiry; //$data[$counter][8] = $one_minute_five_minute; //$data[$counter][9] = $order_limit_points; $counter++; } if(!empty($data)) { return $data; } else { return false; } } } } function update_stock_entry($var_stock_name,$var_symbol_token,$var_exchange_type,$var_time_interval,$var_edit_id,$var_next_expiry,$one_minute_five_minute_status,$order_limit_points) { $current_date = date("Y-m-d"); $current_time = date("h:i:s A"); if($stmt = $this->con->prepare("UPDATE `stocks` SET `stock_name`=?,`symbol_token`=?,`exchange_type`=?,`time_interval`=?,`date`=?,`time`=?,`next_expiry`=?,`one_minute_five_minute`=?,`order_limit_points`=? WHERE `id`=?")) { $stmt->bind_param("sssssssssi",$var_stock_name,$var_symbol_token,$var_exchange_type,$var_time_interval,$current_date,$current_time,$var_next_expiry,$one_minute_five_minute_status,$order_limit_points,$var_edit_id); if($stmt->execute()) { return true; } else { $stmt->error(); } return false; } } function get_stock_entry_by_id($var_edit_id) { if($stmt = $this->con->prepare("SELECT `id`, `stock_name`, `symbol_token`, `exchange_type`, `time_interval`, `date`, `time`,`next_expiry`, `one_minute_five_minute`, `order_limit_points` FROM `stocks` where `id`=? ")) { $stmt->bind_param("i",$var_edit_id); $stmt->bind_result($id,$var_stock_name,$var_symbol_token,$var_exchange_type,$var_time_interval,$current_date,$current_time,$next_expiry, $one_minute_five_minute, $order_limit_points); if($stmt->execute()) { $data = array(); if($stmt->fetch()) { $data[0] = $id; $data[1] = $var_stock_name; $data[2] = $var_symbol_token; $data[3] = $var_exchange_type; $data[4] = $var_time_interval; $data[5] = $current_date; $data[6] = $current_time; $data[7] = $next_expiry; $data[8] = $one_minute_five_minute; $data[9] = $order_limit_points; return $data; } return false; } } } function get_stock_main_setting_data_by_token_number($symboltoken) { if($stmt = $this->con->prepare("SELECT `id`, `stock_name`, `symbol_token`, `exchange_type`, `time_interval`, `date`, `time`,`next_expiry`, `one_minute_five_minute`, `order_limit_points` FROM `stocks` where `symbol_token`=?")) { $stmt->bind_param("s",$symboltoken); $stmt->bind_result($id,$var_stock_name,$var_symbol_token,$var_exchange_type,$var_time_interval,$current_date,$current_time,$next_expiry, $one_minute_five_minute, $order_limit_points); if($stmt->execute()) { $data = array(); if($stmt->fetch()) { $data[0] = $id; $data[1] = $var_stock_name; $data[2] = $var_symbol_token; $data[3] = $var_exchange_type; $data[4] = $var_time_interval; $data[5] = $current_date; $data[6] = $current_time; $data[7] = $next_expiry; $data[8] = $one_minute_five_minute; $data[9] = $order_limit_points; return $data; } return false; } } } function delete_stock_entry($delete_id) { if($stmt = $this->con->prepare("DELETE FROM `stocks` WHERE `id`=?")) { $stmt->bind_param("i",$delete_id); if($stmt->execute()) { return true; } return false; } } /***********admin login************/ function get_password_from_user_name($mobile_no) { if($stmt_select = $this->con->prepare("Select `password` from `admin` where `mobile_no` = ? ")) { $stmt_select->bind_param("s",$mobile_no); $stmt_select->bind_result($result_password); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_password; } } return false; } } function get_trading_symbol_name($symboltoken) { if($stmt_select = $this->con->prepare("Select `stock_name` from `stocks` where `symbol_token` = ?")) { $stmt_select->bind_param("s",$symboltoken); $stmt_select->bind_result($result_tradingsymbol); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_tradingsymbol; } } return false; } } function get_id_of_market_from_token_and_straegy($var_strategy_name,$var_symbol_token) { if($stmt_select = $this->con->prepare("Select `id` from `market_strategies` where `strategy_name` = ? AND `symbol_token`=?")) { $stmt_select->bind_param("ss",$var_strategy_name,$var_symbol_token); $stmt_select->bind_result($result_password); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_password; } } return false; } } function gte_appkey_from_mob_no($mobile_no) { if($stmt_select = $this->con->prepare("Select `api_key` from `registration` where `mobile_no` = ? ")) { $stmt_select->bind_param("s",$mobile_no); $stmt_select->bind_result($result_api_key); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_api_key; } } return false; } } function get_username_from_mobile_no($mobile_no) { if($stmt_select = $this->con->prepare("SELECT `full_name` FROM `registration` WHERE `mobile_no`=?")) { $stmt_select->bind_param("s",$mobile_no); $stmt_select->bind_result($result_full_name); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_full_name; } } return false; } } function get_login_token_exist($mobile_no) { $date_var = date("Y-m-d"); if($stmt_select = $this->con->prepare("Select `jwt_token` from `user_login_tokens` where `mobile_no` = ? AND `date`=?")) { $stmt_select->bind_param("ss",$mobile_no,$date_var); $stmt_select->bind_result($result_api_key); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_api_key; } } return false; } } function get_private_api_key_from_mobile_number($mobile_no) { $date_var = date("Y-m-d"); if($stmt_select = $this->con->prepare("SELECT `api_key` FROM `registration` WHERE `mobile_no`=?")) { $stmt_select->bind_param("s",$mobile_no); $stmt_select->bind_result($result_api_key); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_api_key; } } return false; } } /***********user login************/ function get_password_from_mobile_number($mobile_no) { if($stmt = $this->con->prepare("SELECT `password` FROM `registration` WHERE `mobile_no`=?")) { $stmt->bind_param("s",$mobile_no); $stmt->bind_result($res_password); if($stmt->execute()) { if($stmt->fetch()) { return $res_password; } } return false; } } function get_tokens_from_mobile_no($mobile_no) { $current_date = date("Y-m-d"); if($stmt = $this->con->prepare("SELECT `jwt_token`, `refresh_token`, `feed_token` FROM `user_login_tokens` WHERE `login_date`=? AND `mobile_no`=?")) { $stmt->bind_param("ss",$current_date,$mobile_no); $stmt->bind_result($jwt_token,$refresh_token,$feed_token); if($stmt->execute()) { if($stmt->fetch()) { $data = array(); $data['jwt_token'] = $jwt_token; $data['refresh_token'] = $refresh_token; $data['feed_token'] = $feed_token; return $data; } } return false; } } function get_all_todays_token_login_users() { $current_date = date("Y-m-d"); if($stmt = $this->con->prepare("SELECT `id`, `login_date`, `mobile_no`, `jwt_token`, `refresh_token`, `feed_token`, `date`, `time`,`private_api_key` FROM `user_login_tokens` where `mobile_no`!='admin' AND `login_date`='$current_date'")) { $stmt->bind_result($res_id,$res_login_date,$res_mobile_no,$jwt_token,$refresh_token,$feed_token,$res_date,$res_time,$private_api_key); if($stmt->execute()) { $data = array(); $counter = 0; while($stmt->fetch()) { $data[$counter]['jwt_token'] = $jwt_token; $data[$counter]['refresh_token']= $refresh_token; $data[$counter]['feed_token'] = $feed_token; $data[$counter]['id'] = $res_id; $data[$counter]['login_date'] = $res_login_date; $data[$counter]['mobile_no'] = $res_mobile_no; $data[$counter]['res_date'] = $res_date; $data[$counter]['res_time'] = $res_time; $data[$counter]['user_api_key'] = $private_api_key; $counter++; } return $data; } return false; } } function get_user_login_token_exist($mobile_no) { $current_date = date("Y-m-d"); if($stmt = $this->con->prepare("SELECT `id` FROM `user_login_tokens` where `login_date`='$current_date' AND `mobile_no`='$mobile_no'")) { $stmt->bind_result($res_id); if($stmt->execute()) { if($stmt->fetch()) { return $res_id; } return false; } } } function get_total_no_of_todays_trades($symboltoken,$strategy_type) { echo $symboltoken,$strategy_type; $current_date = date("Y-m-d"); if($stmt = $this->con->prepare("SELECT COUNT(`id`) FROM `trading_history` where `symbol_token`='$symboltoken' AND `exchange` LIKE '%".$strategy_type."%' AND `order_date`='$current_date'")) { //SELECT COUNT(`id`) FROM `trading_history` WHERE `symbol_token`='$symboltoken' AND `exchange` LIKE '%".$strategy_type."%' AND `order_date`='' echo 111; $stmt->bind_result($res_count); if($stmt->execute()) { echo 222; if($stmt->fetch()) { return $res_count; } return false; } } } function change_user_password($mobile_no,$password) { $date = date("Y-m-d"); $time = date("H:i:s A"); if($stmt_select = $this->con->prepare("update `registration` set `password`='".$password."' where `mobile_no` = ?")) { $stmt_select->bind_param("s",$mobile_no); if($stmt_select->execute()) { return true; } return false; } } function update_login_tokens($var_login_date,$var_mobile_no,$var_jwt_token,$var_refresh_token,$var_feed_token,$private_api_key) { $date = date("Y-m-d"); $time = date("H:i:s A"); if($stmt_select = $this->con->prepare("UPDATE `user_login_tokens` SET `jwt_token`=?,`refresh_token`=?,`feed_token`=?,`date`=?,`time`=?,`private_api_key`=? WHERE `mobile_no`=? AND `login_date`=?")) { $stmt_select->bind_param("ssssssss",$var_jwt_token,$var_refresh_token,$var_feed_token,$date,$time,$private_api_key,$var_mobile_no,$date); if($stmt_select->execute()) { return true; } return false; } } function add_new_registration($var_full_name,$var_mobile_no,$var_email,$var_password,$var_api_key) { $current_date = date("Y-m-d"); $current_time = date("h:i:s a"); //$status = "pending"; if($stmt = $this->con->prepare("INSERT INTO `registration`(`full_name`, `mobile_no`, `email_id`, `password`,`api_key`, `date`, `time`) VALUES (?,?,?,?,?,?,?)")) { $stmt->bind_param("sssssss",$var_full_name,$var_mobile_no,$var_email,$var_password,$var_api_key,$current_date,$current_time); if($stmt->execute()){ return true; } else{ echo $stmt->error; } return false; } } function get_stock_setting_data_with_status_on($symboltoken,$strategy_type) { if($stmt = $this->con->prepare("SELECT `id`, `strategy_name`, `symbol_token`, `variety`, `exchange`, `transaction_type`, `order_type`, `quantity`, `product_type`, `squareoff_points`, `stoploss_points`, `duration`, `status`, `date`, `time`,`no_of_trades_limit` FROM `market_strategies` WHERE `strategy_name`=? AND `symbol_token`=? AND `status`='ON'")) { $stmt->bind_param("ss",$strategy_type,$symboltoken); $stmt->bind_result($res_id,$res_strategy_name,$res_symbol_token,$res_variety,$res_exchange,$res_transaction_type,$res_order_type,$res_quantity,$res_product_type,$res_squareoff_points,$res_stoploss_points,$res_duration,$res_status,$res_date,$res_time,$no_of_trades_limit); if($stmt->execute()) { if($stmt->fetch()) { $data = array(); $data['id'] = $res_id; $data['strategy_name'] = $res_strategy_name; $data['symboltoken'] = $res_symbol_token; $data['variety'] = $res_variety; $data['exchange'] = $res_exchange; $data['transactiontype'] = $res_transaction_type; $data['ordertype'] = $res_order_type; $data['quantity'] = $res_quantity; $data['producttype'] = $res_product_type; $data['squareoff'] = $res_squareoff_points; $data['stoploss']= $res_stoploss_points; $data['duration'] =$res_duration; $data['trade_execute_on_off']= $res_status; $data['no_of_trades_limit']=$no_of_trades_limit; return $data; } return false; } } } function add_new_log_data($comment1,$comment2,$comment3,$comment4,$comment5,$comment6,$comment7) { $current_date = date("Y-m-d"); $current_time = date("h:i:s a"); if($stmt = $this->con->prepare("INSERT INTO `stocks_log_data`(`comment1`, `comment2`, `comment3`, `comment4`, `comment5`, `comment6`, `comment7`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?)")) { $stmt->bind_param("sssssssss",$comment1,$comment2,$comment3,$comment4,$comment5,$comment6,$comment7,$current_date,$current_time); if($stmt->execute()){ return true; } else{ echo $stmt->error; } return false; } } function update_user_login_edit_report($var_full_name,$var_mobile_no,$var_email,$var_password,$var_api_key,$var_edit_id) { $current_date = date("Y-m-d"); $current_time = date("h:i:s A"); if($stmt = $this->con->prepare("UPDATE `registration` SET `full_name`=?,`mobile_no`=?,`email_id`=?,`password`=?,`api_key`=?,`date`=?,`time`=? WHERE `id`=?")) { $stmt->bind_param("sssssssi",$var_full_name,$var_mobile_no,$var_email,$var_password,$var_api_key,$current_date,$current_time,$var_edit_id); if($stmt->execute()) { return true; } else { $stmt->error(); } return false; } } function change_admin_password($mobile_no,$password) { $date = date("Y-m-d"); $time = date("H:i:s A"); if($stmt_select = $this->con->prepare("update `admin` set `password`='".$password."' where `admin_name` = ?")) { $stmt_select->bind_param("s",$mobile_no); if($stmt_select->execute()) { return true; } return false; } } function get_all_users_details() { if($stmt_insert = $this->con->prepare("SELECT `id`, `full_name`, `mobile_no`, `email_id`, `password`, `date`, `time` FROM `registration` ORDER BY `id` DESC")) { $stmt_insert->bind_result($id,$full_name,$mobile_no,$email_id,$password,$date,$time); if($stmt_insert->execute()) { $counter = 0; $details = array(); while($stmt_insert->fetch()) { $details[$counter][0] = $id; $details[$counter][1] = $full_name; $details[$counter][2] = $mobile_no; $details[$counter][3] = $email_id; $details[$counter][4] = $password; $details[$counter][5] = $date; $details[$counter][6] = $time; $counter++; } if(!empty($details)) { return $details; } return false; } } } function get_all_log_data() { if($stmt_insert = $this->con->prepare("SELECT `id`, `comment1`, `comment2`, `comment3`, `comment4`, `comment5`, `comment6`, `comment7`, `date`, `time` FROM `stocks_log_data` ORDER BY `id` DESC")) { $stmt_insert->bind_result($id,$comment1,$comment2,$comment3,$comment4,$comment5,$comment6,$comment7,$date,$time); if($stmt_insert->execute()) { $counter = 0; $details = array(); while($stmt_insert->fetch()) { $details[$counter][0] = $id; $details[$counter][1] = $comment1; $details[$counter][2] = $comment2; $details[$counter][3] = $comment3; $details[$counter][4] = $comment4; $details[$counter][5] = $comment5; $details[$counter][6] = $comment6; $details[$counter][7] = $comment7; $details[$counter][8] = $date; $details[$counter][9] = $time; $counter++; } if(!empty($details)) { return $details; } return false; } } } function delete_member_info($delete_id) { if($stmt_select = $this->con->prepare("DELETE FROM `registration` WHERE `id`=?")) { $stmt_select->bind_param("i",$delete_id); if($stmt_select->execute()) { return true; } return false; } } function delete_log_info() { if($stmt_select = $this->con->prepare("DELETE FROM `stocks_log_data`")) { if($stmt_select->execute()) { return true; } return false; } } function delete_trade_history_info() { if($stmt_select = $this->con->prepare("DELETE FROM `trading_history`")) { if($stmt_select->execute()) { return true; } return false; } } function delete_all_candle_info() { if($stmt_select = $this->con->prepare("DELETE FROM `candle_data`")) { if($stmt_select->execute()) { return true; } return false; } } function add_new_login_tokens($var_login_date,$var_mobile_no,$var_jwt_token,$var_refresh_token,$var_feed_token,$private_api_key) { $current_date = date("Y-m-d"); $current_time = date("h:i:s a"); //$status = "pending"; if($stmt = $this->con->prepare("INSERT INTO `user_login_tokens`(`login_date`, `mobile_no`, `jwt_token`, `refresh_token`, `feed_token`, `date`, `time`,`private_api_key`) VALUES (?,?,?,?,?,?,?,?)")) { $stmt->bind_param("ssssssss",$var_login_date,$var_mobile_no,$var_jwt_token,$var_refresh_token,$var_feed_token,$current_date,$current_time,$private_api_key); if($stmt->execute()){ return true; } else{ echo $stmt->error; } return false; } } function get_all_users_tokens_details() { if($stmt_insert = $this->con->prepare("SELECT `id`,`login_date`, `mobile_no`, `jwt_token`, `refresh_token`, `feed_token`, `date`, `time` FROM `user_login_tokens` ")) { $stmt_insert->bind_result($id,$login_date,$mobile_no,$jwt_token,$refresh_token,$feed_token,$date,$time); if($stmt_insert->execute()) { $counter = 0; $details = array(); while($stmt_insert->fetch()) { $details[$counter][0] = $id; $details[$counter][1] = $login_date; $details[$counter][2] = $mobile_no; $details[$counter][3] = $jwt_token; $details[$counter][4] = $refresh_token; $details[$counter][5] = $feed_token; $details[$counter][6] = $date; $details[$counter][7] = $time; $counter++; } if(!empty($details)) { return $details; } return false; } } } function add_new_candle_data($var_exchange,$var_symbol_token,$var_interval,$var_from_date,$var_to_date,$var_response_timestamp,$var_open,$var_high,$var_low,$var_close,$var_volume,$response_historical) { $current_date = date("Y-m-d"); $current_time = date("h:i:s a"); //$status = "pending"; if($stmt = $this->con->prepare("INSERT INTO `candle_data`( `exchange`, `symbol_token`, `interval`, `from_date`, `to_date`, `response_timestamp`, `open`, `high`, `low`, `close`, `volume`, `date`, `time`,`api_response`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)")) { $stmt->bind_param("ssssssssssssss",$var_exchange,$var_symbol_token,$var_interval,$var_from_date,$var_to_date,$var_response_timestamp,$var_open,$var_high,$var_low,$var_close,$var_volume,$current_date,$current_time,$response_historical); if($stmt->execute()){ return true; } else{ echo $stmt->error; } return false; } } function get_all_users_candle_data_details() { if($stmt_insert = $this->con->prepare("SELECT `id`, `exchange`, `symbol_token`, `interval`, `from_date`, `to_date`, `response_timestamp`, `open`, `high`, `low`, `close`, `volume`, `date`, `time` FROM `candle_data` ORDER BY `id` DESC")) { $stmt_insert->bind_result($id,$exchange,$symbol_token,$interval,$from_date,$to_date,$response_timestamp,$open,$high,$low,$close,$volume,$date,$time); if($stmt_insert->execute()) { $counter = 0; $details = array(); while($stmt_insert->fetch()) { $details[$counter][0] = $id; $details[$counter][1] = $exchange; $details[$counter][2] = $symbol_token; $details[$counter][3] = $interval; $details[$counter][4] = $from_date; $details[$counter][5] = $to_date; $details[$counter][6] = $response_timestamp; $details[$counter][7] = $open; $details[$counter][8] = $high; $details[$counter][9] = $low; $details[$counter][10] = $close; $details[$counter][11] = $volume; $details[$counter][12] = $date; $details[$counter][13] = $time; $counter++; } if(!empty($details)) { return $details; } return false; } } } function get_all_users_candle_data_details_by_symboltoken($symbol_token) { if($stmt_insert = $this->con->prepare("SELECT `id`, `exchange`, `symbol_token`, `interval`, `from_date`, `to_date`, `response_timestamp`, `open`, `high`, `low`, `close`, `volume`, `date`, `time` FROM `candle_data` WHERE `symbol_token`='$symbol_token' ORDER BY `id` DESC")) { $stmt_insert->bind_result($id,$exchange,$symbol_token,$interval,$from_date,$to_date,$response_timestamp,$open,$high,$low,$close,$volume,$date,$time); if($stmt_insert->execute()) { $counter = 0; $details = array(); while($stmt_insert->fetch()) { $details[$counter]['date'] = $date; $details[$counter]['open'] = $open; $details[$counter]['high'] = $high; $details[$counter]['low'] = $low; $details[$counter]['close'] = $close; $counter++; } if(!empty($details)) { return $details; } return false; } } } function get_todays_nine_twenty_candle_data($symbol_token) { $todaydate = date("Y-m-d")."T09:20"; if($stmt_insert = $this->con->prepare("SELECT `id`, `exchange`, `symbol_token`, `interval`, `from_date`, `to_date`, `response_timestamp`, `open`, `high`, `low`, `close`, `volume`, `date`, `time`,`api_response` FROM `candle_data` WHERE `interval`='FIVE_MINUTE' AND `response_timestamp` LIKE '".$todaydate."%' AND `symbol_token`='".$symbol_token."'")) { $stmt_insert->bind_result($res_id,$res_exchange,$res_symbol_token,$res_interval,$res_from_date,$res_to_date,$res_response_timestamp,$res_open,$res_high,$res_low,$res_close,$res_volume,$res_date,$res_time,$res_api_response); if($stmt_insert->execute()) { $counter = 0; $details = array(); if($stmt_insert->fetch()) { $details[0] = $res_id; $details[1] = $res_exchange; $details[2] = $res_symbol_token; $details[3] = $res_interval; $details[4] = $res_from_date; $details[5] = $res_to_date; $details[6] = $res_response_timestamp; $details[7] = $res_open; $details[8] = $res_high; $details[9] = $res_low; $details[10] = $res_close; $details[11] = $res_volume; $details[12] = $res_date; $details[13] = $res_time; $details[14] = $res_api_response; $counter++; } if(!empty($details)) { return $details; } else { return false; } } } } function get_todays_nine_fifteen_candle_data($symbol_token) { $todaydate = date("Y-m-d")."T09:15"; if($stmt_insert = $this->con->prepare("SELECT `id`, `exchange`, `symbol_token`, `interval`, `from_date`, `to_date`, `response_timestamp`, `open`, `high`, `low`, `close`, `volume`, `date`, `time`,`api_response` FROM `candle_data` WHERE `interval`='FIVE_MINUTE' AND `response_timestamp` LIKE '".$todaydate."%' AND `symbol_token`='".$symbol_token."'")) { $stmt_insert->bind_result($res_id,$res_exchange,$res_symbol_token,$res_interval,$res_from_date,$res_to_date,$res_response_timestamp,$res_open,$res_high,$res_low,$res_close,$res_volume,$res_date,$res_time,$res_api_response); if($stmt_insert->execute()) { $counter = 0; $details = array(); if($stmt_insert->fetch()) { $details[0] = $res_id; $details[1] = $res_exchange; $details[2] = $res_symbol_token; $details[3] = $res_interval; $details[4] = $res_from_date; $details[5] = $res_to_date; $details[6] = $res_response_timestamp; $details[7] = $res_open; $details[8] = $res_high; $details[9] = $res_low; $details[10] = $res_close; $details[11] = $res_volume; $details[12] = $res_date; $details[13] = $res_time; $details[14] = $res_api_response; $counter++; } if(!empty($details)) { return $details; } else { return false; } } } } function get_todays_two_twenty_candle_data($symbol_token) { $todaydate = date("Y-m-d")."T14:20"; if($stmt_insert = $this->con->prepare("SELECT `id`, `exchange`, `symbol_token`, `interval`, `from_date`, `to_date`, `response_timestamp`, `open`, `high`, `low`, `close`, `volume`, `date`, `time`,`api_response` FROM `candle_data` WHERE `interval`='FIVE_MINUTE' AND `response_timestamp` LIKE '".$todaydate."%' AND `symbol_token`='".$symbol_token."'")) { $stmt_insert->bind_result($res_id,$res_exchange,$res_symbol_token,$res_interval,$res_from_date,$res_to_date,$res_response_timestamp,$res_open,$res_high,$res_low,$res_close,$res_volume,$res_date,$res_time,$res_api_response); if($stmt_insert->execute()) { $counter = 0; $details = array(); if($stmt_insert->fetch()) { $details[0] = $res_id; $details[1] = $res_exchange; $details[2] = $res_symbol_token; $details[3] = $res_interval; $details[4] = $res_from_date; $details[5] = $res_to_date; $details[6] = $res_response_timestamp; $details[7] = $res_open; $details[8] = $res_high; $details[9] = $res_low; $details[10] = $res_close; $details[11] = $res_volume; $details[12] = $res_date; $details[13] = $res_time; $details[14] = $res_api_response; $counter++; } if(!empty($details)) { return $details; } else { return false; } } } } function delete_token_info($delete_id) { if($stmt_select = $this->con->prepare("DELETE FROM `user_login_tokens` WHERE `id`=?")) { $stmt_select->bind_param("i",$delete_id); if($stmt_select->execute()) { return true; } return false; } } function delete_candle_data_info($delete_id) { if($stmt_select = $this->con->prepare("DELETE FROM `candle_data` WHERE `id`=?")) { $stmt_select->bind_param("i",$delete_id); if($stmt_select->execute()) { return true; } return false; } } function add_new_trading_history_data($var_mobile_no,$var_variety,$var_trading_symbol,$var_symbol_token,$var_transaction_type,$var_exchange,$var_order_type,$var_product_type,$var_duration,$var_price,$var_square_off,$var_stop_loss,$var_quantity,$var_api_response_data,$var_order_date,$var_order_time,$order_number) { $current_date = date("Y-m-d"); $current_time = date("h:i:s a"); $target_stoploss = "-"; if($stmt = $this->con->prepare("INSERT INTO `trading_history`( `mobile_no`, `variety`, `trading_symbol`, `symbol_token`, `transaction_type`, `exchange`, `order_type`, `product_type`, `duration`, `price`, `square_off`, `stop_loss`, `quantity`, `api_response_data`, `order_date`, `order_time`,`target_stoploss`,`order_number`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")) { $stmt->bind_param("ssssssssssssssssss",$var_mobile_no,$var_variety,$var_trading_symbol,$var_symbol_token,$var_transaction_type,$var_exchange,$var_order_type,$var_product_type,$var_duration,$var_price,$var_square_off,$var_stop_loss,$var_quantity,$var_api_response_data,$current_date,$current_time,$target_stoploss,$order_number); if($stmt->execute()){ return true; } else{ echo $stmt->error; } return false; } } function get_all_trading_history_details() { if($stmt_insert = $this->con->prepare("SELECT `id`, `mobile_no`, `variety`, `trading_symbol`, `symbol_token`, `transaction_type`, `exchange`, `order_type`, `product_type`, `duration`, `price`, `square_off`, `stop_loss`, `quantity`, `api_response_data`, `order_date`, `order_time`,`target_stoploss`,`order_number` FROM `trading_history` where `mobile_no`='admin' ORDER BY `id` DESC")) { $stmt_insert->bind_result($id,$mobile_no,$variety,$trading_symbol,$symbol_token,$transaction_type,$exchange,$order_type,$product_type,$duration,$price,$square_off,$stop_loss,$quantity,$api_response_data,$order_date,$order_time,$target_stoploss,$order_number); if($stmt_insert->execute()) { $counter = 0; $details = array(); while($stmt_insert->fetch()) { $details[$counter][0] = $id; $details[$counter][1] = $mobile_no; $details[$counter][2] = $variety; $details[$counter][3] = $trading_symbol; $details[$counter][4] = $symbol_token; $details[$counter][5] = $transaction_type; $details[$counter][6] = $exchange; $details[$counter][7] = $order_type; $details[$counter][8] = $product_type; $details[$counter][9] = $duration; $details[$counter][10] = $price; $details[$counter][11] = $square_off; $details[$counter][12] = $stop_loss; $details[$counter][13] = $quantity; $details[$counter][14] = $api_response_data; $details[$counter][15] = $order_date; $details[$counter][16] = $order_time; $details[$counter][17] = $target_stoploss; $details[$counter][18] = $order_number; $counter++; } if(!empty($details)) { return $details; } return false; } } } function get_all_trading_history_details_by_user_wise($mobile_no) { if($stmt_insert = $this->con->prepare("SELECT `id`, `mobile_no`, `variety`, `trading_symbol`, `symbol_token`, `transaction_type`, `exchange`, `order_type`, `product_type`, `duration`, `price`, `square_off`, `stop_loss`, `quantity`, `api_response_data`, `order_date`, `order_time`,`target_stoploss`,`order_number` FROM `trading_history` where `mobile_no`='$mobile_no' ORDER BY `id` DESC")) { $stmt_insert->bind_result($id,$mobile_no,$variety,$trading_symbol,$symbol_token,$transaction_type,$exchange,$order_type,$product_type,$duration,$price,$square_off,$stop_loss,$quantity,$api_response_data,$order_date,$order_time,$target_stoploss,$order_number); if($stmt_insert->execute()) { $counter = 0; $details = array(); while($stmt_insert->fetch()) { $details[$counter][0] = $id; $details[$counter][1] = $mobile_no; $details[$counter][2] = $variety; $details[$counter][3] = $trading_symbol; $details[$counter][4] = $symbol_token; $details[$counter][5] = $transaction_type; $details[$counter][6] = $exchange; $details[$counter][7] = $order_type; $details[$counter][8] = $product_type; $details[$counter][9] = $duration; $details[$counter][10] = $price; $details[$counter][11] = $square_off; $details[$counter][12] = $stop_loss; $details[$counter][13] = $quantity; $details[$counter][14] = $api_response_data; $details[$counter][15] = $order_date; $details[$counter][16] = $order_time; $details[$counter][17] = $target_stoploss; $details[$counter][18] = $order_number; $counter++; } if(!empty($details)) { return $details; } return false; } } } function get_all_trading_history_details_by_user_wise_api($mobile_no) { if($stmt_insert = $this->con->prepare("SELECT `id`, `mobile_no`, `variety`, `trading_symbol`, `symbol_token`, `transaction_type`, `exchange`, `order_type`, `product_type`, `duration`, `price`, `square_off`, `stop_loss`, `quantity`, `api_response_data`, `order_date`, `order_time`,`target_stoploss`,`order_number` FROM `trading_history` where `mobile_no`='$mobile_no' ORDER BY `id` DESC")) { $stmt_insert->bind_result($id,$mobile_no,$variety,$trading_symbol,$symbol_token,$transaction_type,$exchange,$order_type,$product_type,$duration,$price,$square_off,$stop_loss,$quantity,$api_response_data,$order_date,$order_time,$target_stoploss,$order_number); if($stmt_insert->execute()) { $counter = 0; $details = array(); while($stmt_insert->fetch()) { //$details[$counter][0] = $id; //$details[$counter][1] = $mobile_no; //$details[$counter][2] = $variety; $details[$counter]['trading_symbol'] = $trading_symbol; //$details[$counter][4] = $symbol_token; $details[$counter]['transaction_type'] = $transaction_type; //$details[$counter]['exchange'] = $exchange; //$details[$counter]['order_type'] = $order_type; //$details[$counter][8] = $product_type; //$details[$counter][9] = $duration; $details[$counter]['buy_price'] = $price; $details[$counter]['target_points'] = $square_off; $details[$counter]['stoploss'] = $stop_loss; $details[$counter]['quantity'] = $quantity; //$details[$counter][14] = $api_response_data; $details[$counter]['date'] = $order_date; $details[$counter]['time'] = $order_time; //$details[$counter][17] = $target_stoploss; //$details[$counter][18] = $order_number; $counter++; } if(!empty($details)) { return $details; } return false; } } } function delete_history_info($delete_id) { if($stmt_select = $this->con->prepare("DELETE FROM `trading_history` WHERE `id`=?")) { $stmt_select->bind_param("i",$delete_id); if($stmt_select->execute()) { return true; } return false; } } }
Linux 65-254-81-4.cprapid.com 5.14.0-284.11.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 9 05:49:00 EDT 2023 x86_64
Apache
65.254.81.4