def setUp(self):
        Base.metadata.create_all()

        instrument = Instrument()
        instrument.ticker = 'MyTicker'
        instrument.asset_class = 'MyAssetClass'
        instrument.name = 'MyName'
        instrument.currency = 'USD'
        instrument.type = 'MyType'
        instrument.transactions_fees = 0.
        instrument.point_value = 1
        instrument.exchange = 'MyExchange'
        instrument.rolling_month = 'H'
        
        market_data = MarketData()
        market_data.instrument = instrument
        market_data.type = DataType.CLOSE
        market_data.date = datetime(2000,1,3)
        market_data.value = 100.
        
        session = Session()
        
        instrument_dao = InstrumentDAO()
        instrument_dao.save(session, instrument)
        
        market_data_dao = MarketDataDAO()
        market_data_dao.save(session, market_data)
        
        
        self.instrument_service = InstrumentService() 
 
     # read the dictionary file and persist instrument field into database
     content = csv.reader(open(data_repository + '/FuturesInfo.txt', 'r'))
 
     for row in content:
     
         # load instrument from database if none then no treatment
         instrument = instrument_dao.get_by_ticker(session, row[0])
     
         if instrument:
             logger.info('Filling %s'%instrument.name)
             # the exchange in caps
             instrument.exchange = row[4].upper()
             # the rolling month chain in caps
             instrument.rolling_month = row[5].upper()
             # the currency in caps
             instrument.currency = row[7].upper()
             # the point size manage case where number are given with coma (ex: 1,000.00)
             instrument.point_value = float(row[8].replace(',',''))
             # type
             instrument.type = InstrumentType.FUTURE
             # persit and fill instrument model
             instrument_dao.save(session, instrument)
             # add market data
             _fill_market_data(data_repository + '/Futures/' + row[3], instrument)
             
 except Exception, e:
     logger.error(e.message)
         
 logger.info('End of instrument filling')
     
    session = Session()
    
    Base.metadata.create_all()
    
    instrument_dao = InstrumentDAO()
    
    try:
        
        ad = instrument_dao.get_by_ticker(session, 'AD')
        if not ad:
            ad = Instrument()
        ad.ticker = 'AD'
        ad.name = 'Australian Dollar'
        ad.asset_class = 'Currencies'
        ad.transactions_fees = .00005
        instrument_dao.save(session, ad)
    
        bo = instrument_dao.get_by_ticker(session, 'BO')
        if not bo:
            bo = Instrument()
        bo.ticker = 'BO'
        bo.name = 'Soybean Oil'
        bo.asset_class = 'Grains'
        bo.transactions_fees = .015
        instrument_dao.save(session, bo)

        bp = instrument_dao.get_by_ticker(session, 'BP')
        if not bp:
            bp = Instrument()
        bp.ticker = 'BP'
        bp.name = 'British Pound'
 def setUp(self):
     Base.metadata.create_all()
     
     instrument_dao = InstrumentDAO()
     instrument_dao.save(self.session, self.instrument)