예제 #1
0
 def testExpiration(self):
     e = Expiration(2017, 11, 30)
     self.assertEqual(yass.typeDesc(e).id, 8)
     self.assertEqual(e.year, 2017)
     self.assertEqual(e.month, 11)
     self.assertEqual(e.day, 30)
     self.assertEqual(str(e), '2017-11-30')
예제 #2
0
 def testExpiration(self):
     e = Expiration(2017, 11, 30)
     self.assertEqual(yass.typeDesc(e).id, 8)
     self.assertEqual(e.year, 2017)
     self.assertEqual(e.month, 11)
     self.assertEqual(e.day, 30)
     self.assertEqual(str(e), '2017-11-30')
예제 #3
0
 def testEnum(self):
     self.assertEqual(yass.typeDesc(PriceKind.ASK).id, 9)
     self.assertEqual(str(PriceKind.ASK), 'PriceKind.ASK')
     self.assertEqual(PriceKind.BID.value, 0)
     self.assertEqual(PriceKind.ASK.value, 1)
     self.assertEqual(PriceKind.ASK.name, 'ASK')
     self.assertTrue(PriceKind(0) is PriceKind.BID)
     self.assertTrue(PriceKind(1) is PriceKind.ASK)
예제 #4
0
 def testEnum(self):
     self.assertEqual(yass.typeDesc(PriceKind.ASK).id, 9)
     self.assertEqual(str(PriceKind.ASK), 'PriceKind.ASK')
     self.assertEqual(PriceKind.BID.value, 0)
     self.assertEqual(PriceKind.ASK.value, 1)
     self.assertEqual(PriceKind.ASK.name, 'ASK')
     self.assertTrue(PriceKind(0) is PriceKind.BID)
     self.assertTrue(PriceKind(1) is PriceKind.ASK)
예제 #5
0
 def testClasses(self):
     bond = Bond()
     bond.name = u"ABB"
     bond.coupon = 1.5
     stock = Stock()
     stock.name = u"ABB"
     stock.paysDividend = True
     node1 = Node()
     self.assertEqual(yass.typeDesc(node1).id, 15)
     node1.id = 1.
     node2 = Node()
     node2.id = 2.
     node2.links = [node1, node2]
     try:
         uie = UnknownInstrumentsException()
         uie.instrumentIds = [Integer(333), Integer(444)]
         uie.onlyNeededForTests2 = b'abc'
         raise uie
     except UnknownInstrumentsException as e:
         pass
예제 #6
0
 def testClasses(self):
     bond = Bond()
     bond.name = "ABB"
     bond.coupon = 1.5
     stock = Stock()
     stock.name = "ABB"
     stock.paysDividend = True
     node1 = Node()
     self.assertEqual(yass.typeDesc(node1).id, 15)
     node1.id = 1.
     node2 = Node()
     node2.id = 2.
     node2.links = [node1, node2]
     try:
         uie = UnknownInstrumentsException()
         uie.instrumentIds = [Integer(333), Integer(444)]
         uie.onlyNeededForTests2 = b'abc'
         raise uie
     except UnknownInstrumentsException as e:
         pass
예제 #7
0
 def testInteger(self):
     i = Integer(123)
     self.assertEqual(yass.typeDesc(i).id, 7)
     self.assertEqual(i.value, 123)
     self.assertEqual(str(i), '123')
예제 #8
0
 def testInteger(self):
     i = Integer(123)
     self.assertEqual(yass.typeDesc(i).id, 7)
     self.assertEqual(i.value, 123)
     self.assertEqual(str(i), '123')
     self.assertEqual(unicode(i), u'123')
예제 #9
0
 def testExpiration(self):
     e = Expiration(2017)
     self.assertEqual(yass.typeDesc(e).id, 8)
     self.assertEqual(e.year, 2017)
     self.assertEqual(str(e), '2017')