public void update(Position position) {
      // skip fake FX positions
      if (position.contract().secType() == SecType.CASH) {
        return;
      }

      if (!m_portfolioMap.containsKey(position.conid()) && position.position() != 0) {
        m_positions.add(position.conid());
      }
      m_portfolioMap.put(position.conid(), position);

      fireTableDataChanged();
    }
 @Override
 public Object getValueAt(int row, int col) {
   Position pos = getPosition(row);
   switch (col) {
     case 0:
       return pos.contract().description();
     case 1:
       return pos.position();
     case 2:
       return pos.marketPrice();
     case 3:
       return format("" + pos.marketValue(), null);
     case 4:
       return pos.averageCost();
     case 5:
       return pos.unrealPnl();
     case 6:
       return pos.realPnl();
     default:
       return null;
   }
 }
 /** Receive position. */
 public synchronized void updatePortfolio(Position position) {
   if (position.account().equals(m_selAcct)) {
     m_portfolioModel.update(position);
   }
 }