예제 #1
0
 @Override
 public Map<String, Double> getClientNetPositions() {
   Map<String, Double> rtn = new HashMap<>();
   for (Map.Entry<String, List<OrderOutcome>> clientOrderAuditEntry :
       inMemoryClientOrderAudit.entrySet()) {
     List<OrderOutcome> ordersForClient = clientOrderAuditEntry.getValue();
     Double sumOfTransactionsPerDigicoin = 0d;
     Double allAmounts = 0d;
     for (OrderOutcome orderOutcome : ordersForClient) {
       sumOfTransactionsPerDigicoin +=
           orderOutcome.getPrice() / Math.abs(orderOutcome.getOrder().getAmount());
       allAmounts += orderOutcome.getOrder().getAmount();
     }
     Double average =
         new Double(sumOfTransactionsPerDigicoin / ordersForClient.size()) * allAmounts;
     rtn.put(
         clientOrderAuditEntry.getKey(),
         new BigDecimal(average).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue());
   }
   return rtn;
 }
예제 #2
0
 @Override
 public Map<String, Long> getDigicoinTransactionsByBroker() {
   Map<String, Long> rtn = new HashMap<>();
   for (Map.Entry<String, List<OrderOutcome>> brokerOrderAuditEntry :
       inMemoryBrokerOrderAudit.entrySet()) {
     List<OrderOutcome> ordersForBroker = brokerOrderAuditEntry.getValue();
     Long totalForBroker = 0l;
     for (OrderOutcome orderOutcome : ordersForBroker) {
       totalForBroker += Math.abs(orderOutcome.getOrder().getAmount());
     }
     rtn.put(brokerOrderAuditEntry.getKey(), totalForBroker);
   }
   return rtn;
 }
예제 #3
0
 @Override
 public void auditClientOrder(OrderOutcome orderOutcome) {
   doAuditOrder(inMemoryClientOrderAudit, orderOutcome.getOrder().getClient(), orderOutcome);
 }