src/test/java/com/billybyte/commonlibs/testcases/dse/TestMonteCarlo.java
public void testMcVsAnalyticWithModelsWithOptions(){
		// replace vol query
		VolQueryForTest volQuery = 
				(VolQueryForTest)dse.getQueryManager().getQuery(volDiot);
		VolQueryForOptionsTest newVolQuery = 
				new VolQueryForOptionsTest(volQuery.getTestDataMap());
		dse.getQueryManager().registerDioType(volDiot, newVolQuery);
		
//		// create diot map for the each model/security
//		// for this test, pretend the derivative names are the same as the underlying names
		Set<String> derivNames = generateDerivNamesFromUnderlyingNames(underlyingNames);

		McVar mcv = new McVar();
		Map<String, BigDecimal> position = new HashMap<String, BigDecimal>();
		
		for(String name:derivNames){
			position.put(name, BigDecimal.ONE);
		}
		double var = mcv.mcVar(position, trials, dse);
		
		double var2 = getAnalyticVar()/2;
		
		Utils.prt("testMcVsAnalyticWithModelsWithOptions monte carlo var: " + var + "  analytic var: "+var2);
		double diff = Math.abs(var+var2);
		assertTrue(diff<var2*.2);
	}
/**
	 * This is the main test for monte carlo.
	 * The process of executing a monte carlo run is comprised of several stages:
	 * 1.  Create a dse;
	 * 2.  Get all derivative shortNames;
	 * 3.  Get a Matrix of all initial prices for each security in the portfolio by calling
	 *     getCopiedCurrentValues.  This method calls the dse, and then reorders the price 
	 *     outputs into a Matrix, where the rows are ordered by derivative shortName;
	 * 4.  
	 */
This is the main test for monte carlo.
The process of executing a monte carlo run is comprised of several stages:
1.  Create a dse;
2.  Get all derivative shortNames;
3.  Get a Matrix of all initial prices for each security in the portfolio by calling
getCopiedCurrentValues.  This method calls the dse, and then reorders the price
outputs into a Matrix, where the rows are ordered by derivative shortName;
4.
This is the main test for monte carlo . The process of executing a monte carlo run is comprised of several stages : 1 . Create a dse ; 2 . Get all derivative shortNames ; 3 . Get a Matrix of all initial prices for each security in the portfolio by calling getCopiedCurrentValues . This method calls the dse and then reorders the price outputs into a Matrix where the rows are ordered by derivative shortName ; 4 .
public void testMcVsAnalyticWithModelsWithOptions(){
		VolQueryForTest volQuery = 
				(VolQueryForTest)dse.getQueryManager().getQuery(volDiot);
		VolQueryForOptionsTest newVolQuery = 
				new VolQueryForOptionsTest(volQuery.getTestDataMap());
		dse.getQueryManager().registerDioType(volDiot, newVolQuery);
		Set<String> derivNames = generateDerivNamesFromUnderlyingNames(underlyingNames);
		McVar mcv = new McVar();
		Map<String, BigDecimal> position = new HashMap<String, BigDecimal>();
		for(String name:derivNames){
			position.put(name, BigDecimal.ONE);
		}
		double var = mcv.mcVar(position, trials, dse);
		double var2 = getAnalyticVar()/2;
		Utils.prt("testMcVsAnalyticWithModelsWithOptions monte carlo var: " + var + "  analytic var: "+var2);
		double diff = Math.abs(var+var2);
		assertTrue(diff<var2*.2);
	}
public void testMcVsAnalyticWithModelsWithOptions ( ) { VolQueryForTest volQuery = ( VolQueryForTest ) dse . getQueryManager ( ) . getQuery ( volDiot ) ; VolQueryForOptionsTest newVolQuery = new VolQueryForOptionsTest ( volQuery . getTestDataMap ( ) ) ; dse . getQueryManager ( ) . registerDioType ( volDiot , newVolQuery ) ; Set < String > derivNames = generateDerivNamesFromUnderlyingNames ( underlyingNames ) ; McVar mcv = new McVar ( ) ; Map < String , BigDecimal > position = new HashMap < String , BigDecimal > ( ) ; for ( String name : derivNames ) { position . put ( name , BigDecimal . ONE ) ; } double var = mcv . mcVar ( position , trials , dse ) ; double var2 = getAnalyticVar ( ) / 2 ; Utils . prt ( "testMcVsAnalyticWithModelsWithOptions monte carlo var: " + var + "  analytic var: " + var2 ) ; double diff = Math . abs ( var + var2 ) ; assertTrue ( diff < var2 * .2 ) ; }
This is the main test for monte carlo.
This is the main test for monte carlo .
// replace vol query //		// create diot map for the each model/security //		// for this test, pretend the derivative names are the same as the underlying names