private BigDecimal getDefaultLot() {
   Account account = this.get_Account();
   TradePolicyDetail tradePolicyDetail =
       this._settingsManager.getTradePolicyDetail(
           account.get_TradePolicyId(), this._instrument.get_Id());
   return this._isForDelivery
       ? tradePolicyDetail.get_PhysicalMinDeliveryQuantity()
       : AppToolkit.getDefaultLot(this._instrument, true, tradePolicyDetail, this);
 }
 private void initInstalmentStatus() {
   if (this._instrument.get_Category().equals(InstrumentCategory.Physical)) {
     TradePolicyDetail tradePolicyDetail = this.getTradePolicyDetail();
     Guid instalmentPolicyId = tradePolicyDetail.get_InstalmentPolicyId();
     if (instalmentPolicyId != null) {
       this.instalmentPolicy = this._settingsManager.getInstalmentPolicy(instalmentPolicyId);
       this.canFullPayment = tradePolicyDetail.isAllowed(PaymentForm.FullPayment);
       this.canInstalment =
           tradePolicyDetail.isAllowed(PaymentForm.Instalment)
               && this.instalmentPolicy.getActivePeriods().size() > 0;
       this.canAdvancePayment =
           tradePolicyDetail.isAllowed(PaymentForm.Prepay)
               && this.instalmentPolicy.get_TillPayoffDetail() != null
               && this.instalmentPolicy.get_TillPayoffDetail().get_IsActive();
     }
   }
 }
  /*
  Remarks
  sum (SellLotBalance) = all confirmed order.Sell.LotBalance
    + unconfirmed order (stop).Sell.Lot
    + iif("MOC/MOO allow New" = False,
   unconfirmed order (MOO/MOC).Sell.Lot,
   0)

  sum (BuyLotBalance) = all confirmed order.Buy.LotBalance
    + unconfirmed order (stop).Buy.Lot
    + iif("MOC/MOO allow New" = False,
   unconfirmed order (MOO/MOC).Buy.Lot,
   0)
  */
  public BigDecimal[] getSumLotBSForMakeStopOrder() {
    BigDecimal[] sumLot = new BigDecimal[] {BigDecimal.ZERO, BigDecimal.ZERO};
    TradePolicyDetail tradePolicyDetail = this.getTradePolicyDetail();
    HashMap<Guid, Transaction> accountInstrumentTransactions =
        this.getAccountInstrumentTransactions();
    for (Iterator<Transaction> iterator = accountInstrumentTransactions.values().iterator();
        iterator.hasNext(); ) {
      Transaction transaction = iterator.next();
      if (transaction.get_Phase() == Phase.Executed) {
        for (Iterator<Order> iterator2 = transaction.get_Orders().values().iterator();
            iterator2.hasNext(); ) {
          Order order = iterator2.next();
          if (order.get_LotBalance().compareTo(BigDecimal.ZERO) > 0) {
            if (order.get_IsBuy()) {
              sumLot[0] = sumLot[0].add(order.get_LotBalance());
            } else {
              sumLot[1] = sumLot[1].add(order.get_LotBalance());
            }
          }
        }
      } else if (transaction.get_Phase() == Phase.Placing
          || transaction.get_Phase() == Phase.Placed) {
        for (Iterator<Order> iterator2 = transaction.get_Orders().values().iterator();
            iterator2.hasNext(); ) {
          Order order = iterator2.next();
          if (order.get_TradeOption() == TradeOption.Stop
              || (!tradePolicyDetail.get_IsAcceptNewMOOMOC()
                  && (transaction.get_OrderType() == OrderType.MarketOnOpen
                      || transaction.get_OrderType() == OrderType.MarketOnClose))) {
            if (order.get_IsBuy()) {
              sumLot[0] = sumLot[0].add(order.get_Lot());
            } else {
              sumLot[1] = sumLot[1].add(order.get_Lot());
            }
          }
        }
      }
    }
    return sumLot;
  }