Skip to content

Commit d2efc72

Browse files
authored
Merge pull request cs50#355 from cs50/finance19
update finance
2 parents 867a611 + d647a0e commit d2efc72

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

_pages/2019/x/psets/8/finance/finance.adoc

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,57 @@ If you're not quite sure what it means to buy and sell stocks (i.e., shares of a
1717

1818
You're about to implement C$50 Finance, a web app via which you can manage portfolios of stocks. Not only will this tool allow you to check real stocks' actual prices and portfolios' values, it will also let you buy (okay, "buy") and sell (okay, "sell") stocks by querying https://iextrading.com/developer/[IEX] for stocks' prices.
1919

20-
Indeed, IEX lets you download stock quotes via their API (application programming interface) using URLs like https://api.iextrading.com/1.0/stock/NFLX/quote. Notice how Netflix's symbol (NFLX) is embedded in this URL; that's how IEX knows whose data to return. If you follow that link, you'll see a reponse in JSON (JavaScript Object Notation) format. It's a bit messy, but notice how, between the curly braces, there's a comma-separated list of key-value pairs, with a colon separating each key from its value.
20+
Indeed, IEX lets you download stock quotes via their API (application programming interface) using URLs like `https://cloud-sse.iexapis.com/stable/stock/nflx/quote?token=API_KEY`. Notice how Netflix's symbol (NFLX) is embedded in this URL; that's how IEX knows whose data to return. That link won't actually return any data because IEX requires you to use an API key (more about that in a bit), but if it did, you'd see a response in JSON (JavaScript Object Notation) format like this:
21+
22+
[source,json]
23+
----
24+
{
25+
"symbol": "NFLX",
26+
"companyName": "Netflix, Inc.",
27+
"primaryExchange": "NASDAQ",
28+
"calculationPrice": "close",
29+
"open": 317.49,
30+
"openTime": 1564752600327,
31+
"close": 318.83,
32+
"closeTime": 1564776000616,
33+
"high": 319.41,
34+
"low": 311.8,
35+
"latestPrice": 318.83,
36+
"latestSource": "Close",
37+
"latestTime": "August 2, 2019",
38+
"latestUpdate": 1564776000616,
39+
"latestVolume": 6232279,
40+
"iexRealtimePrice": null,
41+
"iexRealtimeSize": null,
42+
"iexLastUpdated": null,
43+
"delayedPrice": 318.83,
44+
"delayedPriceTime": 1564776000616,
45+
"extendedPrice": 319.37,
46+
"extendedChange": 0.54,
47+
"extendedChangePercent": 0.00169,
48+
"extendedPriceTime": 1564876784244,
49+
"previousClose": 319.5,
50+
"previousVolume": 6563156,
51+
"change": -0.67,
52+
"changePercent": -0.0021,
53+
"volume": 6232279,
54+
"iexMarketPercent": null,
55+
"iexVolume": null,
56+
"avgTotalVolume": 7998833,
57+
"iexBidPrice": null,
58+
"iexBidSize": null,
59+
"iexAskPrice": null,
60+
"iexAskSize": null,
61+
"marketCap": 139594933050,
62+
"peRatio": 120.77,
63+
"week52High": 386.79,
64+
"week52Low": 231.23,
65+
"ytdChange": 0.18907500000000002,
66+
"lastTradeTime": 1564776000616
67+
}
68+
----
69+
70+
Notice how, between the curly braces, there's a comma-separated list of key-value pairs, with a colon separating each key from its value.
2171

2272
Let's turn our attention now to this problem's distribution code!
2373

0 commit comments

Comments
 (0)