home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-04-23 | 1.1 KB | 44 lines |
- package COM.odi.demo.pport;
-
- /**
- * <H3>Copyright (C) Object Design Inc. 1996, 1997</H3>
- *
- * Given the already-loaded database, print out the net asset value of
- * the Benchmark portfolio for every day in the year 1995.
- */
-
- import COM.odi.*;
-
- final
- public class Top
- {
-
- public static void main(String argv[]) throws java.io.IOException
- {
- String host = System.getProperty("COM.odi.host");
- String dbpath = System.getProperty("port.dbpath");
-
- if (dbpath == null)
- dbpath = "port.odb";
-
- ObjectStore.initialize(host, null);
- Database db = Database.open(dbpath, ObjectStore.OPEN_READONLY);
-
- Transaction t = Transaction.begin(ObjectStore.UPDATE);
-
- Security.initialize(db);
- Portfolio.initialize(db);
-
- Portfolio b = Portfolio.lookup("Benchmark");
- TradeDate from = new TradeDate("950101");
- TradeDate to = new TradeDate("951229");
- int[] nav = b.computeNAV(from, to);
- for (int i = 0; i < nav.length; i++) {
- System.out.println("NAV on " + from.toString() + " is " + nav[i]);
- from.next();
- }
-
- t.commit();
- }
- }
-