Example #1
0
    def test_getBestMatchingColor_better_buy(self):
        data = MarkersContainer()
        data.add("XXX", 3.0, 100, MarkerEntry.OperationType.BUY, "red")
        data.add("XXX", 1.0, 100, MarkerEntry.OperationType.BUY, "green")

        self.assertEqual(data.getBestMatchingColor("XXX", 0.5), "green")
Example #2
0
    def test_getBestMatchingColor_value_sell(self):
        data = MarkersContainer()
        data.add("XXX", 3.0, 100, MarkerEntry.OperationType.SELL, "red")
        data.add("XXX", 1.0, 100, MarkerEntry.OperationType.SELL, "green")

        self.assertEqual(data.getBestMatchingColor("XXX", 2.0), "green")
Example #3
0
    def test_getBestMatchingColor_value_None(self):
        data = MarkersContainer()
        data.add("XXX", None, 100, MarkerEntry.OperationType.BUY, "red")

        self.assertEqual(data.getBestMatchingColor("XXX", 2.0), None)
Example #4
0
    def test_getBestMatchingColor_ticker(self):
        data = MarkersContainer()
        data.add("XXX", 3.0, 100, MarkerEntry.OperationType.BUY, "red")
        data.add("YYY", 3.0, 100, MarkerEntry.OperationType.BUY, "green")

        self.assertEqual(data.getBestMatchingColor("XXX", 2.0), "red")
Example #5
0
 def test_getBestMatchingColor_empty(self):
     data = MarkersContainer()
     self.assertEqual(data.getBestMatchingColor("XXX", 2.0), None)
Example #6
0
    def test_deleteItemsList(self):
        data = MarkersContainer()
        data.add("XXX", 3.0, 100, MarkerEntry.OperationType.BUY, "red")
        data.add("YYY", 3.0, 100, MarkerEntry.OperationType.BUY, "green")

        removeList = [data.get(1)]
        data.deleteItemsList(removeList)
        self.assertEqual(data.size(), 1)
        self.assertEqual(data.get(0).ticker, "XXX")