// @Override public void populateAxysBlotter(SWposExport _report, java.util.Date _workingdate) throws BlotterTranslationErrorFoundException { // -- get all the accounts, symbols and prices fo the working date to save database traffic // -- get all the axys symbols gatherSymbol.getAxysSymbols(); // -- get all the prices for the working date gatherPrice.getAllAxysPrices4Date(_workingdate); // -- get all the symbol translation gatherSWsymtranlate.getAllSWsymtranslation(); while (!posSWList.isEmpty()) { // -- grap it from the list by removing it from the list SWposition swpos = posSWList.remove(0); if (posSWList.size() % 1000 == 0) logger.debug("count remain = {}", posSWList.size()); // -- catch AccoutNotFoundException and SymbolNotFoundException try { translatePos(swpos); } catch (AccountNotFoundException e) { _report.SWaccountErrorPOSlist.add(swpos); } catch (SymbolNotFoundException se) { _report.SWSymbolErrorPOSlist.add(swpos); } catch (PriceNotFoundException se) { _report.SWPriceErrorPOSlist.add(swpos); } } // -- end of while // -- check to see if there is any Account or Symbol Errors if (_report.getTotalErrorPOScount() > 0) { writeReport(_report); throw new BlotterTranslationErrorFoundException(formatter.format(this.txWorkingDate)); } } // -- end of method
// -- private function : private void translatePos(SWposition _swpos) throws AccountNotFoundException, SymbolNotFoundException, PriceNotFoundException { // -- the following objects already populated with full list // --accountHandler.getGCOAccount(); // --symbolHandler.getAxysSymbols(); // --priceHandler.getAllFIprice4Date(_workingdate); Account workingAccount; SWprice aprice; AxysSymbol asymbol; // -- https://gcosite.atlassian.net/browse/BREADY-93 // -- Filter out CASH?? positions except CASH01 CASH03 CASH07 // -- This also will filter out the accounts which are not funded if (String.valueOf(_swpos.getSECURITY_SYMBOL()).trim().toUpperCase().length() >= 6 && String.valueOf(_swpos.getSECURITY_SYMBOL()) .trim() .toUpperCase() .substring(0, 4) .equals("CASH") && !(String.valueOf(_swpos.getSECURITY_SYMBOL()) .trim() .toUpperCase() .substring(0, 6) .equals("CASH01") || String.valueOf(_swpos.getSECURITY_SYMBOL()) .trim() .toUpperCase() .substring(0, 6) .equals("CASH03") || String.valueOf(_swpos.getSECURITY_SYMBOL()) .trim() .toUpperCase() .substring(0, 6) .equals("CASH07"))) { return; } else { // -- Filter out CASH01 CASH03 CASH07 with Zero quantity if (String.valueOf(_swpos.getSECURITY_SYMBOL()).trim().toUpperCase().length() >= 6 && (String.valueOf(_swpos.getSECURITY_SYMBOL()) .trim() .toUpperCase() .substring(0, 6) .equals("CASH01") || String.valueOf(_swpos.getSECURITY_SYMBOL()) .trim() .toUpperCase() .substring(0, 6) .equals("CASH03") || String.valueOf(_swpos.getSECURITY_SYMBOL()) .trim() .toUpperCase() .substring(0, 6) .equals("CASH07")) && Double.valueOf(String.valueOf(_swpos.getUNITS_HELD()).trim()) == 0.0) { return; } // -- get the short name for the associating account number workingAccount = gatherAccount.getGCOAccountUSingAccountNumberCache( String.valueOf(_swpos.getACCOUNT_NUMBER()).trim().toUpperCase()); // -- get the symbol and its type throws SymbolNotFoundException asymbol = this.gatherSymbol.getAxysSymbolcache( String.valueOf( gatherSWsymtranlate .getSWsymtranslationcache( String.valueOf(_swpos.getSECURITY_SYMBOL()).trim().toUpperCase()) .getSYMBOL()) .trim() .toUpperCase()); // -- get the price if (String.valueOf(_swpos.getSECURITY_SYMBOL()).trim().toUpperCase().equals("CASH01") || String.valueOf(_swpos.getSECURITY_SYMBOL()).trim().toUpperCase().equals("CASH03") || String.valueOf(_swpos.getSECURITY_SYMBOL()).trim().toUpperCase().equals("CASH07")) { // -- for CASH01 CASH03 CASH07 are NOT in price file so create one manually with price of 1 aprice = new SWprice( "ca".toCharArray(), "fcash".toCharArray(), "1".toCharArray(), _swpos.getSOURCE_DATE(), _swpos.getMASTER_ACCOUNT_NUMBER(), _swpos.getSOURCE_DATE()); } else { AxysPrice axysprice = this.gatherPrice.getAxysPricecache( String.valueOf(_swpos.getSECURITY_SYMBOL()).trim().toUpperCase(), _swpos.getDATE_SOURCE_DATE()); aprice = new SWprice(); // -- only close price is currently used in PositionRule4SW class aprice.setSECURITY_SYMBOL(axysprice.getCHAR_SYMBOL()); aprice.setCLOSING_PRICE(axysprice.getCHAR_PRICE()); } PositionRule4SW buyRule = new PositionRule4SW(workingAccount, _swpos, asymbol, aprice); txBlotterList = buyRule.appendAxysBlotter(txBlotterList); } }