Exemple #1
0
 def testCmbPosition(self):
     inputFile = join(getCurrentDir(), 'samples', 'TD_40017_new.xlsx')
     holding = list(map(partial(cmbPosition, 'test'), readHolding(inputFile)[1]))
     self.verifyCmbHolding(holding[0])
Exemple #2
0
           , positions)))\
      , quotechar='"'\
      , quoting=csv.QUOTE_NONNUMERIC)

    return outputFile


if __name__ == '__main__':
    import logging.config
    logging.config.fileConfig('logging.config', disable_existing_loggers=False)

    from tradefeed_cmbhk.utility import getCurrentDir
    import argparse
    parser = argparse.ArgumentParser()
    parser.add_argument('file', metavar='trade file')
    parser.add_argument('--mode', metavar='database mode', default='test')
    args = parser.parse_args()
    """
	To do test in command line mode, do:

	$ python tfcmb.py <input_file>

	The above connects to the test database and creates the output file
	in the local directory.

	To connect to production database in command line, do:

	$ python tfcmb.py <input_file> --mode production
	"""
    print(toCsv(join(getCurrentDir(), args.file), '', args.mode))
Exemple #3
0
 def testReadHolding(self):
     inputFile = join(getCurrentDir(), 'samples', 'TD_40017_new.xlsx')
     date, holding = (lambda x: (x[0], list(x[1])))(readHolding(inputFile))
     self.assertEqual('09Jul2021', date)
     self.assertEqual(2, len(holding))
 def testReadHolding2(self):
     inputFile = join(getCurrentDir(), 'samples', 'TD22082019.xlsx')
     date, holding = (lambda x: (x[0], list(x[1])))(readHolding(inputFile))
     self.assertEqual('22Aug2019', date)
     self.assertEqual(2, len(holding))
     self.verifyHolding2(holding[1])