def get_option_chain_1():
        # calls
        c1 = option_factory.call(80, 21)
        c2 = option_factory.call(85, 17)
        c3 = option_factory.call(90, 13)
        c4 = option_factory.call(95, 9)
        c5 = option_factory.call(100, 5)
        c6 = option_factory.call(105, 3)
        c7 = option_factory.call(110, 1.5)
        c8 = option_factory.call(115, 1)
        c9 = option_factory.call(120, 0.5)
        # puts
        p1 = option_factory.put(80, 0.5)
        p2 = option_factory.put(85, 1)
        p3 = option_factory.put(90, 1.5)
        p4 = option_factory.put(95, 3)
        p5 = option_factory.put(100, 5)
        p6 = option_factory.put(105, 9)
        p7 = option_factory.put(110, 13)
        p8 = option_factory.put(115, 17)
        p9 = option_factory.put(120, 21)

        options = [c1, c2, c3, c4, c5, c6, c7, c8, c9, p1, p2, p3, p4, p5, p6, p7, p8, p9]
        return options
    def test_compute_best_one_leg_positions(self):
        # calls
        c1 = option_factory.call(80, 25)
        c2 = option_factory.call(85, 20)
        c3 = option_factory.call(90, 15)
        c4 = option_factory.call(95, 10)
        c5 = option_factory.call(100, 5)
        c6 = option_factory.call(105, 3)
        c7 = option_factory.call(110, 1.5)
        c8 = option_factory.call(115, 1)
        c9 = option_factory.call(120, 0.5)
        # puts
        p1 = option_factory.put(80, 0.5)
        p2 = option_factory.put(85, 1)
        p3 = option_factory.put(90, 1.5)
        p4 = option_factory.put(95, 3)
        p5 = option_factory.put(100, 5)
        p6 = option_factory.put(105, 10)
        p7 = option_factory.put(110, 15)
        p8 = option_factory.put(115, 20)
        p9 = option_factory.put(120, 25)

        options = [c1, c2, c3, c4, c5, c6, c7, c8, c9, p1, p2, p3, p4, p5, p6, p7, p8, p9]

        my_distribution = distribution.Distribution(70, 130, lambda x: (x - 70) / (130 - 70), lambda x: 1 / (130 - 70))
        allow_uncapped_risk = True
        num_to_return = 5
        best_positions = option_position_analysis.compute_best_positions_for_num_legs(1, options, my_distribution, allow_uncapped_risk, num_to_return)
        self.assertEqual(num_to_return, len(best_positions))

        leg1 = best_positions[0].option_position[0]
        self.assertEqual('Short', leg1['direction'])
        self.assertAlmostEqual(25, leg1['option']['price'])
        self.assertAlmostEqual(80, leg1['option']['strike'])
        self.assertEqual('Call', leg1['option']['type'])

        leg2 = best_positions[1].option_position[0]
        self.assertEqual('Short', leg2['direction'])
        self.assertAlmostEqual(25, leg2['option']['price'])
        self.assertAlmostEqual(120, leg2['option']['strike'])
        self.assertEqual('Put', leg2['option']['type'])

        leg3 = best_positions[2].option_position[0]
        self.assertEqual('Short', leg3['direction'])
        self.assertAlmostEqual(20, leg3['option']['price'])
        self.assertAlmostEqual(85, leg3['option']['strike'])
        self.assertEqual('Call', leg3['option']['type'])

        leg4 = best_positions[3].option_position[0]
        self.assertEqual('Short', leg4['direction'])
        self.assertAlmostEqual(20, leg4['option']['price'])
        self.assertAlmostEqual(115, leg4['option']['strike'])
        self.assertEqual('Put', leg4['option']['type'])

        leg5 = best_positions[4].option_position[0]
        self.assertEqual('Short', leg5['direction'])
        self.assertAlmostEqual(15, leg5['option']['price'])
        self.assertAlmostEqual(90, leg5['option']['strike'])
        self.assertEqual('Call', leg5['option']['type'])

        for p in best_positions:
            print(p)
        print('\n\n')