[R/Python] Can I hear sound from my PC, as soon as MSFT hit $50?

Dear-

It is well known that we can receive intraday data feed for MSFT, as well as 500 equity in SnP500. Already I can program whenever MSFT hit $50, to give result in my screen.

However, due to plain other work during the day, it is impossible to keep seeing my screen every one minute.

I wonder if there can be a sound from my PC (Of course I use office by myself), to hear "MSFT (or AAPL) is approaching to you watch", as soon as it hits $50.

Of course, before 9:00 AM, I can program to prepare a csv matrix(500 rows and 2 columns), such as

MSFT $50
........

*************************************************

May I hear sound by either

1) commercial data feed provider
2) personal programming by R/Python
3) or else ?

PS) Although IB may give similar "alerts", I cannot upload the above 500 by 2 matrix at one time.

-Jay
 
From stack overflow,

import winsound
Freq=2500# Set Frequency To 2500 Hertz
Dur=1000# Set Duration To 1000 ms == 1 second
winsound.Beep(Freq,Dur)
 
From stack overflow,

import winsound
Freq=2500# Set Frequency To 2500 Hertz
Dur=1000# Set Duration To 1000 ms == 1 second
winsound.Beep(Freq,Dur)

Is it Python commands? If so, please direct me any related link.

Thanks in advance.

PS) Appreciated if you can search any sounding work in R too.
I may not be able to search it.

-Jay
 
If some data feed provider (like eSignal) does it for me, via web-connection, as well as data feeding itself, then I will gladly pay for them by the month.

I can upload the 500 by 2 matrix of csv format (at 9:00 and 10:00, ...) so that the company send me sound via web.
 
Here are the R codes I have been using to get index data from Yahoo (google) Finance and send me text message once it breaks a key lvl. You can change it to your own e-mail address and your cellphone #. I am using t-mobile so the to address is YYY@tmomail.net. You can change the warning signal to be issue on your own logic and data source but the principle is the same.



library(mailR)
library(quantmod)
warninglvl=1900

txtme<-function ()
{send.mail(from = "XXX@gmail.com",
to = c("YYY@tmomail.net"),
subject = "R send txt",
body = paste("SP500 warning, SP500<",warninglvl),
smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = "XXX@gmail.com", passwd = "MMM", ssl = TRUE),
authenticate = TRUE,
send = TRUE)
}




require(quantmod)
#require(qmao)

############ FROM yahoo Finance####################################



Times <- NULL
Prices <- NULL
while(1) {
tryCatch({
#Load current quote
Year <- 1970
currentYear <- as.numeric(format(Sys.time(),'%Y'))
while (Year != currentYear) { #Sometimes yahoo returns bad quotes
currentQuote <- getQuote('^GSPC') #index is real time but stocks are 15 min delayed from yahoo

Year <- as.numeric(format(currentQuote['Trade Time'],'%Y'))
}

#Add current quote to the dataset
if (is.null(Times)) {
#Times <- Sys.time()-15*60 #Quotes are delayed 15 minutes
Times <- Sys.time() #Quotes are instant from google even for individual stocks.
Prices <- currentQuote['Last']
} else {
Times <- c(Times,Sys.time())
Prices <- rbind(Prices,currentQuote['Last'])
}

#Convert to 1-minute bars
Data <- xts(Prices,order.by=Times)
Data <- na.omit(to.minutes(Data,indexAt='endof'))

#Plot the data when we have enough
if (nrow(Data)>5) {
chartSeries(Data,theme='white',TA='addRSI(n=5);addBBands(n=5)')
}

#Wait 10 second to avoid overwhelming the server
Sys.sleep(10)



#On errors, sleep 10 seconds and hope it goes away
},error=function(e) {print(e);Sys.sleep(10)})
if (as.numeric(currentQuote['Last'])<warninglvl) {print("warning");txtme();break;}
}
 
Back
Top