Question
This is MATLAB This Cody problem serves as an introduction to Application Programming Interfaces (API's). These interfaces act as powerful tools to bridge applications to
This is MATLAB
This Cody problem serves as an introduction to Application Programming Interfaces (API's). These interfaces act as powerful tools to bridge applications to data sources such as a database. Please read the "What is an API?" discussion forum post on Edge if you have not already.
You are to write a function that returns the stock data to the user in a cell array, given some stock symbol input such as "AAPL." This function may be something a future employer would ask you to write if you are working on an analytical platform for stocks. You will be utilizing an Application Program Interface (API) from Markit to retrieve this data using the built-in function "webread." Webread makes an HTTP GET request to Markit given a URL endpoint and a key-value or multiple key-value pairs (kv).
The actual coding involved in this programming assignment is minimal and is meant to serve primarily as an introduction to some breadth topics you may find yourself using in the future.
Assign the following fields from the API response into a cell array. Your cell array should contain the following data (in order as below):
Stock Name, Stock Symbol, Last Price, % Change, and Time Stamp
guideline:
function data = stock_check(symbol) % Help: stock_check('AAPL') returns relevant stock data about Apple.
% Markit Quote Endpoint endpoint = 'http://dev.markitondemand.com/MODApis/Api/v2/Quote/json';
% Webread makes an HTTP GET request to Markit's Quote endpoint. % webread(endpoint, key, value)
% The request parameter for this API call is just the symbol, these % are in the form of 'key-value' pairs. Here the key is 'symbol' and the value % is a stock symbol (i.e. AAPL).
resp = webread(endpoint, 'symbol', symbol);
% Run this code in MATLAB to determine the output of the API. It should % return a data structure you are familiar with. Using the data structure, % figure out how to extract the status, name, sign, stock price, percent change, and time stamp.
% Begin your code here:
data =
end
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started