INNER CODE UNIT · Java
getTodaysGL
qtds35k/HighFrequencyTradingBot · src/trading/HttpHelper.java:131
public Double getTodaysGL() throws IOException, InterruptedException {
Connection.Response resp = Jsoup.connect("https://invest.firstrade.com/cgi-bin/acctbalance")
.userAgent(agent)
.data("accountId", account)
.referrer(referer)
.cookies(session)
.method(Method.POST)
.execute();
session.putAll(resp.cookies());
randomSleep(1);
Document doc = resp.parse();
Elements el = doc.select(".total_all > tbody > tr > td");
Double todaysGL = Double.parseDouble(el.get(1).text().replace("$", "").replace(",", ""));
println("Today's GL: " + todaysGL);
return todaysGL;
}