コード例 #1
0
 def test_short_call_payoff_ITM(self):
     # short call -\
     position = -1
     for x in range(45, 0, -5):
         payoff = pf.call_payoff(self.strike_price, self.premeium, position,
                                 self.quantity, x)
         self.assertTrue(payoff == self.premeium)
コード例 #2
0
 def test_short_call_payoff_OTM(self):
     # short call -\
     position = -1
     for x in range(55, 2 * self.strike_price, 5):
         payoff = pf.call_payoff(self.strike_price, self.premeium, position,
                                 self.quantity, x)
         self.assertTrue(payoff == -(x - self.strike_price - self.premeium))
コード例 #3
0
 def test_long_call_payoff_OTM(self):
     # long call _/
     position = 1
     for x in range(45, 0, -5):
         payoff = pf.call_payoff(self.strike_price, self.premeium, position,
                                 self.quantity, x)
         self.assertTrue(payoff == -self.premeium)
コード例 #4
0
 def test_short_call_payoff_ATM(self):
     # short call -\
     position = -1
     payoff = pf.call_payoff(self.strike_price, self.premeium, position,
                             self.quantity, self.x)
     self.assertTrue(payoff == self.premeium)
コード例 #5
0
 def test_long_call_payoff_ITM(self):
     position = 1
     for x in range(55, 2 * self.strike_price, 5):
         payoff = pf.call_payoff(self.strike_price, self.premeium, position,
                                 self.quantity, x)
         self.assertTrue(payoff == x - self.strike_price - self.premeium)
コード例 #6
0
 def test_long_call_payoff_ATM(self):
     # long call _/
     position = 1
     payoff = pf.call_payoff(self.strike_price, self.premeium, position,
                             self.quantity, self.x)
     self.assertTrue(payoff == -self.premeium)