_posMaster.setClock(Clock.fixed(_now.toInstant(), ZoneOffset.UTC));
_version1Instant = _now.toInstant().minusSeconds(100);
_version2Instant = _now.toInstant().minusSeconds(50);
s_logger.debug("test data now: {}", _version1Instant);
s_logger.debug("test data later: {}", _version2Instant);
final JdbcOperations template = _posMaster.getDbConnector().getJdbcOperations();
template.update("INSERT INTO pos_position VALUES (?,?,?,?,?, ?,?,?,?)",
100, 100, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, "A", "100", BigDecimal.valueOf(100.987));
template.update("INSERT INTO pos_position VALUES (?,?,?,?,?, ?,?,?,?)",
120, 120, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, "A", "120", BigDecimal.valueOf(120.987));
template.update("INSERT INTO pos_position VALUES (?,?,?,?,?, ?,?,?,?)",
121, 121, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, "A", "121", BigDecimal.valueOf(121.987));
template.update("INSERT INTO pos_position VALUES (?,?,?,?,?, ?,?,?,?)",
122, 122, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, "A", "122", BigDecimal.valueOf(122.987));
template.update("INSERT INTO pos_position VALUES (?,?,?,?,?, ?,?,?,?)",
123, 123, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, "A", "123", BigDecimal.valueOf(123.987));
template.update("INSERT INTO pos_position VALUES (?,?,?,?,?, ?,?,?,?)",
221, 221, toSqlTimestamp(_version1Instant), toSqlTimestamp(_version2Instant), toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, "A", "221", BigDecimal.valueOf(221.987));
template.update("INSERT INTO pos_position VALUES (?,?,?,?,?, ?,?,?,?)",
222, 221, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP, "A", "222", BigDecimal.valueOf(222.987));
_totalPositions = 6;
template.update("INSERT INTO pos_idkey VALUES (?,?,?)",
500, "TICKER", "S100");
template.update("INSERT INTO pos_idkey VALUES (?,?,?)",
501, "TICKER", "T130");
template.update("INSERT INTO pos_idkey VALUES (?,?,?)",
502, "TICKER", "MSFT");
template.update("INSERT INTO pos_idkey VALUES (?,?,?)",
503, "NASDAQ", "Micro");
template.update("INSERT INTO pos_idkey VALUES (?,?,?)",
504, "TICKER", "ORCL");
template.update("INSERT INTO pos_idkey VALUES (?,?,?)",
505, "TICKER", "ORCL134");
template.update("INSERT INTO pos_idkey VALUES (?,?,?)",
506, "NASDAQ", "ORCL135");
template.update("INSERT INTO pos_idkey VALUES (?,?,?)",
507, "TICKER", "IBMC");
template.update("INSERT INTO pos_idkey VALUES (?,?,?)",
508, "OID", "DbSec~1234");
template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 100, 500);
template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 120, 501);
template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 121, 502);
template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 121, 503);
template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 122, 504);
template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 123, 505);
template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 123, 506);
template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 221, 507);
template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 222, 507);
template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 222, 508);
OffsetTime tradeTime = _now.toOffsetTime().minusSeconds(400);
template.update("INSERT INTO pos_trade (id, oid, position_id, position_oid, quantity, trade_date, trade_time, zone_offset, cparty_scheme, cparty_value, provider_scheme, provider_value) " +
"VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
400, 400, 120, 120, BigDecimal.valueOf(120.987), toSqlDate(_now.toLocalDate()), toSqlTimestamp(tradeTime.toLocalTime()), tradeTime.getOffset().getTotalSeconds(), "CPARTY", "C100", "B", "400");
tradeTime = _now.toOffsetTime().minusSeconds(401);
template.update("INSERT INTO pos_trade (id, oid, position_id, position_oid, quantity, trade_date, trade_time, zone_offset, cparty_scheme, cparty_value, provider_scheme, provider_value) " +
"VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
401, 401, 121, 121, BigDecimal.valueOf(121.987), toSqlDate(_now.toLocalDate()), toSqlTimestamp(tradeTime.toLocalTime()), tradeTime.getOffset().getTotalSeconds(), "CPARTY", "C101", "B", "401");
tradeTime = _now.toOffsetTime().minusSeconds(402);
template.update("INSERT INTO pos_trade (id, oid, position_id, position_oid, quantity, trade_date, trade_time, zone_offset, cparty_scheme, cparty_value, provider_scheme, provider_value) " +
"VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
402, 402, 122, 122, BigDecimal.valueOf(100.987), toSqlDate(_now.toLocalDate()), toSqlTimestamp(tradeTime.toLocalTime()), tradeTime.getOffset().getTotalSeconds(), "CPARTY", "JMP", "B", "402");
tradeTime = _now.toOffsetTime().minusSeconds(403);
template.update("INSERT INTO pos_trade (id, oid, position_id, position_oid, quantity, trade_date, trade_time, zone_offset, cparty_scheme, cparty_value, provider_scheme, provider_value) " +
"VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
403, 403, 122, 122, BigDecimal.valueOf(22.987), toSqlDate(_now.toLocalDate()), toSqlTimestamp(tradeTime.toLocalTime()), tradeTime.getOffset().getTotalSeconds(), "CPARTY", "CISC", "B", "403");
tradeTime = _now.toOffsetTime().minusSeconds(404);
template.update("INSERT INTO pos_trade (id, oid, position_id, position_oid, quantity, trade_date, trade_time, zone_offset, cparty_scheme, cparty_value, provider_scheme, provider_value) " +
"VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
404, 404, 123, 123, BigDecimal.valueOf(100.987), toSqlDate(_now.toLocalDate()), toSqlTimestamp(tradeTime.toLocalTime()), tradeTime.getOffset().getTotalSeconds(), "CPARTY", "C104", "B", "404");
tradeTime = _now.toOffsetTime().minusSeconds(405);
template.update("INSERT INTO pos_trade (id, oid, position_id, position_oid, quantity, trade_date, trade_time, zone_offset, cparty_scheme, cparty_value, provider_scheme, provider_value) " +
"VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
405, 405, 123, 123, BigDecimal.valueOf(200.987), toSqlDate(_now.toLocalDate()), toSqlTimestamp(tradeTime.toLocalTime()), tradeTime.getOffset().getTotalSeconds(), "CPARTY", "C105", "B", "405");
tradeTime = _now.toOffsetTime().minusSeconds(406);
template.update("INSERT INTO pos_trade (id, oid, position_id, position_oid, quantity, trade_date, trade_time, zone_offset, cparty_scheme, cparty_value, provider_scheme, provider_value) " +
"VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
406, 406, 123, 123, BigDecimal.valueOf(300.987), toSqlDate(_now.toLocalDate()), toSqlTimestamp(tradeTime.toLocalTime()), tradeTime.getOffset().getTotalSeconds(), "CPARTY", "C106", "B", "406");
tradeTime = _now.toOffsetTime().minusSeconds(407);
template.update("INSERT INTO pos_trade (id, oid, position_id, position_oid, quantity, trade_date, trade_time, zone_offset, cparty_scheme, cparty_value, provider_scheme, provider_value) " +
"VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
407, 407, 221, 221, BigDecimal.valueOf(221.987), toSqlDate(_now.toLocalDate()), toSqlTimestamp(tradeTime.toLocalTime()), tradeTime.getOffset().getTotalSeconds(), "CPARTY", "C221", "B", "407");
tradeTime = _now.toOffsetTime().minusSeconds(408);
template.update("INSERT INTO pos_trade (id, oid, position_id, position_oid, quantity, trade_date, trade_time, zone_offset, cparty_scheme, cparty_value, provider_scheme, provider_value) " +
"VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
408, 407, 222, 221, BigDecimal.valueOf(222.987), toSqlDate(_now.toLocalDate()), toSqlTimestamp(tradeTime.toLocalTime()), tradeTime.getOffset().getTotalSeconds(), "CPARTY", "C222", "B", "408");
template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 400, 501);
template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 401, 502);
template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 401, 503);
template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 402, 504);
template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 403, 504);
template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 404, 505);
template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 404, 506);
template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 405, 505);
template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 405, 506);
template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 406, 505);
template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 406, 506);
template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 407, 507);
template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 408, 507);
}