Month: October 2021

Python Black-Scholes Model and the Basics of Option Pricing

📕 Part I: Risk-neutral valuation, Monte Carlo integration vs. the Black-Scholes formula You can find the code in the GitHub repository for this article. The Black-Scholes (BS) pricing model is still a de facto standard method of pricing financial options. Even though there has been much research into improved and possibly more realistic models, the fact …

Python Black-Scholes Model and the Basics of Option Pricing Read More »

Python __imul__() Magic Method

Syntax object.__imul__(self, other) The Python __imul__() magic method implements in-place multiplication x *= y that subtracts the operands from each other and assigns the result to the left operand. This operation is also called augmented arithmetic assignment. The method simply returns the new value to be assigned to the first operand. When you call x …

Python __imul__() Magic Method Read More »

Python __isub__() Magic Method

Syntax object.__isub__(self, other) The Python __isub__() magic method implements in-place subtraction x -= y that subtracts the operands from each other and assigns the result to the left operand. This operation is also called augmented arithmetic assignment. The method simply returns the new value to be assigned to the first operand. When you call x …

Python __isub__() Magic Method Read More »

Python __iadd__() Magic Method

Syntax object.__iadd__(self, other) The Python __iadd__() magic method implements in-place addition x += y that adds together the operands and assigns the result to the left operand. This operation is also called augmented arithmetic assignment. The method simply returns the new value to be assigned to the first operand. When you call x += y, …

Python __iadd__() Magic Method Read More »

Python __rrshift__() Magic Method

Syntax object.__rrshift__(self, other) The Python __rrshift__() method implements the reverse bitwise right-shift operation with reflected, swapped operands. So, when you call x >> y, Python attempts to call x.__rshift__(y). If the method is not implemented, Python attempts to call y.__rrshift__(x) on the right operand and if this isn’t implemented either, it raises a TypeError. The …

Python __rrshift__() Magic Method Read More »

Python __rlshift__() Magic Method

Syntax object.__rlshift__(self, other) The Python __rlshift__() method implements the reverse bitwise left-shift operation with reflected, swapped operands. So, when you call x << y, Python attempts to call x.__lshift__(y). If the method is not implemented, Python attempts to call y.__rlshift__(x) on the right operand and if this isn’t implemented either, it raises a TypeError. The …

Python __rlshift__() Magic Method Read More »