Skip to content

Commit

Permalink
Merge branch 'insertinto' of github.com:apavlo/h-store into insertinto
Browse files Browse the repository at this point in the history
  • Loading branch information
John Meehan committed Apr 15, 2014
2 parents e075a48 + 3863378 commit a3d6c52
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/benchmarks/edu/brown/benchmark/tpceb/TPCEClient.java
Expand Up @@ -276,7 +276,7 @@ else if(tradeOrderResult[0].fetchRow(0) == null){
// tradeRequest.trade_qty = (int) tradeOrderResult[0].fetchRow(0).get("trade_qty", VoltType.INTEGER);
System.out.println("trying to get eAction");
tradeRequest.eActionTemp = (int) tradeOrderResult[0].fetchRow(0).getLong("eAction");
System.out.println("eAction val:" + tradeRequest.eActionTemp );
// System.out.println("eAction val:" + tradeRequest.eActionTemp );
// tradeRequest.eActionTemp = (int) tradeOrderResult[0].fetchRow(0).get("eAction", VoltType.INTEGER);
// tradeRequest.eActionTemp = (int) tradeOrderResult[0].fetchRow(0).getDouble("eAction");
//System.out.println("eActionTemp " + tradeOrderResult[0].fetchRow(0).getDouble("eAction"));
Expand Down
Expand Up @@ -244,7 +244,9 @@ public void generateTradeOrderInput(TTradeOrderTxnInput inputStructure, int iTra
long secFlatFileIndex;
// String[] flTaxId;
TradeType eTradeType;

inputStructure.setTradeID(currentTradeID.getAndIncrement());
System.out.println("TradeID " + inputStructure.getTradeID());
/***********ADDDED**/
//inputStructure.setSendToMarket(pSendToMarket);
/*******************/
Expand Down
Expand Up @@ -9,6 +9,7 @@ public MarketExchangeCallback(TTradeResultTxnInput trTxnInput, TMarketFeedTxnInp

public boolean TradeResult( TTradeResultTxnInput pTxnInput ) {
System.out.println("STATUS:" + pTxnInput.st_completed_id);
System.out.println("IN MARKET EXCHANGE CALLBACK" + pTxnInput.trade_id);
m_TradeResultTxnInput.trade_id = pTxnInput.trade_id;
m_TradeResultTxnInput.trade_price = pTxnInput.trade_price;
m_TradeResultTxnInput.st_completed_id = pTxnInput.st_completed_id;
Expand Down
Expand Up @@ -294,10 +294,11 @@ public VoltTable[] run(double requested_price, long acct_id, long is_lifo, long
//ret_values.addRow(buy_value, sell_value, tax_amount, trade_id, eAction);
// System.out.println("Requested Price: " + requested_price);
// System.out.println("Symbol: " + symbol);
// System.out.println("Trade_ID: " + trade_id);
System.out.println("Trade_ID: " + trade_id);
System.out.println("Trade_QTY:" + trade_qty);
// System.out.println("Trade_type_ID:" + trade_type_id);
System.out.println("eAction:" + eAction);

ret_values.addRow(requested_price, symbol, trade_id, (int) trade_qty, trade_type_id, eAction);
return new VoltTable[] {ret_values};

Expand Down
Expand Up @@ -186,6 +186,7 @@ public VoltTable[] run(long trade_id, double trade_price, String st_completed_id
double sell_value = 0;
// Date trade_dts = Calendar.getInstance().getTime();
long trade_dts = Calendar.getInstance().getTimeInMillis();
TimestampType timestamp = new TimestampType(trade_dts);
if (type_is_sell == 1) {
System.out.println("type was sell");
if (hs_qty == 0) {
Expand Down Expand Up @@ -269,7 +270,7 @@ else if (hs_qty != trade_qty) {
//QLStmt("insert into HOLDING (H_T_ID, H_CA_ID, H_S_SYMB, H_DTS, H_PRICE, H_QTY) " + "values (?, ?, ?, ?, ?, ?)");
voltQueueSQL(insertHoldingHistory, trade_id, trade_id, 0, -needed_qty);
System.out.println("inserted HH");
voltQueueSQL(insertHolding, trade_id, acct_id, symbol, trade_dts, trade_price, -needed_qty);
voltQueueSQL(insertHolding, trade_id, acct_id, symbol, timestamp, trade_price, -needed_qty); //trade_dts
System.out.println("inserted HH");
// try{
voltExecuteSQL();
Expand Down Expand Up @@ -355,8 +356,10 @@ else if (-hs_qty != trade_qty) {
// all shorts are covered? a new long is created
if (needed_qty > 0) {
System.out.println("needed qty > 0");
System.out.println("Trade id:" + trade_id);
System.out.println("acct_id"+ acct_id);
voltQueueSQL(insertHoldingHistory, trade_id, trade_id, 0, needed_qty);
voltQueueSQL(insertHolding, trade_id, acct_id, symbol, trade_dts, trade_price, needed_qty);
voltQueueSQL(insertHolding, trade_id, acct_id, symbol, timestamp, trade_price, needed_qty);
voltExecuteSQL();
}
else if (-hs_qty == trade_qty) {
Expand Down

0 comments on commit a3d6c52

Please sign in to comment.