## Archive for April, 2021

### Risk-Neutral Pricing of Options post-Black Scholes

Apr 18, 2021 in Derivatives

From Cox and Ross to Harrison and Kreps

The use of options has been going on for millennia.  The first recorded instance dates back to Thales of Miletus, born around 650 B.C. Thales was known as a philosopher, scientist and mathematician, and was “the first person to investigate the basic principles, the question of the originating substances of matter and, therefore, as the founder of the school of natural philosophy.”[1]   During the lifetime of Thales, Miletus was densely populated with groves of olive trees.  Consequently, there was a thriving trade in olives and olive byproducts.  In his book “Politics” (published around 1259), Aristotle wrote: “Somehow, through observation of the heavenly bodies, Thales concluded that there would be a bumper crop of olives. He raised the money to put a deposit on the olive presses of Miletus and Chios, so that when the harvest was ready, he was able to let them out at a rate which brought him considerable profit.”  Thales did not purchase the presses outright. By placing a small deposit on them, he was able to control the rights to them, reaping a profit for a relatively small investment.  Had the olive harvest not come in as expected, Thales would have lost only his deposit.  Clearly the value of the rights to lease the presses was highly dependent on the prospects of the olive crop. This was the first recorded example of a call option:  the right, but not the obligation, to control an underlying asset at some future time.

Another documented example of early options trading was the tulip mania[2] of the 1630s.  Tulips were introduced to Holland in the 17th century for study as a medicinal agent.  During the Dutch Golden Age, the flowers became symbols of status and luxury and a booming trade developed[3]. Botanists developed many variants of the basic tulip.  Certain hybrids and mutations they developed were highly coveted.   The Semper Augustus, a flower with vivid red and white striped petals, was “famous for being the most expensive tulip sold during tulip mania.” 2,3The stripes were found to be the result of a tulip virus and professional growers began bidding up the prices for bulbs containing this virus.  Tulips can be grown from either seeds or bulbs.  Tulips bloom in the spring, and produce clone bulbs as well as several buds.  After blooming, tulip bulbs can be uprooted during the period June through September.  A vigorous spot market developed for trading these bulbs.  During the off-season, trading continued through the use of futures contracts, which obligated the buyer to purchase.    Tulip prices were driven up to dizzying heights.  The high prices attracted speculators, who drove the price even higher, creating a speculative bubble.  At the peak of the bubble, tulip contracts could cost as much as a house, and the bulb of one rare variant, the Viceroy, is reported to have “cost between 3000 and 4200 florins depending on size. A skilled craftsman at the time earned about 300 florins a year.”[4]  Eventually the prices plunged, ruining many investors who found that there was no longer a market for tulips.  “Some were left holding contracts to purchase tulips at prices now ten times greater than those on the open market, while others found themselves in possession of bulbs now worth a fraction of the price they had paid.”

In 1637 the Dutch Parliament “announced that all futures contracts written after November 30, 1636 and before the re-opening of the cash market in the early Spring, were to be interpreted as option contracts.” (2) This meant that the futures buyers were no longer obligated to buy tulips if they didn’t wish to.  Instead, they could get out of the contract by simply compensating “the sellers with a small fixed percentage of the contract price”, which worked out to about 1/30th of the contract price.  This action transformed futures contracts on tulips into call options on tulips. Of course, this only increased speculation as the potential profit was virtually unlimited, while the downside risk was limited to the premium paid.  What should the fair price for a tulip or olive option be? The answer to this question was found hundreds of years after the Dutch tulip mania, and derivatives pricing continues to be an active field of research today.

A derivative is a financial claim whose value is derived from the value of an underlying asset or contract.  A gold futures contract is a derivative that depends on the underlying value of gold while an option on a Eurodollar Futures contract depends on the value of the underlying Eurodollar Futures contract.  Derivatives are also referred to as contingent claims.  Derivatives range from a simple forward contract to highly complex options that depend on the price history of the underlying asset.  Derivatives can be purchased on exchanges or custom-tailored to the parties needs as OTC transactions.  Derivatives exist to enable market participants to transfer risk, to take a position or to exploit mispricing in a market.  There are three major classes of market participants:  hedgers, speculators and arbitrageurs. Market participants wishing to transfer risk are called hedgers.  They generally do not take a view on markets.  Those participants taking a view in the market are called speculators.  The third category, arbitrageurs, exploits profit opportunities that may arise from a variety of reasons.  Derivatives play a vital and crucial role in capital markets.[5]

