"FROM trades WHERE basket_id = ? ORDER BY entry_date DESC";
public Trade getTrades(final Integer basketId) {
ParameterizedRowMapper<Trade> mapper = new ParameterizedRowMapper<Trade>() {
public Trade mapRow(ResultSet rs, int rowNum) throws SQLException {
Trade trade = new Trade();
trade.setBasketId(basketId);
trade.setTicker(rs.getString("ticker"));
trade.setType((char) rs.getByte("type"));
trade.setPrice(rs.getDouble("price"));
trade.setClosePrice(rs.getDouble("close_price"));
trade.setStopLoss(rs.getDouble("stop_loss"));
trade.setStopProfit(rs.getDouble("stop_profit"));
trade.setVol(rs.getInt("vol"));
trade.setOpenSignal(rs.getString("open_signal"));
trade.setCloseSignal(rs.getString("close_signal"));
trade.setEntryDate(rs.getDate("entry_date"));
trade.setCloseDate(rs.getDate("close_date"));
return trade;
}
};
return getSimpleJdbcTemplate().queryForObject(ALL_TRADES_SQL, mapper,