INNER CODE UNIT · Java
cancelOrder
qtds35k/HighFrequencyTradingBot · src/trading/HttpHelper.java:383
public boolean cancelOrder(String orderIdCancel, String orderIdBuySell) throws IOException, InterruptedException {
// cancel an order by orderId
Map<String, String> formDataCancel = new HashMap<String, String>();
formDataCancel.put("clordid", orderIdCancel);
formDataCancel.put("accountid", account);
Connection.Response resp = Jsoup.connect("https://invest.firstrade.com/cgi-bin/cxlorder")
.userAgent(agent)
.data(formDataCancel)
.referrer(referer)
.cookies(session)
.method(Method.POST)
.execute();
session.putAll(resp.cookies());
if (isOrderCancelled(orderIdBuySell)) {
println(orderIdBuySell + " is cancelled");
return true;
}