A derivative on an underlying asset, for example a stock or a stock index, is known as an option.  Options are traded on Eurodollar futures contracts, commodities, foreign exchange rates, interest rates and so on.  Options are similar in some ways to forwards and futures but significantly different in others.  In contrast to futures and forwards, it costs money upfront to buy an option.  This cost is called the option premium. The buyer of the option has the right but not the obligation to exercise the option while the seller of the option is obligated to perform. This is unlike the forward contract where, once entered, both parties are obligated to deliver.

Options are traded on most major exchanges.  They are used for hedging purposes, for speculation and by arbitrageurs.  A speculator is an investor who wishes to take a position on a particular asset without actually owning the asset.  Since options on an underlying can be purchased at a fraction of the cost it would take to acquire a long position in the underlying, options provide leverage.  Leverage magnifies the returns, both positive and negative, which is the reason that some people say that options are very risky.  Options range from the very simple, “plain vanilla” flavors such as simple puts and calls on a stock, to the very exotic such as binary options, barrier options, Asian options, compound options and so forth.  The value of such exotic options depends not just on the value of the underlying at expiry, but on the price path over the entire time period.  There are options on currencies, options on interest rates, options on futures, options on swaps and even options on options.

In contrast, with options a price or level (the strike) is specified in advance along with an expiration time.  In order to model the behavior of the option, we require a model governing the dynamics of the underlying asset.  The model for the movement of the underlying asset is fairly complicated and is known as the Black-Scholes partial differential equation.  The model, with modifications, can be applied to interest rates, stock indices, FX contracts and certain other options as well. Before we can address the Black Scholes equation, however, we should start with the building blocks which were established by Bachelier.

Bachelier In 1900, a French doctoral student named Bachelier defended his thesis, “Théorie de la Spéculation.”  His dissertation is lauded as the beginning of financial economics, and many important results were developed in this paper.  Bachelier was thought to have had some experience with to the French stock market while working there prior to earning his doctorate.  In the course of his studies he studied subjects including probability and heat transfer.  His dissertation covered the movements of stocks from a probabilistic point of view. “La détermination de ces mouvements se subordonne à un nombre infini de facteurs: il est dès lors impossible d’en espérer la prévision mathématique… Mais il est possible d’étudier matheématiquement l’état statique du marché à un instant donné, c’est-à-dire d’établir la loi de probabilité des variations de cours qu’admet à cet instant le marché.  Si le marché, en effect, ne prévoit pas les mouvements, il les considére comme étant plus ou moins probables, et cette probabilité peut s’évaluer mathématiquement.[6]  He modeled the fluctuation of stock prices with a random walk process, which he was familiar with from his study of thermal sciences.  He hypothesized that over a short time interval, price fluctuations should be independent of the current value, also, that the price fluctuations were independent of the past values. With the goal of valuing options, he described the distribution of the resulting stock prices, and solved for the probability that the price would exceed or fall below a certain level. Bachelier even included diagrams of call option payoffs in his dissertation, as shown below.

Bachelier assumed that stock prices followed a normal distribution and made the argument that in equilibrium, there would be as many buyers believing that the price would rise as there were sellers believing that the price would fall, and given this, the probability that the stock would move up must be about the same probability that the stock would move down.  As such, market participants would expect to make zero profit, and the market was a “fair game.” This is the foundation of what is known today as a martingale.  By applying the memorylessness property of the stock price process, he also developed what is known today as the homogeneous Chapman-Kolmogorov equation.  Bachelier assumed that the process followed by the stock was given by

$S_t = S_0 + \sigma W_t$

where sigma represented the volatility of the stock price.  He also predicted that the volatility would increase accordingly with the square root of time, an important concept still used today.  Bachelier “normalized” his volatility by defining the quantity H (which he referred to as “the nervousness” of the underlying stock price S[1]) as

$H = {\sigma \over{\sqrt{2 \pi}}}$

With this definition, the price of a call option under his model included the factor

$H \sqrt{T}$

Assuming Brownian motion, his formula for the valuation of a call option was based on the Fourier equation of transient one-dimensional heat transfer,

His equation for valuation of a call was:

where N' denotes the probability density function of the normal distribution,

