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 +4 -4
- data/lib/eod_models/instrument_type.rb +13 -0
- data/lib/eod_services/instrument_type.rb +35 -0
- data/lib/sensei_eod_utils.rb +2 -0
- data/sensei_eod_utils.gemspec +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bc1c3ed5b0b29a4490f64dd8b9eda54c235c2b196b1fbe430a442a1704e2803
|
4
|
+
data.tar.gz: 5623d9bddfdf96ccb4fd9e6b1ccd8d87dd851117118cb20462831a90e2c33030
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3aff14075274ed14b16f4cede94c72e26ce77c2830c40daa4e9991d76857664aedce11347be2e7ef50db74037f2deb5207cf8f0f51528ef86d8d6577fd617d80
|
7
|
+
data.tar.gz: c05a9f8a974f042de5fda8cac5bb04bd75a6f889820121962081ecbe91efd6037de1ef1cafbc78eb11a43f152725781d01259fb237dbc0c1d89b1cefee56761a
|
@@ -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
|
data/lib/sensei_eod_utils.rb
CHANGED
@@ -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'
|
data/sensei_eod_utils.gemspec
CHANGED
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.
|
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
|