Realtime Alerts for BSE Corporate announcements

Looks like the sheet is not shared. Can you please share it again.

2 Likes

Here is updated google drive link, earlier one had a some problem.

NSE provides Feed, you can get it here https://www.nseindia.com/global/content/rssFeed.htm, only concern is delay in updates.

1 Like

Dear, @PareshPatel

error while executing send email function in updated bse alerts sheets
Error: Not enough arguments (line 54, file “Code”)

line 54 ---- var url = Utilities.formatString(‘Latest Corporate Announcements’, code)

In the earlier version of the script i was not getting any error while executing send email function

Thanks

Hello Dear, I checked and working fine. but you can remove the code and paste this code. (this is second version )

function alertEmail(){
var sheet = SpreadsheetApp.getActive().getSheets()[0];
send_message(watchlist(sheet), announcements(), sheet);
}

function send_message(wl, ann, sheet, accessToken) {
const data = Object.keys(wl).reduce(function(prev, curr){
if(Object.keys(ann).indexOf(curr) > -1 && (wl[curr].last_update < ann[curr].timestamp || wl[curr].last_update.length === 0)) {
pushbullet(wl[curr].symbol+" - "+ann[curr].notice, ann[curr].notice,ann[curr].pdf, “https://www.bseindia.com/corporates/ann.aspx?scrip=”+curr)
prev.push([wl[curr].symbol, curr, ann[curr].timestamp])
} else {
prev.push([wl[curr].symbol ,curr, wl[curr].last_update])
}
return prev
}, [])
sheet.getRange(“A2:C”+((Object.keys(wl).length+1).toFixed(0))).setValues(data)
}

function watchlist(sheet) {
return sheet.getRange(“A2:C”).getValues()
.filter(function (x) { return x.filter(Boolean).length !==0 })
.reduce(function(prev, curr) {
prev[curr[1]] = { “symbol” : curr[0], “last_update” : curr[2] }
return prev
}, {})
}

function announcements() {
return UrlFetchApp.fetch(“http://www.bseindia.com/corporates/ann.aspx”).getContentText()
.match(/<td class=‘TTHeadergrey’.?</td></tr>.?</td></tr>/g)
.map(function(x) { return x.match(/<td.?>(.?)</td>/g) })
.map(function(x) {
return x.map(function (y, i) {
switch (i) {
case 0: return y.replace(/<.+?>/g, “”).split(" - ")[1] // BSE Code
case 1: return y.replace(/<.+?>/g, “”) // Notice Category
case 2: return /http.*?pdf/g.exec(y) + “” // Notice PDF URL
case 4: return date(y.match(/(\d{2}/\d{2}/\d{4} \d{2}:\d{2}:\d{2})/g)[0]) // Timestamp
case 5: return y.replace(/<.+?>/g, “”) // Notice Text
default: return “”}
})
})
.reduce(function (prev, curr) {
prev[curr[0]] = { “category” : curr[1], “pdf” : curr[2], “timestamp” : curr[4], “notice” : curr[5] }
return prev
}, {})
}

function pushbullet(title, notice, pdf, link) {
var body = notice+"\n\n"+link+"\n\nAttachment: "+pdf;
GmailApp.sendEmail(Session.getActiveUser().getEmail(), title.substring(0, 250), body);
}

function date(string){
const d = string.split(/[/\s:]/g).map(Number)
return (new Date(d[2], d[1]-1, d[0], d[3], d[4], d[5])).getTime()/1000
}

1 Like

I am unable to edit it. Can you please do the needful

Just copy and paste above code.

First save excel sheet using copy file function and change code as mentioned in original post.

You meant sendEmail in#7 instead of alert email as i don’t see any alert email in the drop down.

@PareshPatel its giving an error in line 9 while I try to update the sheet with above code

Line 9 is

pushbullet(wl[curr].symbol+" - "+ann[curr].notice, ann[curr].notice,ann[curr].pdf, “Latest Corporate Announcements)

Error displays:

Illegal character. (line 9, file “Code”)

Also, I don’t see AlertEmail option, Should we use Alertbot instead ?

I am too getting the same error with the renewed code provided.

@PareshPatel , any update on this buddy ?

Thanks @PareshPatel for the code working flawless and easy to track my watch list

1 Like

MarketATP is another good option to get email notifications for your selected favorite stocks. Currently it works only for BSE and is free to use.
I got this info from Twitter and currently a user. Pretty happy.

How do we set market ATP? Pls help

Its now a paid service. I dont use it anymore. I now use BsePlus, just register and create watchlist. You should see all the updates on your dashboard.

Is BsePlus, real-time? How quick is the update? Does dashboard gets update as soon as result is announced by the company?

Thanks

I assume it’s real time as it’s Bse website.

Crossposting my solution on this thread as its relevant here.

Push Notifications without installing apps - works on desktop as well as mobile.

https://phreakonomics.in/bse-notifier

Instructions here -

Hope its useful.

3 Likes

Hi, facing login issues since last couple of hours.

Thanks
Amit

Is it possible to search if a particular investor has bought / sold shares from the BSE / NSE site.
I can it we can search company wise. Dont see option to search by person name.