Bachelier’s pioneering work formed the foundation for the important Ito calculus that would follow years later as well as the work of Fischer Black and Myron Scholes.  Other authors criticized his assumption of the normal distribution, which permitted negative asset prices, and the fact that he assumed zero interest rates (no time value of money, which implies zero risk aversion.)  These assumptions did not prevent option prices from exceeding the price of the underlying asset, which was problematic as the underlying asset price is an upper bound for the option.  In 1964 a researched named Case Sprenkle extended Bachelier’s ideas by assuming that stock prices following a log normal distribution.   This corrected the problem of potentially negative prices.  Sprenkle also included a drift in Bachelier’s random walk and allowed for risk aversion. His resulting formulation of the call price was[4]

Sprenkle described Z as a discount factor dependent on the risk of the stock, and r as
“the ratio of the expected value of the stock price at the time the warrant matures to the current stock price”, and “he tries to estimate the values … empirically, but finds that he is unable to do so.”[1]  Many of the derivations preceding Black Scholes shared the concept that if one knew the terminal probability distribution, the option could easily be valued by discounting at the appropriate rate.  However, the appropriate discount rate to use was not clear.

Black and Scholes  In 1958 and 1961, Modigliani and Miller (“M & M”) published their famed propositions related to the value of a firm.  The underlying accounting identity was that the value of a firm’s assets A was comprised of the sum of the value of the firm’s liabilities L and the shareholder’s equity E.  In valuing the equity, M&M noted that equity holders essentially own a call option on the assets of the firm:  if the value of the firm assets exceeded the value of the liabilities, the equity holders were entitled to the residual, however, if the firm value was below the value of the firm’s liabilities, the shareholders would be wiped out.

Thus, E = (A-L,0)+.   There were many open questions regarding not just the valuation of corporate liabilities, which was difficult due to the non-observable default risk, but in the proper value of shareholder’s equity.  Many researchers tackled the problem, including Edward Thorpe, Case Sprenkle, Jack Treynor and Fischer Black and Myron Scholes.

In their celebrated 1973 paper, “The Pricing of Options and Corporate Liabilities”, Black and Scholes noted that Sprenkle’s (among other contributors) valuation formula was incomplete due to the presence of the arbitrary parameters Z and r.  Black and Scholes recognized that the option price was related to the price of the underlying stock, noting that the volatility of the option would in general not be a constant but would depend jointly on the stock price and time to maturity. They extended the hedging previous work of Thorpe and Kassouf and constructed an equilibrium hedge in which the expected return on the hedged position had to be equal to the return on a risk free asset.  They used an arbitrage argument in the derivation.

The Black-Scholes Equation

Many models of asset behavior assume that the asset follows some form of random walk.  The Wiener process is often used to model this behavior.  It supposes that the asset price behaves something like a particle that is impacted by a number of small shocks.  In physics this behavior is referred to as Brownian motion.  Modeling the percentage change in stock price over a small period of time, the process is given as:

to be continued....

Footnotes

[1] “Thales of Miletus – A Compendium of Articles”, http://www.martinfrost.ws/htmlfiles/thales1.html, quoting Aristotle on Thales, also http://www.optiontradingpedia.com/history_of_options_trading.htm

[4] http://en.wikipedia.org/wiki/Tulip_mania

[5] Jennifer Voitle, “Quantitative Finance Interview Questions”, chapter 5

[6]http://archive.numdam.org/ARCHIVE/ASENS/ASENS_1900_3_17_/ASENS_1900_3_17__21_0/ASENS_1900_3_17__21_0.pdf, translated as “The determination of these movements is subordinated to an infinite number of factors: it is therefore impossible to expect the mathematical prediction ... But it is possible to study mathematically the static state of the market at a given moment, that is to establish the probability of fluctuations admits at this point the market. If the market, in effect, does not provide the movement, he sees them as more or less likely, and this probability can be evaluated mathematically”, google translator

[8] Charles Smithson, “Wonderful Life”, Class Notes, Risk Magazine

[9] F. Black and M. Scholes, “The Pricing of Options and Corporate Liabilities”, 1973

[10] Fischer Black later stated (1988) that, “A key part of the option paper I wrote with Myron Scholes was the arbitrage argument for deriving the formula. Bob [Robert Merton] gave us that argument. It should probably be called the Black-Merton-Scholes paper.''

