Exemplo n.º 1
0
 private HashMap<Guid, RelationOrder> getEditOutstandingOrders(
     BuySellType buySellType, Order mapOrder) {
   HashMap<Guid, RelationOrder> editOutstandingOrders;
   if (buySellType == BuySellType.Both) {
     editOutstandingOrders = this._outstandingOrders;
     for (Iterator<RelationOrder> iterator = this._outstandingOrders.values().iterator();
         iterator.hasNext(); ) {
       RelationOrder relationOrder = iterator.next();
       if (mapOrder != null) {
         relationOrder.set_IsSelected(true);
       }
     }
   } else {
     editOutstandingOrders = new HashMap<Guid, RelationOrder>();
     for (Iterator<RelationOrder> iterator = this._outstandingOrders.values().iterator();
         iterator.hasNext(); ) {
       RelationOrder relationOrder = iterator.next();
       if (mapOrder != null) {
         relationOrder.set_IsSelected(true);
       }
       if (buySellType == BuySellType.Buy && relationOrder.get_IsBuy()) {
         editOutstandingOrders.put(relationOrder.get_OpenOrderId(), relationOrder);
       } else if (buySellType == BuySellType.Sell && !relationOrder.get_IsBuy()) {
         editOutstandingOrders.put(relationOrder.get_OpenOrderId(), relationOrder);
       }
     }
   }
   return editOutstandingOrders;
 }
Exemplo n.º 2
0
  public HashMap<Guid, RelationOrder> getPlaceRelation() {
    HashMap<Guid, RelationOrder> placeRelation = null;

    HashMap<Guid, RelationOrder> outstandingOrders = this.getOutstandingOrders();
    for (RelationOrder relationOrder : outstandingOrders.values()) {
      if (relationOrder.get_IsSelected()
          && relationOrder.get_CloseLot().compareTo(BigDecimal.ZERO) > 0) {
        if (placeRelation == null) placeRelation = new HashMap<Guid, RelationOrder>();
        placeRelation.put(relationOrder.get_OpenOrderId(), relationOrder);
      }
    }

    return placeRelation;
  }
Exemplo n.º 3
0
 private HashMap<Guid, Transaction> getAccountInstrumentTransactions() {
   HashMap<Guid, Transaction> transactions = null;
   HashMap<Guid, Transaction> accountTransactions = this._account.get_Transactions();
   HashMap<Guid, Transaction> instrumentTransactions = this._instrument.get_Transactions();
   if (accountTransactions == null || instrumentTransactions == null) {
     return transactions;
   }
   transactions = new HashMap<Guid, Transaction>();
   for (Iterator<Transaction> iterator = accountTransactions.values().iterator();
       iterator.hasNext(); ) {
     Transaction accountTransaction = iterator.next();
     Guid accountTransactionId = accountTransaction.get_Id();
     if (instrumentTransactions.containsKey(accountTransactionId)) {
       transactions.put(accountTransactionId, accountTransaction);
     }
   }
   return transactions;
 }