• Like
Using Financial Market Data APIs in Microsoft Excel
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Using Financial Market Data APIs in Microsoft Excel


Provides practical advice and multiple methods on how to pull and manipulate financial data in Microsoft Excel from financial market data APIs.

Provides practical advice and multiple methods on how to pull and manipulate financial data in Microsoft Excel from financial market data APIs.

Published in Data & Analytics
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. USING FINANCIAL MARKET DATA APIS IN EXCEL Stephane DuboisCEO & Founder, xignitesdubois@xignite.com@sdubois
  • 2. AGENDA •Excel and APIs: A Little History •From Basic toCool: Options for Pulling Data Into Excel •Opening a CSVor XMLAPI URL •Using Data From Web •Using WebService() Open a CSVor XML API URL Use Data From Web Use WebService() Audience If you have no clue on how to pull data from APIs via Excel, this presentation is for your. But even if you are an advanced user, you may learn a thing or two.
  • 3. •With 1 billioncopies sold, Excel is arguably the most successful business tool in history. •More of our economy runs on Excel than we would dare to admit.  •Yes it’s not cloud. And yes it’s not shared. But it’s quite flexible. •It used to be based on 100% manual data entry but with API support, it is no longer the case. •Excel added APIs in three steps: •XML support started with 2003 •Data From Web was added in 2007 •WebService() was added in 2013 EXCEL AND APIS: A LITTLE HISTORY 1985First Spreadsheet with a GUI 1987First Windows version 1990Added Toolbar, Drawing, Charts… 1992Better Mouse, Filling and Shortcuts 1993Multi-Sheet Workbooks, VBA 199532 Bit. Faster and more Stable. 1997Assistant, Validations and New VBA 1999Improved Clipboard and Self-Repair 2001Formula Auditing, Crash Recovery 2003XMLand List Ranges 2007Ribbon Menu and xlsx 2010Conditional format, Sparklines, etc. 2013PowerView, Flashfill and more Added XML Support Added Data From Web Added WebService()
  • 4. OPEN A CSVFILE •This is the most basic way to get data in Excel. •This is akin to opening a regular CSV file. •It’s kinda lame really. •Excel opens CSVfiles natively. •Most APIs support a CSVoutput*. •All you need to do is open the URL in Excel and your are done. •This works best for APIs that are time series like historical data or large files like master data sets. * If they don’t, well it probably means they suck. Did You Know? Comma-Separated Values is a data format that pre-dates personal computers by more than a decade: the IBM Fortran compiler under OS/360 supported them in 1967. List-directed ("free form") input/output was defined in FORTRAN 77 (the 77 means 1977). List-directed input used commas and/or spaces for delimiters, so unquoted character strings could not contain commas or spaces. Wikipedia
  • 5. •Let’s use Xignite’s Global Historical Equity service as an example. https://www.xignite.com/product/ XigniteGlobalHistorical/api/ GetGlobalHistoricalQuotesRange/ •And let’s pull a year of adjusted stock prices for GOOG by entering the right criteria. •Then click the CSVtab option •Check Download File •And click on the colorful URL •Your browser will download the file for you automatically. OPEN A CSVAPI URL WITH XIGNITE APIS
  • 6. •You then click on the download link to open the file. •You can delete the columns of data you don’t want and otherwise manipulatethe dataas you wish. •But there are a lot of things you cannot dowith this approach: •You can’t refresh the data automatically •You can’t mix data from one API with data from another API. •You can’t format the data set and then update it. •In short, this is pretty lame. OPEN A CSVAPI URL WITH XIGNITE APIS
  • 7. OPEN AN XMLAPI URL •You can kick things up a notch by pulling the data in XML. •There are twogreat advantages of doing so: This means you get built-in formatting, filteringand sorting. The data comes up as an Excel Table. You can refresh it automatically from within Excel and if the source data changed, so will yours. The data is automagically bound to the API.
  • 8. •Let’s see how we can do this with an Xignite API. •This time we will use an API that updates continuously, intraday bar datawhich you can find here: http://www.xignite.com/product/ global-stock-quote-data/api/GetBars/ •We will pull and update intra-day bars as they become available. •Start by copying the URL of the call*. OPEN AN XMLAPI URL WITH XIGNITE APIS * You also need to append your authentication token to the URL in the form of &_token=<yourtoken>.
  • 9. •Then you can use that API URL and call it from Excel: •To open the API from Excel you need to: •Click the File Open menu options. •Click Other Web Locations andBrowse. •Paste the fully qualified REST URL of your API call in the File Name field. •Click Open. •Before opening the file, Excel will throw this little pop-up box at you. •Choose As an XML table(which is the default) •Click OK. OPEN AN XMLAPI URL WITH XIGNITE APIS
  • 10. •What you get here is quite a bit more interesting than the CSV file. •The data comes up as a Table. •This means you get built-in formatting, filteringand sortingand all kinds of other goodies. •You can also easily deletethe columns you don’t want and renamethose you want to keep. •But the best part is that the data is automatically bound to the API. •You can refresh it automatically. •Just right click on a cell on the table and chose XMLand Refresh XML Data. •You can even drag and drop the columns you want using XML Source. OPEN AN XMLAPI URL WITH XIGNITE APIS
  • 11. •Warning: Code Alert! If coding gives you jitters, skip to the next page! •And if you care to make this more interestingand are not afraid of a little VBA*, 3lines of code will suffice to let you dynamicallychange the parameters of your API and refresh the data: •Simply create input fields on your worksheet and use them to re-build the URL of your API. For instance, here we are just changing the Symbol. •Add those 2 lines of code** to link your table to the new URL and refresh it. •So you can pick any symbol, click the button and pull the data for that symbol. OPEN AN XMLAPI URL WITH XIGNITE APIS * Here we assume you know what VBA is, how to pop the developer tab, insert a button, and edit a macro. ** Note that you get the name of your table by right-clicking the table and clicking XMLand XML Map Properties
  • 12. •So using XML is quite cool. But there are limitations. Merely that since you are opening a single URL, you can only integrate data from one source. •What if you wanted to mix and match things on a worksheet? •This is where Data From Web comes in. •Data From Webworks just like opening an XML API but you can do it as many times as you want in a spreadsheet. •First Click From Web on the Datamenu. •Enter the complete URL of your API request (with authentication) in the Addressfield. •Click Import. USING DATA FROM WEB
  • 13. •By doing Data From Web multiple times, deleting the columns you do not want, and formatting the results, you can create some cool spreadsheets. •For example the worksheet on the right pulls data from our News, Economic Calendar, Earnings Calendar and IPO Calendar APIsand combines them in a single page. •It took about 10 minutes to build it. And it updates dynamically. •To learn more about our available APIs, check here: https://www.xignite.com/Products/ USING DATA FROM WEBWITH XIGNITE
  • 14. •So now let’s take it home. •Most people don’t know that Excel has a WebService()function*. •It’s quite a powerfullittle tool. •It simply pulls the results of an API call in a cell. •It takes the URLof the RESTcall as its only input parameter. •It throws the whole result in the cell so if the output is XML or JSON, it’s actually not so cool: •This is an XML call result. •This is a JSON call result. •Not much you can do with that! •So you need to get smart using it. USING WEBSERVICE()
  • 15. •One way you can get smart using WebService() is by using it with another powerful function: FilterXML() •FilterXML() lets you call an XML API returning many different fields, filter the field you want and throw it into a cell. •In this case we will call our real-time Forex API which you can find here: https://www.xignite.com/forex •The API returns many fields like Bid, Mid and Ask. •Here, we can pull the EURUSD Mid quote only by: •Calling WebService() and passing the URL of the API •Filtering the result by adding “//Bid”as a filter. •The result is simply thrown into a cell. •And it recalculates as the sheet recalculates! USING WEBSERVICE() WITH XIGNITE APIS
  • 16. •But Xignite APIs make things even simpler! •You can call any of our APIs using the WebService() function directly. •All you need to do is pass the proper API URL and you can return a single value in a single cell. •We call this XigniteOne: One Function, One Cell,One Parameter,One Value. •Here is an example of such an API call. It works the same for all our APIs: USING WEBSERVICE() WITH XIGNITE APIS http://globalquotes.xignite.com/xGlobalQuotes.csv/GetGlobalDelayedQuote? IdentifierType=Symbol&Identifier=AAPL&_token=mytoken&_fields=Last&_noheader=y&_notrailer=y Use a CSVExtension The one field you want to get in your cell. These two system parameters. Using this URL with WebService() simply fills out the cell with value!
  • 17. •That’s it! Now you can see that WebService() and Data From Web are incredibly powerful tools that let you truly combine the advantages of cloud APIs with the power of Excel. •Let’s see a couple example of what can be done using those features. •First, look at the screens on the right. The top is Yahoo!Finance. The bottom is Excel on Xignite APIs. Both update real-time. Can you tell the difference? USING WEBSERVICE() WITH XIGNITE APIS
  • 18. •As a final example, the sheet on the right updates and recolors in real-timeas exchange rates for more than 150 countries fluctuate in comparison to the US dollar. •It uses and integrates 6 types of API calls. And it’s all done in Excel using what we showed you and very limited VBA code. •So sharpen your Excel skills and get started! PUTTING IT ALL TOGETHER
  • 19. For additional information click on the links below. APIS Used in this Presentationhttps://www.xignite.com/Products/FULL CATALOGhttps://www.xignite.com/product/XigniteGlobalHistorical/GLOBAL HISTORICAL EQUITY QUOTES APIhttps://www.xignite.com/product/global-stock-quote-data/GLOBAL DELAYED EQUITY QUOTES APIhttps://www.xignite.com/product/forex/REALTIME FOREX QUOTES APIhttps://www.xignite.com/product/gold-metal/REALTIME PRECIOUS METAL PRICING APIhttps://www.xignite.com/product/company-financial-news/GLOBAL NEWS APIhttps://www.xignite.com/product/XigniteCalendar/GLOBAL ECONOMIC CALENDAR APIhttps://www.xignite.com/product/XigniteEarningsCalendar/US EARNINGS CALENDAR APIhttps://www.xignite.com/product/us-stock-IPO-calendar/US IPOs API THANK YOU Questions? Contact Me. Stephane DuboisCEO & Founder, xignitesdubois@xignite.com@sdubois