Adding new contracts

The proper way to add contracts to the Contract table is by adding new data to the source and intermediate load files from which it was originally defined, and reloading the database by running the create.sql script. Note that for production use, you will want to first unload history data records and order journal entries in order to save them, since in reloading the database tables are first dropped, then recreated, and finally reloaded. In what follows, when I speak of adding an entry to a table, I mean that an entry is added to the load file, so that the changes you make will persist the next time you recreate the database.

In brief, the preferred way to add a new contract to the Contract table is to add an entry to the LocalSet load file mod/LocalSet.sql, add supporting entries as needed to primary and intermediate load files used to populate Symbol, and then recreate the database.

In the worst case, for a new Underlying not yet appearing in the database, you will have to add to one of Currency, Miscellany, or Stock, then, if deriving from that, to ProductMap, and in any case, add to LocalSet. If the underlying already exists, but some derivative of interest does not, then you need add to only ProductMap and LocalSet; and if the security of interest occurs in Symbol, you only need select it by adding to LocalSet.

To summarize, in order to add a new contract, add a new LocalSet load file entry, and add as well supporting entries as needed to meet foreign key constraints, to the source load files req/Currency.sql, mod/Miscellany.sql, mod/Stock.sql, and
mod/ProductMap.sql; and then, from the directory sql, and in the mysql interpreter, source the create.sql script.

The table LocalSet, although used by the load script, is never referred to by the shim, and you are free to add or delete entries up to the point the database is used for production, after which existing entries must not be deleted, and adds should be at the end.

Bill Pippin 2010-01-14