| View previous topic :: View next topic |
| Author |
Message |
dutch1918 Voice
Joined: 30 Jul 2014 Posts: 14
|
Posted: Thu Dec 04, 2014 10:54 am Post subject: TCL script help - us holiday check |
|
|
holiday.csv format
date,name,bank holiday,TRUE or FALSE
| Code: |
proc do_930_post {min hour day month weekday} {
global stockchan
if {get date,TRUE/FALSE from holiday.csv and compare to todays date if TRUE then} {
putserv "privmsg #swingtrader :\0030,4 09:30ET\0030,12 ((( US MARKET CLOSED - US HOLIDAY ))) \017"
} else {
putserv "privmsg #swingtrader :\0030,4 09:30ET\0030,12 ((( US MARKET OPEN ))) \017"
}
}
|
|
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
|
| Back to top |
|
 |
dutch1918 Voice
Joined: 30 Jul 2014 Posts: 14
|
Posted: Sun Dec 28, 2014 10:57 am Post subject: |
|
|
I finally figured it out with some help... In case someone else is looking the same thing here is the code I came up with:
holiday.csv file
| Code: |
Dec 25 Christmas US Holiday True
Jan 1 New Year's Day US Holiday True
Jan 19 Martin Luther King US Holiday True
Feb 16 Presidents Day US Holiday True
Apr 3 Good Friday US Holiday True
May 25 Memorial Day US Holiday True
Jul 3 Independance Day US Holiday True
Sep 7 Labor Day US Holiday True
Nov 26 Thanksgiving Day US Holiday True
|
bind cron script
| Code: |
proc do_930_post {min hour day month weekday} {
set holiday_file [open "holiday.csv" r]
set holidays [list]
while {[gets $holiday_file line] != -1} {
lappend holidays [lindex [split $line ,] 0]
}
set today [clock format [clock seconds] -timezone :America/New_York -format "%b %d"]
lset today 1 [scan [lindex $today 1] %d]
if {[lsearch -exact $holidays $today] > -1} {
putserv "privmsg #options :\0030,4 09:30ET\0030,12 ((( US MARKET CLOSED - US HOLIDAY ))) \017"
putserv "privmsg #marketnews :\0030,4 09:30ET\0030,12 ((( US MARKET CLOSED - US HOLIDAY ))) \017"
} else {
putserv "privmsg #options :\0030,4 09:30ET\0030,12 ((( US MARKET OPEN ))) \017"
putserv "privmsg #marketnews :\0030,4 09:30ET\0030,12 ((( US MARKET OPEN ))) \017"
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|