def test_volume_size_greater_than_ten(self): args = [ ('000000000001', 'DAV001', '100000'), ('000000000002', 'DAV002', '200000'), ('000000000003', 'DAV003', '010000'), ('000000000004', 'DAV004', '900000'), ('000000000005', 'DAV005', '100001'), ('000000000006', 'DAV006', '200001'), ('000000000007', 'DAV007', '010001'), ('000000000008', 'DAV008', '900001'), ('000000000009', 'DAV009', '100002'), ('000000000010', 'DAV010', '200002'), ('000000000011', 'DAV011', '010002'), ('000000000012', 'DAV012', '900002'), ('000000000013', 'DAV013', '000001'), ('000000000014', 'DAV014', '999999'), ] volume = pitch_parser(self._make_orders(args)) result = extract_top_ten_symbols_from_volume(volume) expected = ( ('DAV014', 999999), ('DAV012', 900002), ('DAV008', 900001), ('DAV004', 900000), ('DAV010', 200002), ('DAV006', 200001), ('DAV002', 200000), ('DAV009', 100002), ('DAV005', 100001), ('DAV001', 100000), ) self.assertTupleEqual(result, expected)
def test_empty_volume(self): data = [] volume = pitch_parser(data) result = extract_top_ten_symbols_from_volume(volume) expected = () self.assertTupleEqual(result, expected)
def test_execute_order_for_uknown_id(self): data = [ create_execute_order(order_id='QQQWWWEEERRR', exec_shares='000100'), ] result = pitch_parser(data) expected = {} self.assertDictEqual(result, expected)
def test_add_order_and_execute_order(self): data = [ create_add_order(stock_symbol='DAV ', order_id='QQQWWWEEERRR', shares='000200'), create_execute_order(order_id='QQQWWWEEERRR', exec_shares='000110') ] result = pitch_parser(data) expected = {"DAV": 110} self.assertDictEqual(result, expected)
def test_volume_size_smaller_than_ten(self): args = [ ('000000000001', 'DAV001', '100000'), ('000000000002', 'DAV002', '200000'), ('000000000003', 'DAV003', '010000'), ] volume = pitch_parser(self._make_orders(args)) result = extract_top_ten_symbols_from_volume(volume) expected = ( ('DAV002', 200000), ('DAV001', 100000), ('DAV003', 10000), ) self.assertTupleEqual(result, expected)
def test_add_order(self): data = [create_add_order()] result = pitch_parser(data) self.assertDictEqual(result, {})
def test_no_orders(self): data = [] result = pitch_parser(data) self.assertDictEqual(result, {})