given a timstamp, tell if Forex NY/Tokyo/London active
given a timstamp, tell if Forex NY/Tokyo/London active
Loading saved threads...
Xpector · External communityPost link
External question — Quantitative Finance Stack Exchange
Author: Xpector
Original post: https://quant.stackexchange.com/questions/37692
License: CC BY-SA 3.0 — https://creativecommons.org/licenses/by-sa/3.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I am looking for a [pseudo-]code for the following task: given a [GMT] timestamp, tell which of Sydney, Tokyo, London and New York FOREX session were opened. Weekend, daylight saving time and holiday awareness are reqired.
So it's more or less what
http://www.forex-market-hours.net/
does. From what I remember, daylight saving time is activated on different dates in their time zones.
I saw the answer in
Forex Market Timezones
, but coudn't access the ACI model code it refers to.
Quote
Report
rupweb · External communityPost link
External answer — Quantitative Finance Stack Exchange
Author: rupweb
Original post: https://quant.stackexchange.com/a/37716
License: CC BY-SA 3.0 — https://creativecommons.org/licenses/by-sa/3.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I would write out the local business hours for each trading centre in a spreadsheet and get the pseudo code from that. As for holidays, for example when London is on holiday then Tokyo / New York will cover the London hours. You would have to put all GBP bank holidays in your spreadsheet.
For New York it’s USD holidays etc.
Otherwise your question seems to be related to
this
Quote
Report
babelproofreader · External communityPost link
External answer — Quantitative Finance Stack Exchange
Author: babelproofreader
Original post: https://quant.stackexchange.com/a/37723
License: CC BY-SA 3.0 — https://creativecommons.org/licenses/by-sa/3.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
Here is a snippet of an R script I use to append newly downloaded hourly data to historical data in a csv file on disk
# get London and New York times and weekdays
london_time <- format( as.POSIXct( new_historical_data[ , 1 ] , tz = "UTC" ) , tz = "Europe/London" )
london_weekday <- as.POSIXlt( london_time )
london_weekday + 1 # +1 to match Octave's weekday representation
new_york_time <- format( as.POSIXct( new_historical_data[ , 1 ] , tz = "UTC" ) , tz = "America/New_York" )
new_york_weekday <- as.POSIXlt( new_york_time )
new_york_weekday + 1 # +1 to match Octave's weekday representation
# add London and New York times columns
new_historical_data <- cbind( new_historical_data[ , 1 ] , london_time , london_weekday , new_york_time , new_york_weekday , new_historical_data[ , 2 : 7 ] )
This changes the downloaded "new_historical_data" format from
UTC_date_time , open , high , ...
to
UTC_date_time , London_date_time , London_weekday_marker , New_York_date_time , New_York_weekday_marker , open , high , ...
format.
Because R references the installed time zone library on my system, the London and New York times are correctly adjusted for the appropriate daylight savings time
Quote
Report
Post Reply
Checking account access…