SlideShare uma empresa Scribd logo
1 de 15
Fetch Statistics from the
Yahoo Finance and save it
into a Google Sheet
document
About me
• An Engineering Student at the International Institute of
Technology
• Article Writer at CodeProject.com
What is Node.js?
•
•
•
•
•

A powerful platform to let you run JS on the server side
How? Uses Google’s V8 Engine
V8 is built in C
V8 is the fatest JS Engine on the planet
Great way to build modern web apps on both Client and
Server side!
Timeline

July 2011
Nov 2010
Cloud9IDE
launches

Jan 2009
Created Ryan Dahl

2009

April 2010
Heroku launches
node support

2010

July 2010
Yammer adopts
node.js

Nov 2011
Windows Azure
support

LinkedIn adopts
node for mobile
platform
port to Windows

EBay releases API
built on node
Cloud9IDE azure
support

IISNode

2011

Oct 2011 node.js
overtakes Ruby as
most popular
repo on gitHub
Walmart
Launch mobile
site on node.js

Feb 2012
App Harbour
support

2012
Companies support Node.js
•
•
•
•
•
•
•
•

Yahoo!
Microsoft
LinkedIn
Ebay
Fidelizoo
Paypal
CHESS
…
What Can I Do in Node?
•
•
•
•

Anything you want!
Chat servers, Analytics & Crazy fast backends
Socket.io library is a wicked way to build real time apps
Build a social Network! LinkedIn, Dropbox all using Node.js
What Can’t I Do in Node?
• Contradicts previous slide but
 Node.js is not a web framework i.e Sinatra
 Modules for node.js make it into web framework i.e Express
 Node.js is not Multi-threaded
 A single thread to rule them all
Non-Blocking? Blocking? I’m so confused
• By introducing callbacks. Node can move on to
other requests and whenever the callback is
called, node will process is.
• You should read non-blocking code as « put
function and params in queue and fire
callback when you reach the end of the
queue »
• Blocking= return Non-Blocking= no return.
Only callbacks
Fetch Statistics from the Yahoo Finance
• We have to fetch data from the link shown
below:


http://finance.yahoo.com/q/ks?s=LVS

The Company in our example is LVS.
Fetch Statistics from the Yahoo Finance
• You need to install Node.js Of course and it 3 packages:
 npm install request – So we could work with URLs in an easy
way.
 npm install cheerio – jQuery for the server side. This will make
the code 10x shorter.
 npm install edit-google-spreadsheet – to integrate with
Google docs/sheets with 2-3 lines of code.
Fetch Statistics from the Yahoo Finance
•
•
•
•
•

// Some parameters
var ticker = "LVS";
var yUrl = "http://finance.yahoo.com/q/ks?s=" + ticker;
var financeDetails = new Array();
var keyStr = new Array();
Fetch Statistics from the Yahoo Finance
•
•
•
•
•
•
•
•
•