[11] Peter Carr “A Practitioner’s Guide to Mathematical Finance”, http://www.pstat.ucsb.edu/crfms/inaugural%20slide/Peter-Carr.pdf

[12] Note that Cox and Ross use the symbol S for the asset price, rather than x as Black and Scholes used.

[13] MARK FISHER AND CHRISTIAN GILLES, “AN ANALYSIS OF THE DOUBLING STRATEGY: THE COUNTABLE CASE”, http://www.markfisher.net/~mefisher/papers/countable_doubling_strategy.pdf

References

1. J. Michael Harrison and David M. Kreps, “Martingales and Arbitrage in Multiperiod Securities Markets”,
2. Black, Fischer and Myron Scholes, The Pricing of Options and Corporate Liabilities, Journal of Political Economy, 81 (May-June 1973), 637-659
3. Cox, John C and Stephen A Ross, The Valuation of Options for Alternative Stochastic Processes, Journal of Financial Economics, 3 (January-March 1976), 145-166
4. Modigliani, Franco, and Merton H. Miller,"The Cost of Capital, Corporation Finance and the Theory of Investment," American Economic Review, ]une 1958, 48, No. 3, pp. 261-297
5.  “A PRIMER IN FINANCIAL ECONOMICS”, By S. F. Whelan, D. C. Bowie and A. J. Hibbert, http://www.soa.org/files/pdf/prime.pdf
6. “In Honor of the Nobel Laureates: Robert C. Merton and Myron S.Scholes: A Partial Differential Equation That Changed the World”, Robert A. Jarrow  http://pubs.aeaweb.org/doi/pdfplus/10.1257/jep.13.4.229 Journal of Economic Perspectives—Volume 13, Number 4—Fall 1999—Pages 229–248
7. Mark Rubenstein, A History of The Theory of Investments

### GameStonk! The wild rollercoaster of GameStop’s stock

Apr 02, 2021 in GameStop

This page provides resources for my new GameStop book. This book details the epic rollercoaster ride when Main Street took on Wall Street in GameStop’s stock. The colorful cast of characters includes hedge funds, the Robinhood CEO, celebrities (including Elon Musk), reddit’s wallstreetbets traders, the deep value investor Roaring Kitty who first provided this trade idea, market makers and more. The stock price changes that occurred in January 2021 gave rise to assertions of market manipulation and resulted in congressional hearings, which are still ongoing. You can find the book on Amazon. It is available for pre-order with planned release data June 15, 2021.

Congressional Hearing February 18 2021

Game Stopped? Who Wins and Loses When Short Sellers, Social Media, and Retail Investors Collide

Analysis

Three Takeaways From Congress’s GameStop (GME) Hearing | Nasdaq

Hedge fund chiefs to testify before Congress on GameStop saga | Financial Times (ft.com)

GameStop hearing: CEOs of Robinhood, Citadel, Reddit, Melvin Capital testify before House Financial Services Committee – The Washington Post

TIMELINE-The GameStop battle: how it unfolded for the key players testifying | Nasdaq

Congress hears testimony again on GameStop, focusing on the financial plumbing behind the frenzy. – The New York Times (nytimes.com)

### Black Scholes Option Pricing with Excel VBA

Apr 02, 2021 in Excel VBA

In this example, we will learn to price call and put options on GameStop (though you can use any stock you like) using the famed Black-Scholes option pricing equation. I will also show you how to use an online tool to check your work. This post assumes that you already know the Black-Scholes equation and what a call and put are. If you want a refresher, I will add a new post on this.

Pricing Options on GME

The options prices expiring March 12, 2021 as of market close on March 5, 2021 are shown below (source: Power E*Trade). With the price of the underlying S = $137.74, a call option with a strike K of$135 is in the money, so has an intrinsic value of  = 2.74.  Since there are seven days to expiry, there is time value (theta) as well. Since interest rates are very low, the driver of the option premium in this case is volatility.  The higher the volatility, the greater the chance the stock has to rise over the time period until option expiry.  For this strike price, we see an implied volatility of 255.07%.

The implied volatility is derived from options prices, which are set by supply and demand.   Given the implied volatility, strike price, underlying price, interest rates and time to expiry, we can use Black-Scholes to compute the call (and put) prices.  Alternatively, given the call (or put) price, the time to expiry, interest rates, underlying price and the strike, we can use Black-Scholes to calculate the implied volatility. Let’s do both.

