Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 Stock Spreadsheet

views
     
Intimidated
post Mar 3 2020, 08:37 PM


***
Junior Member
499 posts

Joined: Dec 2007
QUOTE(Yggdrasil @ Mar 2 2020, 09:07 AM)
I think it's not possible to obtain data on Google Sheets using Google Finance formula because it is not supported.
You might be able to if you have a paid database and use an add-on.

On Excel, it is possible to pull data from websites.
Example here.
So you may be able to pull from websites that has Malaysian closing price.

Example of pulling from klse.i3investor.com

user posted image
user posted image

Do note that most websites do not give live rates and are often delayed.
Therefore, it's not useful for daily trading.
*
I just tried using =importxml in google sheet, it works! biggrin.gif

But I choose to scrape the price from Bloomberg instead, just a personal preference. Google limit the formula auto update in sheet at once per hour interval if use too many of the formula in one sheet, so not suitable for day trading too. Though it’s great to have the sheet as a tracker to check at night after work
Intimidated
post Mar 3 2020, 10:15 PM


***
Junior Member
499 posts

Joined: Dec 2007
QUOTE(Yggdrasil @ Mar 3 2020, 10:02 PM)
Thanks for sharing. But how do you get the Xpath?
I tried but I got an error.

user posted image

Took the Xpath from here. There's Xpath and full Xpath
user posted image
*
I did this biggrin.gif

CODE


=importxml(D7,"//span[@class='priceText__1853e8a5']")


D7 = the cell that I put the Bloomberg url

Then I get a column of the url I want to track, and copy paste the =importxml formula

This post has been edited by Intimidated: Mar 3 2020, 10:17 PM
Intimidated
post Mar 3 2020, 10:26 PM


***
Junior Member
499 posts

Joined: Dec 2007
QUOTE(Yggdrasil @ Mar 3 2020, 10:21 PM)
Nice! But do you know how to get the code? So can use for other websites too  brows.gif
Edit: Wait. I think the picture I posted has the answer lol.
*
Ya ya i think the formula only works with things like
CODE

//td[@somethingsomething]
//a[@somethingsomething]
//span[@somethingsomething]

I also trial and error lol

This post has been edited by Intimidated: Mar 3 2020, 10:26 PM
Intimidated
post Mar 3 2020, 10:43 PM


***
Junior Member
499 posts

Joined: Dec 2007
QUOTE(Yggdrasil @ Mar 3 2020, 10:39 PM)
I think I found it. For example, klse.i3investor.com

user posted image

1. Input the formula like usual: =importxml("https://klse.i3investor.com/servlets/stk/annrep/6084.jsp",
2. Use inspect element to highlight the data.

As you can see, the code starts with "td". So,
CODE
//td[@


3. 0.38 which is the data we need is next to "class", so
CODE
//td[@class='


4. Fill in with the remaining code. So,
CODE
//td[@class='down big16']


5. Final code:

CODE
=importxml("https://klse.i3investor.com/servlets/stk/annrep/6084.jsp","//td[@class='down big16']")


6. Results

user posted image
*
Oh I just tried on a stock that gained instead of loss

The class will be ‘up big16’ instead

So maybe can do like

IFERROR(importxml_with_up big16, importxml_with_down big16)
Intimidated
post Mar 4 2020, 04:52 PM


***
Junior Member
499 posts

Joined: Dec 2007
QUOTE(hft @ Mar 4 2020, 02:38 PM)
Why need to use excel? Plenty of established free or by subscription tool available. You want to be successful or just having fancy excel sheet is the goal?
*
Some people just prefer a simple spreadsheet tracker that doesn’t require additional login/software biggrin.gif like me

I like to have one column for the actual amount paid (including fees) for the shares, one for how many shares I have, and one for the latest price (which I have now automated with the importxml formula!). Then some other fancy formatting like scale weightage conditional color formatting, blabla.

So it gives me a quick glance how much the real gain/loss is without me logging into another website or software. I already use Google Drive extensively for work biggrin.gif

EDITED: just realised I can scrape fund prices from Bloomberg for my FSM/other unit trust portfolios as well biggrin.gif now I can have a one-sheet tracker to tell me how are the investments doing, don’t have to login here there anymore

This post has been edited by Intimidated: Mar 4 2020, 04:55 PM

 

Change to:
| Lo-Fi Version
0.0196sec    0.86    7 queries    GZIP Disabled
Time is now: 21st December 2025 - 04:35 AM