| | |
| | | |
| | | pyjs.http_request(path, JSON.stringify(data), JSON.stringify(["http_util.http_request_result", key])); |
| | | }, |
| | | socket_request: function(data, callback) { |
| | | key = "http_callback_" + new Date().getTime() + "_" + Math.round(Math.random() * 100000000); |
| | | http_util.request_callback[key] = callback; |
| | | pyjs.socket_request(data, JSON.stringify(["http_util.http_request_result", key])); |
| | | }, |
| | | |
| | | |
| | | get_score_data: function(code, name, callback) { |
| | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | get_sign:function(data){ |
| | | var params=new Array(); |
| | | for(key in data){ |
| | | if(data[key] instanceof Object || data[key] instanceof Array){ |
| | | console.log(typeof data[key]) |
| | | params.push(key+"="+JSON.stringify(data[key])) |
| | | }else{ |
| | | params.push(key+"="+data[key]) |
| | | } |
| | | } |
| | | params.sort() |
| | | params.push("%Yeshi2014@#.") |
| | | var params_str="" |
| | | params.forEach(function(re){ |
| | | params_str += re+"&"; |
| | | }); |
| | | if(params_str.endsWith("&")){ |
| | | params_str = params_str.substring(0,params_str.length - 1); |
| | | } |
| | | |
| | | console.log(params_str) |
| | | |
| | | md5Hash = crypto.createHash("md5").update(params_str).digest("hex"); |
| | | return md5Hash; |
| | | }, |
| | | cancel_order: function(code, success) { |
| | | var data = { |
| | | "type": 80, |
| | | "data": { |
| | | type: "cancel_order", |
| | | data: { |
| | | "code": code |
| | | } |
| | | }; |
| | | pyjs.socket_request(JSON.stringify(data), function(result) { |
| | | |
| | | http_util.socket_request(JSON.stringify(data), function(result) { |
| | | console.log("撤单结果",result) |
| | | result = JSON.parse(result); |
| | | if (result.code == 0) { |
| | | success() |
| | |
| | | http_util.http_request("/get_last_trade_day_reasons", {code:code |
| | | }, callback); |
| | | }, |
| | | |
| | | //获取L2的数据 |
| | | get_l2_datas:function(code,callback){ |
| | | http_util.http_request("/get_l2_datas", {code:code |
| | | }, callback); |
| | | }, |
| | | //获取L2的数据 |
| | | get_trade_progress:function(code,callback){ |
| | | http_util.http_request("/get_trade_progress", {code:code |
| | | }, callback); |
| | | }, |
| | | //获取L2的数据 |
| | | get_l2_l_cancel_datas:function(code,buy_single_index,callback){ |
| | | var params={code:code} |
| | | if(buy_single_index>=0){ |
| | | params["buy_single_index"] = buy_single_index; |
| | | } |
| | | http_util.http_request("/get_l_cancel_datas", params, callback); |
| | | }, |
| | | get_l2_h_cancel_datas:function(code,buy_single_index,callback){ |
| | | var params={code:code} |
| | | if(buy_single_index>=0){ |
| | | params["buy_single_index"] = buy_single_index; |
| | | } |
| | | http_util.http_request("/get_h_cancel_datas", params, callback); |
| | | }, |
| | | get_kpl_block_info:function(code,callback){ |
| | | var params={code:code} |
| | | http_util.http_request("/get_kpl_block_info", params, callback); |
| | | }, |
| | | // 获取已挂买单的信息 |
| | | get_delegated_buy_code_infos:function(callback){ |
| | | data = {type:"common", data: {ctype:"get_delegated_buy_code_infos"},sign:''} |
| | | http_util.socket_request(JSON.stringify(data), function(result) { |
| | | result = JSON.parse(result); |
| | | callback(result); |
| | | }); |
| | | }, |
| | | get_xgb_limit_up_reasons:function(code,callback){ |
| | | var params={code:code} |
| | | http_util.http_request("/get_xgb_limit_up_reasons", params, callback); |
| | | }, |
| | | set_real_place_order_index:function(code, index, callback){ |
| | | data = {type:"common", data: {ctype:"set_real_place_order_index",code:code,index:index},sign:''} |
| | | http_util.socket_request(JSON.stringify(data), function(result) { |
| | | result = JSON.parse(result); |
| | | callback(result); |
| | | }); |
| | | }, |
| | | get_l2_cant_buy_reasons:function(code, callback){ |
| | | var params={code:code} |
| | | console.log("参数",params) |
| | | http_util.http_request("/get_l2_cant_buy_reasons", params, callback); |
| | | }, |
| | | get_latest_cancel_orders:function(callback){ |
| | | var params={type:"get_latest_cancel_orders",data:{},sign:''} |
| | | http_util.socket_request(JSON.stringify(params), function(result) { |
| | | result = JSON.parse(result); |
| | | callback(result); |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | }; |