Using Black-Scholes (see post on Black-Scholes for technical details), the price of a call depends on the underlying, strike, time to expiry and risk free rate. The formula for the call price is :

where N() is the cumulative normal distribution for a standardized random variable, T is the expiry date, t = the evaluation date,  is the annualized volatility,  is the annualized interest rate and  d1 and d2 are given below.

The price of a put p can be derived from Put-Call Parity relationship. This relationship is based on no-arbitrage conditions. Here, p is given by the relationship between the present value of the strike, the underlying stock and the call.

The Black-Scholes price of a put option is then derived as:

This should be enough to get started building a model in Excel. Start a new workbook and save as type .xlsm. We will price a March 12, 2021 $135 Call as of March 5, 2021. The underlying stock price is 137.44, so the call option (which has an intrinsic value of max(S-K,0)) is out of the money. There is a week to expiry, so the option price reflects time value only. The bid/ask for the March 21$135 call are 18.35 and 21.15 with the last price 20.1, the implied volatility is 255.07% and the delta is 0.5873.

Create a worksheet like the following in your workbook with the inputs from market data as shown.

The interest rate should be the risk free rate for the same expiry time (one week). (As a tip, if you use the online tool at
The Options Industry Council (OIC) – Optionscalculator (optionseducation.org) and enter the stock ticker, you can retrieve the interest rate and volatility, though only for the current date.) Let’s check the prices using the online OIC calculator to have a reference for our model.

To build this in Excel, we will have to replicate the call and put price formulas above. Insert a new code module using the Developer tab, and start a function as shown:

Function BlackScholesPrice(S, K, sigma, r, d, t As Date, Texp As Date, strategy As String, Optional strReturn As String) As Variant

We will pass the arguments Stock price S, Strike Price K, interest rate r,
dividend yield d, calculation date as date, expiry date as date, strategy (call or put) as string, and an optional argument to return an array of option greeks (delta, gamma, theta, vega and rho.)

Next, add the following code:

‘Example usage: BlackScholesPrice(137.74,135,255.07,.085,.0, 3/12/2021,3/5/2021,”call”,”all”)
‘array enter input cells to get Price, Delta, Gamma, Theta, Vega and Rho in that order
‘note: must use power function to exponentiate for 64bit Excel, or x ^ y with spaces surrounding ^ or it will break.
Dim dblPi As Double
dblPi = WorksheetFunction.Pi()
Dim myArr As Variant
Dim BSArray(5) ‘returns array Price, Delta, Gamma, Theta, Vega and Rho in that order
numdays = numdaysinyear(Year(t)) ‘account for leap years at analysis date (caveat: may be different from actual transaction date)
deltat = (Texp – t) / numdays

d1 = (Log(S / K) + (r – d + 0.5 * Application.WorksheetFunction.Power(sigma, 2)) * deltat) / (sigma * Sqr(deltat))
d2 = d1 – sigma * Sqr(deltat)
Nd1 = WorksheetFunction.NormSDist(d1)
Nd2 = WorksheetFunction.NormSDist(d2)
NPrimed1 = Exp(-Application.WorksheetFunction.Power(d1, 2) / 2) / Sqr(2 * dblPi)
NPrimed2 = Exp(-Application.WorksheetFunction.Power(d2, 2) / 2) / Sqr(2 * dblPi)

Since the user might type Call or Put instead of call or put as the strategy, take the lowercase of the input and return just “c” or “p”. Then define vega and gamma which are independent of the option type (call or put).

strStrategy = Left(LCase(strategy), 1)
BS_vega = S / 100 * Exp(-d * thetat) * Sqr(deltat) / Sqr(2 * dblPi) * Exp(-Application.WorksheetFunction.Power(d1, 2) / 2)
BS_Gamma = Exp(-d * deltat) / (S * sigma * Sqr(deltat)) / Sqr(2 * dblPi) * Exp(-Application.WorksheetFunction.Power(d1, 2) / 2)

Now, we will work with the strategy (c or p) to compute the prices and remaining greeks using Select Case.

Select Case strStrategy
Case “c”:

BSArray(0) = S * Exp(-d * deltat) * Nd1 – K * Exp(-r * deltat) * Nd2 ‘Call Price
Debug.Print “BSArray(0) = “; BSArray(0)
BSArray(1) = Exp(-d * deltat) * Nd1 ‘Delta
BSArray(2) = BS_Gamma
‘Theta
BSArray(3) = -S * sigma * Exp(-d * deltat) * NPrimed1 / (2 * Sqr(deltat)) – r * K * Exp(-r * deltat) * Nd2 + d * S * Exp(-d * deltat) * Nd1
BSArray(3) = BSArray(3) / numdays ‘theta
BSArray(4) = BS_vega
BSArray(5) = K * deltat * Exp(-r * deltat) * Nd2 / 100 ‘rho
Case “p”:
BSArray(0) = K * Exp(-r * deltat) * (1 – Nd2) – S * Exp(-d * deltat) * (1 – Nd1)
BSArray(1) = Exp(-d * deltat) * (Nd1 – 1) ‘put delta
BSArray(2) = BS_Gamma
BSArray(3) = -S * sigma * Exp(-d * deltat) * NPrimed1 / (2 * Sqr(deltat)) + r * K * Exp(-r * deltat) * (1 – Nd2) – d * S * Exp(-d * deltat) * (1 – Nd1)
BSArray(3) = BSArray(3) / numdays ‘theta
BSArray(4) = BS_vega
BSArray(5) = -K * deltat * Exp(-r * deltat) * (1 – Nd2) / 100 ‘put rho
Case Else:
End Select

If strReturn = “” Then
myArr = BSArray(0)
BlackScholesPrice = myArr
Else
BlackScholesPrice = BSArray
End If

End Function

Usage: in your spreadsheet, select a blank cell and type =
=BlackScholesPrice(137.74, 135, 255.07%, 0.01%, 0%, “3/5/2021”, “3/12/2021”, “call”)

You should get the value \$20.518. You can just enter this in your spreadsheet for both the call and the put as follows

To show the greeks, you can array-enter the formula. Edit the spreadsheet, typing the headings across the worksheet as shown, then array enter in cells B13:H13 for the call and B14:H14 for the put. I’m showing the formula in B13 for reference.

We can also plot the results by using a table. The implied volatility can be inferred from either the call or put option price using Excel’s Solver (more on this in a later post) or downloaded from a market data provider. The moneyness in column B is just the stock price from column A divided by the strike of 135, and I’ve used named ranges for several inputs.
We can see how the prices are affected by the amount of moneyness by creating a chart. The call price increases as the stock price

That’s it for now! Hopefully this has helped explore how to start building option pricers in Excel VBA. You can try to expand the code to include straddles and other options.

### Use Python to Get Stock Information

Apr 02, 2021 in Python

Here’s how to use Python to get market data for a stock you are interested in. I’m using GameStop here, but you can change the ticker to whatever you are interested in.  The following code is running in a notebook using Google Colab though you can use any Python interface you like. This code can be part of a stock dashboard including twitter and reddit scraping, which will be covered in another post, or you can just run the notebook on it’s own.

Step 1:  Import the packages needed for data and plotting.  The market data will come from a yahoo finance package.  Note that Yahoo Finance used to provide an API to download market data, but it has been disabled since around 2017.  You can now use the yfinance and yahoofinancials packages.  Since I’m using google colab, I have to pip install the packages I will use, but it should only be necessary to do this once.

!pip install yfinance
!pip install plotly
!pip install yahoofinancials

Step 2: Import and create aliases for the packages we will use.
import pandas as pd
import yfinance as yf
from yahoofinancials import YahooFinancials
import plotly.graph_objects as go

Step 3:  Create a dataframe for your preferred stock using it’s ticker.

Step 4:  Take a look at the dataframe to be sure it’s what we want

GME_df

Step 5: Let’s get some basic information on the stock, such as corporate actions, dividends, splits and so on.
GME= yf.Ticker(“GME”)
# show actions (dividends, splits)
GME.actions
# show dividends
GME.dividends
# show splits
GME.splits

Results:

Date 2007-03-19 2.0 Name: Stock Splits, dtype: float64

Now get forward PE ratio, market cap and volume:

#forward PE Ratio
print(“Forward P/E: “,GME.info[‘forwardPE’])
#Market Cap
print(“Market Cap: “,GME.info[“marketCap”])
#Volume
print(“Volume: “,GME.info[“volume”])

Results:
Forward P/E: -580.1515
Market Cap: 13389208576
Volume: 9215048

