sensei_eod_utils 0.0.17 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe56c4ad4360909ab4c60eecc79ca7a6c62ce7ba11680445641e174946c67b9e
4
- data.tar.gz: b463878e8799e153f8bb656cefe4f1c47feafa6a7852f8f5f2ad9d975d4f827d
3
+ metadata.gz: 7bc1c3ed5b0b29a4490f64dd8b9eda54c235c2b196b1fbe430a442a1704e2803
4
+ data.tar.gz: 5623d9bddfdf96ccb4fd9e6b1ccd8d87dd851117118cb20462831a90e2c33030
5
5
  SHA512:
6
- metadata.gz: 00dfbcca4d3a9291e3060782be9462df8d1196778f912faf122b64dffb9c630748521e291814762d564c9368c96ae3e196adc0c936afab06ec61e9f8016f9d3e
7
- data.tar.gz: 2af25bd0255ebf0e1e8f908884fa7139ae12ed2e2d83927a3923dd891c54482206fc76b7e0e163fbc4d6e67730607ad076e0bea91ed422d2cbefcdc3cbc7d3f4
6
+ metadata.gz: 3aff14075274ed14b16f4cede94c72e26ce77c2830c40daa4e9991d76857664aedce11347be2e7ef50db74037f2deb5207cf8f0f51528ef86d8d6577fd617d80
7
+ data.tar.gz: c05a9f8a974f042de5fda8cac5bb04bd75a6f889820121962081ecbe91efd6037de1ef1cafbc78eb11a43f152725781d01259fb237dbc0c1d89b1cefee56761a
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ruby-enum'
4
+
5
+ module EodModels
6
+ class InstrumentType
7
+ include Ruby::Enum
8
+
9
+ define :OPTION, 'OPTION'
10
+ define :STOCK, 'STOCK'
11
+ define :ETF, 'ETF'
12
+ end
13
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EodServices
4
+ class InstrumentType
5
+ class <<self
6
+ def etf?(symbol)
7
+ call(symbol) == EodModels::InstrumentType::ETF
8
+ end
9
+
10
+ def stock?(symbol)
11
+ call(symbol) == EodModels::InstrumentType::STOCK
12
+ end
13
+
14
+ def option?(symbol)
15
+ call(symbol) == EodModels::InstrumentType::OPTION
16
+ end
17
+
18
+ private
19
+
20
+ def call(symbol)
21
+ fundamentals = EodFacade::Fundamentals(symbol)
22
+
23
+ if fundamentals['type'] == 'ETF'
24
+ EodModels::InstrumentType::ETF
25
+ elsif fundamentals['type'] == 'Common Stock'
26
+ EodModels::InstrumentType::Stock
27
+ elsif EodFacade::Options.call(symbol)
28
+ EodModels::InstrumentType::Option
29
+ else
30
+ raise ArgumentError, "Invalid intrument type for #{symbol}"
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eod_models/option_type.rb'
4
+ require 'eod_models/instrument_type.rb'
4
5
 
5
6
  require 'eod_services/contract.rb'
7
+ require 'eod_services/instrument_type.rb'
6
8
 
7
9
  require 'eod_facade/base.rb'
8
10
  require 'eod_facade/constants.rb'
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'sensei_eod_utils'
5
- s.version = '0.0.17'
5
+ s.version = '0.0.19'
6
6
  s.date = '2019-12-20'
7
7
  s.summary = 'Sensei trader utility functions and Eod api facade'
8
8
  s.authors = ['Nishant Shah']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensei_eod_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nishant Shah
@@ -68,8 +68,10 @@ files:
68
68
  - lib/eod_facade/eod.rb
69
69
  - lib/eod_facade/fundamentals.rb
70
70
  - lib/eod_facade/options.rb
71
+ - lib/eod_models/instrument_type.rb
71
72
  - lib/eod_models/option_type.rb
72
73
  - lib/eod_services/contract.rb
74
+ - lib/eod_services/instrument_type.rb
73
75
  - lib/sensei_eod_utils.rb
74
76
  - sensei_eod_utils.gemspec
75
77
  homepage: https://rubygems.org/gems/sensei_eod_utils