Day-22-StockPickerChallenge
- Stock Picker Challenge
- Apr 30, 2021
While I am enjoying the tutorials, I am itching to try out my skills on a project without step by step instructions. I could start on some of my own ideas but I know they require core data and some other skills i havenât gotten to yet. So instead I am going to dive into the Stock Picker Challenge this month with the rest of the CodeCrew group.
Basic Requirements for the Challenge:
- Get stock data from an API
- Display a list of stocks, with respective prices and changes in dollar amount.
- Be able to edit the same list of stocks, and have the option to remove and add stocks by ticker symbol.
I am going to aim for this basic requirement and add in a few extra features that I am interested in learning how to do.
Since this challenge starts tomorrow, I want to make sure I can utilize the API properly
The API
Per the recommendation in the challenge, I am goign to use this Stock API
I tried using the apikey=demo and all that this key can do is apparently pull down data for stock ticker symbol AAPL. If you try to do a batch pull or any other symbol you get the following error.
{"Error Message" : "Invalid API KEY. Please retry or visit our documentation to create one FREE https://financialmodelingprep.com/developer/docs"}
The only way to get around this is to sign up for a free account. They donât ask you for a credit card and it gives you 250 requests per day.
Sign up for a free API key here
After I signed up it said you had to verify your email but I never got an email so I signed in through my google account and was able to get to the dashboard they provide which has the api key. Once I had that everything worked as expected for single stock picker symbols. We can test this directly in the web browser and get a couple stocks to populate a json of starter stocks to explore in the App.
https://financialmodelingprep.com/api/v3/quote/GOOG?apikey=myNewShinyAPIKey
Turns out that for batch submissions you need to upgrade for the subscription package. I am not going to be doing this as this is just for fun so we are limited to single tock ticker api requests.
https://financialmodelingprep.com/api/v3/quote/GE,GOOG?apikey=myNewShinyAPIKey
{"Error Message" : "Special Endpoint : this endpoint is only for premium members please visit our subscription page to upgrade your plan at https://financialmodelingprep.com/developer/docs/pricing"}
NOTE: you have to replace myNewShinyAPIKey with the apikey
from your account or it wonât work.
So we now can get one stock at a time.
GE
https://financialmodelingprep.com/api/v3/quote/GE?apikey=myNewShinyAPIKey
[ {
"symbol" : "GE",
"name" : "General Electric Company",
"price" : 13.12000000,
"changesPercentage" : -0.68000000,
"change" : -0.09000000,
"dayLow" : 13.08000000,
"dayHigh" : 13.35000000,
"yearHigh" : 14.42000000,
"yearLow" : 5.48000000,
"marketCap" : 115175759872.00000000,
"priceAvg50" : 13.24200000,
"priceAvg200" : 11.16021700,
"volume" : 48760561,
"avgVolume" : 76976082,
"exchange" : "NYSE",
"open" : 13.16000000,
"previousClose" : 13.21000000,
"eps" : -0.45300000,
"pe" : null,
"earningsAnnouncement" : "2021-04-27T12:30:00.000+0000",
"sharesOutstanding" : 8778640234,
"timestamp" : 1619825257
} ]
AAPL
https://financialmodelingprep.com/api/v3/quote/AAPL?apikey=myNewShinyAPIKey
[ {
"symbol" : "AAPL",
"name" : "Apple Inc.",
"price" : 131.46000000,
"changesPercentage" : -1.51000000,
"change" : -2.02000000,
"dayLow" : 131.06500000,
"dayHigh" : 133.56000000,
"yearHigh" : 145.09000000,
"yearLow" : 71.46250000,
"marketCap" : 2206963859456.00000000,
"priceAvg50" : 127.59143000,
"priceAvg200" : 125.78232000,
"volume" : 105917721,
"avgVolume" : 100930927,
"exchange" : "NASDAQ",
"open" : 131.78000000,
"previousClose" : 133.48000000,
"eps" : 4.44900000,
"pe" : 29.54821600,
"earningsAnnouncement" : "2021-04-28T16:30:00.000+0000",
"sharesOutstanding" : 16788101776,
"timestamp" : 1619825031
} ]
GOOG
https://financialmodelingprep.com/api/v3/quote/GOOG?apikey=myNewShinyAPIKey
[ {
"symbol" : "GOOG",
"name" : "Alphabet Inc.",
"price" : 2410.12000000,
"changesPercentage" : -0.81000000,
"change" : -19.77000000,
"dayLow" : 2402.29000000,
"dayHigh" : 2427.14000000,
"yearHigh" : 2452.37800000,
"yearLow" : 1299.00000000,
"marketCap" : 1602411692032.00000000,
"priceAvg50" : 2187.98320000,
"priceAvg200" : 1915.57230000,
"volume" : 1881168,
"avgVolume" : 1499530,
"exchange" : "NASDAQ",
"open" : 2404.49000000,
"previousClose" : 2429.89000000,
"eps" : 75.04000000,
"pe" : 32.11780500,
"earningsAnnouncement" : null,
"sharesOutstanding" : 664868012,
"timestamp" : 1619825446
} ]
Good luck everyone! I am looking forward to everyoneâs answers to this App Challenge.