Step 6: Return historical data.  Note that you can specify starting and ending dates, as well as the interval.  Here I’m interested in January 1 through January 26, 2021, but you can also specify weekly over the entire history, daily and so on.

#GME.history(period=”max”, interval=”1wk”)
GME_historical = GME.history(start=”2021-01-21″, end=”2021-01-26″, interval=”1m”)
GME_historical

Step 7: get option chain calls data for specific expiration date

opt = GME.option_chain(date=’2021-02-12′)

result:

GME Options Chain

Step 8: Return information about the company
GME.info

‘market’: ‘us_market’, ‘marketCap’: 22667776000, ‘maxAge’: 1, ‘maxSupply’: None, ‘messageBoardId’: ‘finmb_1342560’, ‘morningStarOverallRating’: None, ‘morningStarRiskRating’: None, ‘mostRecentQuarter’: 1604102400, ‘navPrice’: None, ‘netIncomeToCommon’: -270000000, ‘nextFiscalYearEnd’: 1643673600, ‘open’: 379.71, ‘openInterest’: None, ‘payoutRatio’: 0, ‘pegRatio’: 0.18, ‘phone’: ‘817 424 2000’, ‘previousClose’: 193.6, ‘priceHint’: 2, ‘priceToBook’: 63.78803, ‘priceToSalesTrailing12Months’: 4.3914475, ‘profitMargins’: -0.053239997, ‘quoteType’: ‘EQUITY’, ‘regularMarketDayHigh’: 413.98, ‘regularMarketDayLow’: 250, ‘regularMarketOpen’: 379.71, ‘regularMarketPreviousClose’: 193.6, ‘regularMarketPrice’: 379.71, ‘regularMarketVolume’: 50397132, ‘revenueQuarterlyGrowth’: None, ‘sector’: ‘Consumer Cyclical’, ‘sharesOutstanding’: 69747000, ‘sharesPercentSharesOut’: 0.8858, ‘sharesShort’: 61782730, ‘sharesShortPreviousMonthDate’: 1607990400, ‘sharesShortPriorMonth’: 68127116, ‘shortName’: ‘GameStop Corporation’, ‘shortPercentOfFloat’: 2.2642, ‘shortRatio’: 2.81, ‘startDate’: None, ‘state’: ‘TX’, ‘strikePrice’: None, ‘symbol’: ‘GME’, ‘threeYearAverageReturn’: None, ‘toCurrency’: None, ‘totalAssets’: None, ‘tradeable’: False, ‘trailingAnnualDividendRate’: 0, ‘trailingAnnualDividendYield’: 0, ‘trailingEps’: -4.224, ‘twoHundredDayAverage’: 19.636906, ‘volume’: 50397132, ‘volume24Hr’: None, ‘volumeAllCurrencies’: None, ‘website’: ‘http://www.gamestop.com‘, ‘yield’: None, ‘ytdReturn’: None, ‘zip’: ‘76051’}

Step 9: Get Analyst Recommendations
GME.recommendations

Analyst Recommendations for GME

Step 10:  You can get the earnings calendar with

GME.calendar

Step 11: Chart the stock price using Open, High, Low and Close.  First, we create a pandas dataframe:
df = GME.history(period=”max”)
df

Step 12: Some data manipulation is necessary before we plot.  Note the field names Open, High, Low, Close which are referenced in the loop below.
#Reseting the index
df = df.reset_index()
#Converting the datatype to float
for i in [‘Open’, ‘High’, ‘Close’, ‘Low’]:
df[i] = df[i].astype(‘float64’)

Step 13: Plot the results using plotly’s graphics objects library go.  This will provide a slider so you can home in on a time period of interest.  Here I show the full time series, then the January 2021 performance.

fig = go.Figure([go.Scatter(x=df[‘Date’], y=df[‘High’])])
fig.update_xaxes(
rangeslider_visible=True,
rangeselector=dict(
buttons=list([
dict(count=1, label=”1m”, step=”month”,
stepmode=”backward”),
dict(count=6, label=”6m”, step=”month”,
stepmode=”backward”),
dict(count=1, label=”YTD”, step=”year”,
stepmode=”todate”),
dict(count=1, label=”1y”, step=”year”,
stepmode=”backward”),
dict(step=”all”)
])
)
)
fig.show()

GME Full History

GME Stock Price January 2021

Hopefully this will get you started, there is a lot more you can do with these tools.