forex_date 0.0.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -15,3 +15,5 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .rvmrc
19
+ .idea
data/README.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  Calculate the date of the current forex day.
4
4
 
5
+ A forex week begins when the Wellington/Sydney forex markets open (Sun 5pm EST) and closes when the New York forex market closes (Fri 5pm EST).
6
+
7
+ In order to calculate daily OHCL bars, the around the clock forex week can be split in 5 days:
8
+
9
+ monday: from Sun 5pm EST to Mon EST 5pm
10
+ tuesday: from Mon 5pm EST to Tue EST 5pm
11
+ wednesday: from Tue 5pm EST to Wed EST 5pm
12
+ thursday: from Wed 5pm EST to Thu EST 5pm
13
+ friday: from Thu 5pm EST to Fri EST 5pm
14
+
15
+ For example, if current time is Thu May 24 06:38:34 UTC 2012:
16
+
17
+ > ForexDate.now
18
+ => Thu, 24 May 2012
19
+
20
+ On saturdays and sundays it returns nil. If current time is Sat May 26 06:38:34 UTC 2012:
21
+
22
+ > ForexDate.now
23
+ => nil
24
+
5
25
  ## Installation
6
26
 
7
27
  Add this line to your application's Gemfile:
@@ -16,10 +36,6 @@ Or install it yourself as:
16
36
 
17
37
  $ gem install forex_date
18
38
 
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
39
  ## Contributing
24
40
 
25
41
  1. Fork it
data/forex_date.gemspec CHANGED
@@ -4,10 +4,29 @@ require File.expand_path('../lib/forex_date/version', __FILE__)
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["Javier Vidal"]
6
6
  gem.email = ["javier.vidal@bolsanova.com"]
7
- gem.description = %q{Calculate the date of the current forex day}
8
- gem.summary = %q{Calculate the date of the current forex day}
9
- gem.homepage = ""
7
+ gem.description = <<-END_OF_DESC
8
+ A forex week begins when the Wellington/Sydney forex markets open (Sun 5pm EST) and closes when the New York forex market closes (Fri 5pm EST).
9
+
10
+ In order to calculate daily OHCL bars, the around the clock forex week can be split in 5 days:
11
+
12
+ monday: from Sun 5pm EST to Mon EST 5pm
13
+ tuesday: from Mon 5pm EST to Tue EST 5pm
14
+ wednesday: from Tue 5pm EST to Wed EST 5pm
15
+ thursday: from Wed 5pm EST to Thu EST 5pm
16
+ friday: from Thu 5pm EST to Fri EST 5pm
17
+
18
+ For example, if current time is Thu May 24 06:38:34 UTC 2012:
10
19
 
20
+ > ForexDate.now
21
+ => Thu, 24 May 2012
22
+
23
+ On saturdays and sundays it returns nil. If current time is Sat May 26 06:38:34 UTC 2012:
24
+
25
+ > ForexDate.now
26
+ => nil
27
+ END_OF_DESC
28
+ gem.summary = %q{Calculate the date of the current forex day}
29
+ gem.homepage = "http://github.com/javiervidal/forex_date"
11
30
  gem.files = `git ls-files`.split($\)
12
31
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
32
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
@@ -1,3 +1,3 @@
1
1
  module ForexDate
2
- VERSION = "0.0.2"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/forex_date.rb CHANGED
@@ -6,7 +6,7 @@ module ForexDate
6
6
 
7
7
  def ForexDate.now
8
8
  t = Time.now.in_time_zone("Eastern Time (US & Canada)")
9
- date = t.date
9
+ date = t.to_date
10
10
  date += 1.day if t.hour > 17
11
11
  return ( date.wday == 6 || date.wday == 7 ) ? nil : date
12
12
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forex_date
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
+ - 1
7
8
  - 0
8
9
  - 0
9
- - 2
10
- version: 0.0.2
10
+ version: 1.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Javier Vidal
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-25 00:00:00 Z
18
+ date: 2012-05-26 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: tzinfo
@@ -31,7 +31,27 @@ dependencies:
31
31
  version: "0"
32
32
  type: :runtime
33
33
  version_requirements: *id001
34
- description: Calculate the date of the current forex day
34
+ description: |
35
+ A forex week begins when the Wellington/Sydney forex markets open (Sun 5pm EST) and closes when the New York forex market closes (Fri 5pm EST).
36
+
37
+ In order to calculate daily OHCL bars, the around the clock forex week can be split in 5 days:
38
+
39
+ monday: from Sun 5pm EST to Mon EST 5pm
40
+ tuesday: from Mon 5pm EST to Tue EST 5pm
41
+ wednesday: from Tue 5pm EST to Wed EST 5pm
42
+ thursday: from Wed 5pm EST to Thu EST 5pm
43
+ friday: from Thu 5pm EST to Fri EST 5pm
44
+
45
+ For example, if current time is Thu May 24 06:38:34 UTC 2012:
46
+
47
+ > ForexDate.now
48
+ => Thu, 24 May 2012
49
+
50
+ On saturdays and sundays it returns nil. If current time is Sat May 26 06:38:34 UTC 2012:
51
+
52
+ > ForexDate.now
53
+ => nil
54
+
35
55
  email:
36
56
  - javier.vidal@bolsanova.com
37
57
  executables: []
@@ -49,7 +69,7 @@ files:
49
69
  - forex_date.gemspec
50
70
  - lib/forex_date.rb
51
71
  - lib/forex_date/version.rb
52
- homepage: ""
72
+ homepage: http://github.com/javiervidal/forex_date
53
73
  licenses: []
54
74
 
55
75
  post_install_message: