Security Market Line
The security market line is very similar to the capital market line with one difference, it is based off of beta. It is the line that CAPM dictates.
def SML(rf,rm,label):
betas = [x/10 for x in range(21)]
assetReturns = [rf+(rm-rf)*x for x in betas]
plt.plot(betas,assetReturns,label=label)
plt.xlabel("Asset Beta")
plt.ylabel("Asset Return")
plt.title("Security Market Line")
plt.plot(1,rm,"ro")
Notice how the two lines work in a similar manner.
SML(.02,.08,"Line 1")
plt.legend()
plt.show()
SML(.02,.08,"Line 1")
SML(.04,.1,"Line 2")
plt.legend()
plt.show()
SML(.02,.08,"Line 1")
SML(.04,.08,"Line 2")
plt.legend()
plt.show()
Source Code