Exemplo n.º 1
0
  public void cleanOutStandingTable(boolean closeAllSell) {
    ArrayList<Guid> toBeRemoved = new ArrayList<Guid>();
    for (Iterator<RelationOrder> iterator = this._outstandingOrders.values().iterator();
        iterator.hasNext(); ) {
      RelationOrder relationOrder = iterator.next();
      if (relationOrder.get_OpenOrder().get_IsBuy() == closeAllSell) {
        toBeRemoved.add(relationOrder.get_OpenOrder().get_Id());
        this._bindingSourceForOutstanding.remove(relationOrder);
      }
    }

    for (Guid id : toBeRemoved) {
      this._outstandingOrders.remove(id);
    }
  }
Exemplo n.º 2
0
  public void setDefaultLiqLotForOutStanding(
      BuySellType buySellType,
      boolean isSelectedRelationOrder,
      boolean isSpotTrade,
      Boolean isMakeLimitOrder) {
    for (Iterator<RelationOrder> iterator = this._outstandingOrders.values().iterator();
        iterator.hasNext(); ) {
      RelationOrder relationOrder = iterator.next();

      relationOrder.set_IsSelected(isSelectedRelationOrder);
      BigDecimal liqLot =
          relationOrder.get_OpenOrder().getAvailableLotBanlance(isSpotTrade, isMakeLimitOrder);
      if (this._outstandingOrders.values().size() == 1) {
        TradePolicyDetail tradePolicyDetail = this.getTradePolicyDetail();
        liqLot = AppToolkit.fixCloseLot(liqLot, liqLot, tradePolicyDetail, this._account);
      }

      boolean isBuy = (buySellType == BuySellType.Buy);
      if (buySellType == BuySellType.Both) {
        relationOrder.set_LiqLot(liqLot);
        // Update Outstanding Order UI
        relationOrder.update(this._outstandingKey);
      } else if (relationOrder.get_IsBuy() != isBuy) {
        relationOrder.set_LiqLot(liqLot);
        // Update Outstanding Order UI
        // maybe not binding
        // if (this._isBuyForCurrent != isBuy)
        // {
        relationOrder.update(this._outstandingKey);
        // }
      }
    }
  }
Exemplo n.º 3
0
 public BigDecimal getQuoteLotForDirectLiq(boolean isSpotTrade, Boolean isMakeLimitOrder) {
   BigDecimal quoteLot = BigDecimal.ZERO;
   for (Iterator<RelationOrder> iterator = this._outstandingOrders.values().iterator();
       iterator.hasNext(); ) {
     RelationOrder relationOrder = iterator.next();
     quoteLot =
         quoteLot.add(
             relationOrder.get_OpenOrder().getAvailableLotBanlance(isSpotTrade, isMakeLimitOrder));
   }
   return quoteLot;
 }