Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

algorithmic trading - Angel Broker : Smart API Order Placing returns an empty response

I am placing an order via angelbroker smart api; but it returns empty response. Neither it returns Success nor error response. Using following code to place an order:

$post_value_arr = array();
$post_value_arr = array(
    "variety" => "NORMAL",
    "tradingsymbol" => "SBIN-EQ",
    "symboltoken" => "3045",
    "exchange" => "NSE",
    "quantity" => "1",
    "transactiontype" => "BUY",
    "ordertype" => "MARKET",
    "producttype" => "MIS",
    "duration" => "DAY"
);
$post_value_json = json_encode($post_value_arr);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://apiconnect.angelbroking.com/rest/secure/angelbroking/order/v1/placeOrder");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_value_json);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $auth_token, 'Content-Type: application/json', 'Accept: application/json', 'X-UserType: USER', 'X-SourceID: WEB', 'X-ClientPublicIP: 172.29.24.173', 'X-ClientLocalIP: 172.29.24.173', 'X-MACAddress: e0:d5:5e:91:23:d4', 'X-PrivateKey: ' . $api_key));

// receive server response ...
$server_output = curl_exec($ch);
$server_output_arr = json_decode($server_output, true);

Please check the code and suggest to rectify the issue.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...