// The main call to fetch the data, parse it and work on
it.
request(yUrl, function (error, response, body) {
if (!error && response.statusCode == 200) {
var $ = cheerio.load(body);
// the keys - We get them from a certain class attribute
var td = $('.yfnc_tablehead1');
$(td).each(function(j, val) {
keyStr[j] = $(val).text();
});
Working with Google Sheet Document
•
•
•
•
•
•
•
•
•
•

// upload our data to Google sheet
Spreadsheet.create({
debug: true,
username: 'TODO-fill',
password: 'TODO-fill',
debug: true,
spreadsheetName: 'TODO-yourSheetName',
worksheetName: 'TODO-Sheet1orAbetterName',
callback: sheetReady
});
Demo
Thank you

hadrichmed@gmail.com

Mais conteúdo relacionado

Mais procurados

Frontrow conf
Frontrow confFrontrow conf
Frontrow conf
zefhemel
 
PHPNW14 - Getting Started With AWS
PHPNW14 - Getting Started With AWSPHPNW14 - Getting Started With AWS
PHPNW14 - Getting Started With AWS
benwaine
 

Mais procurados (15)

Why NodeJS
Why NodeJSWhy NodeJS
Why NodeJS
 
Develop and Run PHP on Windows. Say(Hello); to WordPress on Azure
Develop and Run PHP on Windows. Say(Hello); to WordPress on AzureDevelop and Run PHP on Windows. Say(Hello); to WordPress on Azure
Develop and Run PHP on Windows. Say(Hello); to WordPress on Azure
 
Building fast aspnet websites
Building fast aspnet websitesBuilding fast aspnet websites
Building fast aspnet websites
 
Frontrow conf
Frontrow confFrontrow conf
Frontrow conf
 
semantic::core - A look back into seven years of enterprise class MediaWiki a...
semantic::core - A look back into seven years of enterprise class MediaWiki a...semantic::core - A look back into seven years of enterprise class MediaWiki a...
semantic::core - A look back into seven years of enterprise class MediaWiki a...
 
Building Modern Web Applications with ASP.NET5
Building Modern Web Applications with ASP.NET5Building Modern Web Applications with ASP.NET5
Building Modern Web Applications with ASP.NET5
 
Building rest services using aspnetwebapi
Building rest services using aspnetwebapiBuilding rest services using aspnetwebapi
Building rest services using aspnetwebapi
 
ASP.NET MVC 4
ASP.NET MVC 4ASP.NET MVC 4
ASP.NET MVC 4
 
Visual studio2019 launchevent_may25_blazor_presentation_net_bc_user_group_by_...
Visual studio2019 launchevent_may25_blazor_presentation_net_bc_user_group_by_...Visual studio2019 launchevent_may25_blazor_presentation_net_bc_user_group_by_...
Visual studio2019 launchevent_may25_blazor_presentation_net_bc_user_group_by_...
 
Moving Beyond WordPress At Tech in Asia
Moving Beyond WordPress At Tech in AsiaMoving Beyond WordPress At Tech in Asia
Moving Beyond WordPress At Tech in Asia
 
Php on azure
Php on azurePhp on azure
Php on azure
 
Office script labs
Office script labsOffice script labs
Office script labs
 
PHPNW14 - Getting Started With AWS
PHPNW14 - Getting Started With AWSPHPNW14 - Getting Started With AWS
PHPNW14 - Getting Started With AWS
 
ASP.NET MVC 4 Overview
ASP.NET MVC 4 OverviewASP.NET MVC 4 Overview
ASP.NET MVC 4 Overview
 
NodeJS Tour
NodeJS TourNodeJS Tour
NodeJS Tour
 

Destaque (6)

How to be a rock star .Net Developer
How to be a rock star .Net DeveloperHow to be a rock star .Net Developer
How to be a rock star .Net Developer
 
Professional assesment
Professional assesmentProfessional assesment
Professional assesment
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
 
What is Node.js
What is Node.jsWhat is Node.js
What is Node.js
 
Introduction into Big data
Introduction into Big dataIntroduction into Big data
Introduction into Big data
 
Why we choose Skype ?
Why we choose Skype ?Why we choose Skype ?
Why we choose Skype ?
 

Semelhante a Node

Node.js and the MEAN Stack Building Full-Stack Web Applications.pdf
Node.js and the MEAN Stack Building Full-Stack Web Applications.pdfNode.js and the MEAN Stack Building Full-Stack Web Applications.pdf
Node.js and the MEAN Stack Building Full-Stack Web Applications.pdf
lubnayasminsebl
 
VishalTaksale_RESUME_FORMAT
VishalTaksale_RESUME_FORMATVishalTaksale_RESUME_FORMAT
VishalTaksale_RESUME_FORMAT
Vishal Taksale
 
GeneralMobile Hybrid Development with WordPress
GeneralMobile Hybrid Development with WordPressGeneralMobile Hybrid Development with WordPress
GeneralMobile Hybrid Development with WordPress
GGDBologna
 
Narender Soni Resume - Updated
Narender Soni Resume - UpdatedNarender Soni Resume - Updated
Narender Soni Resume - Updated
Narender Soni
 

Semelhante a Node (20)

Real time web
Real time webReal time web
Real time web
 
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
 
How to build a SaaS solution in 60 days
How to build a SaaS solution in 60 daysHow to build a SaaS solution in 60 days
How to build a SaaS solution in 60 days
 
Web Development Presentation
Web Development PresentationWeb Development Presentation
Web Development Presentation
 
CodeIgniter - PHP MVC Framework by silicongulf.com
CodeIgniter - PHP MVC Framework by silicongulf.comCodeIgniter - PHP MVC Framework by silicongulf.com
CodeIgniter - PHP MVC Framework by silicongulf.com
 
Simple Cloud with Amazon Lightsail - Mike Coleman
Simple Cloud with Amazon Lightsail - Mike ColemanSimple Cloud with Amazon Lightsail - Mike Coleman
Simple Cloud with Amazon Lightsail - Mike Coleman
 
React for .net developers
React for .net developersReact for .net developers
React for .net developers
 
Node.js and the MEAN Stack Building Full-Stack Web Applications.pdf
Node.js and the MEAN Stack Building Full-Stack Web Applications.pdfNode.js and the MEAN Stack Building Full-Stack Web Applications.pdf
Node.js and the MEAN Stack Building Full-Stack Web Applications.pdf
 
VishalTaksale_RESUME_FORMAT
VishalTaksale_RESUME_FORMATVishalTaksale_RESUME_FORMAT
VishalTaksale_RESUME_FORMAT
 
Dev ops on aws deep dive on continuous delivery - Toronto
Dev ops on aws deep dive on continuous delivery - TorontoDev ops on aws deep dive on continuous delivery - Toronto
Dev ops on aws deep dive on continuous delivery - Toronto
 
DevOps On AWS - Deep Dive on Continuous Delivery
DevOps On AWS - Deep Dive on Continuous DeliveryDevOps On AWS - Deep Dive on Continuous Delivery
DevOps On AWS - Deep Dive on Continuous Delivery
 
Mobile Hybrid Development with WordPress
Mobile Hybrid Development with WordPressMobile Hybrid Development with WordPress
Mobile Hybrid Development with WordPress
 
GeneralMobile Hybrid Development with WordPress
GeneralMobile Hybrid Development with WordPressGeneralMobile Hybrid Development with WordPress
GeneralMobile Hybrid Development with WordPress
 
Simple Cloud with Amazon Lightsail
Simple Cloud with Amazon LightsailSimple Cloud with Amazon Lightsail
Simple Cloud with Amazon Lightsail
 
Narender Soni Resume - Updated
Narender Soni Resume - UpdatedNarender Soni Resume - Updated
Narender Soni Resume - Updated
 
Getting Started With Continuous Delivery on AWS - AWS April 2016 Webinar Series
Getting Started With Continuous Delivery on AWS - AWS April 2016 Webinar SeriesGetting Started With Continuous Delivery on AWS - AWS April 2016 Webinar Series
Getting Started With Continuous Delivery on AWS - AWS April 2016 Webinar Series
 
ASP.NEt MVC and Angular What a couple
ASP.NEt MVC and Angular What a coupleASP.NEt MVC and Angular What a couple
ASP.NEt MVC and Angular What a couple
 
From MEAN to the MERN Stack
From MEAN to the MERN StackFrom MEAN to the MERN Stack
From MEAN to the MERN Stack
 
Dart Past Your Competition by Getting Your Digital Experience into Market Fas...
Dart Past Your Competition by Getting Your Digital Experience into Market Fas...Dart Past Your Competition by Getting Your Digital Experience into Market Fas...
Dart Past Your Competition by Getting Your Digital Experience into Market Fas...
 
Desarrollo de apps multiplataforma con tecnologías web
Desarrollo de apps multiplataforma con tecnologías webDesarrollo de apps multiplataforma con tecnologías web
Desarrollo de apps multiplataforma con tecnologías web
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 

Node

  • 1. Fetch Statistics from the Yahoo Finance and save it into a Google Sheet document
  • 2. About me • An Engineering Student at the International Institute of Technology • Article Writer at CodeProject.com
  • 3. What is Node.js? • • • • • A powerful platform to let you run JS on the server side How? Uses Google’s V8 Engine V8 is built in C V8 is the fatest JS Engine on the planet Great way to build modern web apps on both Client and Server side!
  • 4. Timeline July 2011 Nov 2010 Cloud9IDE launches Jan 2009 Created Ryan Dahl 2009 April 2010 Heroku launches node support 2010 July 2010 Yammer adopts node.js Nov 2011 Windows Azure support LinkedIn adopts node for mobile platform port to Windows EBay releases API built on node Cloud9IDE azure support IISNode 2011 Oct 2011 node.js overtakes Ruby as most popular repo on gitHub Walmart Launch mobile site on node.js Feb 2012 App Harbour support 2012
  • 6. What Can I Do in Node? • • • • Anything you want! Chat servers, Analytics & Crazy fast backends Socket.io library is a wicked way to build real time apps Build a social Network! LinkedIn, Dropbox all using Node.js
  • 7. What Can’t I Do in Node? • Contradicts previous slide but  Node.js is not a web framework i.e Sinatra  Modules for node.js make it into web framework i.e Express  Node.js is not Multi-threaded  A single thread to rule them all
  • 8. Non-Blocking? Blocking? I’m so confused • By introducing callbacks. Node can move on to other requests and whenever the callback is called, node will process is. • You should read non-blocking code as « put function and params in queue and fire callback when you reach the end of the queue » • Blocking= return Non-Blocking= no return. Only callbacks
  • 9. Fetch Statistics from the Yahoo Finance • We have to fetch data from the link shown below:  http://finance.yahoo.com/q/ks?s=LVS The Company in our example is LVS.
  • 10. Fetch Statistics from the Yahoo Finance • You need to install Node.js Of course and it 3 packages:  npm install request – So we could work with URLs in an easy way.  npm install cheerio – jQuery for the server side. This will make the code 10x shorter.  npm install edit-google-spreadsheet – to integrate with Google docs/sheets with 2-3 lines of code.
  • 11. Fetch Statistics from the Yahoo Finance • • • • • // Some parameters var ticker = "LVS"; var yUrl = "http://finance.yahoo.com/q/ks?s=" + ticker; var financeDetails = new Array(); var keyStr = new Array();
  • 12. Fetch Statistics from the Yahoo Finance • • • • • • • • • // The main call to fetch the data, parse it and work on it. request(yUrl, function (error, response, body) { if (!error && response.statusCode == 200) { var $ = cheerio.load(body); // the keys - We get them from a certain class attribute var td = $('.yfnc_tablehead1'); $(td).each(function(j, val) { keyStr[j] = $(val).text(); });
  • 13. Working with Google Sheet Document • • • • • • • • • • // upload our data to Google sheet Spreadsheet.create({ debug: true, username: 'TODO-fill', password: 'TODO-fill', debug: true, spreadsheetName: 'TODO-yourSheetName', worksheetName: 'TODO-Sheet1orAbetterName', callback: sheetReady });
  • 14. Demo