Skip to content

Commit 554c9e6

Browse files
authored
Update finance.adoc
1 parent b146763 commit 554c9e6

File tree

1 file changed

+46
-3
lines changed

1 file changed

+46
-3
lines changed

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

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,54 @@ 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://cloud-sse.iexapis.com/stable/stock/nflx/quote?token=xyz. 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:
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:
2121

22-
[source]
22+
[source,json]
2323
----
24-
{"symbol":"NFLX","companyName":"Netflix, Inc.","primaryExchange":"NASDAQ","calculationPrice":"close","open":317.49,"openTime":1564752600327,"close":318.83,"closeTime":1564776000616,"high":319.41,"low":311.8,"latestPrice":318.83,"latestSource":"Close","latestTime":"August 2, 2019","latestUpdate":1564776000616,"latestVolume":6232279,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":318.83,"delayedPriceTime":1564776000616,"extendedPrice":319.37,"extendedChange":0.54,"extendedChangePercent":0.00169,"extendedPriceTime":1564876784244,"previousClose":319.5,"previousVolume":6563156,"change":-0.67,"changePercent":-0.0021,"volume":6232279,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":7998833,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":139594933050,"peRatio":120.77,"week52High":386.79,"week52Low":231.23,"ytdChange":0.18907500000000002,"lastTradeTime":1564776000616}
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+
}
2568
----
2669

2770
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.

0 commit comments

Comments
 (0)