Code: Select all
public void placeBets(String marketId, Object[][] bets){
List<PlaceInstruction> betInstructions = new ArrayList<>();
PlaceInstruction p;
LimitOrder l;
System.out.println("Market\tSelection\tHandicap\tSide\tOrderType\tPrice\tSize\tPersistenceType");
for (Object[] bet : bets) {
l = new LimitOrder();
l.setPrice(scaleUp((Double) bet[2]));
l.setSize((Double) bet[3]);
l.setPersistenceType(PersistenceType.PERSIST);
p = new PlaceInstruction();
p.setOrderType(OrderType.LIMIT);
p.setSide(Side.BACK);
p.setSelectionId((Long) bet[0]);
p.setHandicap(0d);
p.setLimitOrder(l);
System.out.println(marketId + "\t" + p.getSelectionId() + "\t" + p.getHandicap() + "\t" + p.getSide() + "\t" +
p.getOrderType() + "\t" + l.getPrice() + "\t" + l.getSize() + "\t" + l.getPersistenceType());
betInstructions.add(p);
}
try {
BetfairServerResponse<PlaceExecutionReport> resp = client.placeOrders(marketId, betInstructions, "");
PlaceExecutionReport report = resp.getResponse();
System.out.println(report.getStatus());
}catch(Exception e){
e.printStackTrace();
}
}
Knowledge of the object[][] bets is not important, the printed output tells us all we need to know:
And here the debug variable information shows exactly the request we are making:Market Selection Handicap Side OrderType Price Size PersistenceType
1.143621348 269469 0.0 BACK LIMIT 2.02 2.0 PERSIST
https://imgur.com/PLfUbWv
So why is the response returning null? Does anyone see a problem with my request?
The bet is not appearing in my account when betfair viewed in web browser.
Thanks