sensei_eod_utils 0.0.14 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/eod_facade/options.rb +14 -0
- data/sensei_eod_utils.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17a22745553fa35cf8d2d51a5c1c2a3ed136e00275bf41c365803eec0e7c3366
|
4
|
+
data.tar.gz: e29d0796eaca43d49cbd5cad46366e6b1bebc68796da6852356c7930c10d668d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c397fca52a55ae30239ceb0fc68a2ad7455f9ff9c827be8289762b98a9adc5d4b9c84c40609700ec7aecfed3b06c58287fa4e68da097d4b44e00576b4454900
|
7
|
+
data.tar.gz: b34cb639cba648c7b4aa3d675931ce3758401a5464d362b4fdf97f0db4c0a4a35b38d5d5ccf3781fec24ac163b6a05f8bb13cda07f464fa5ed09bf89db3b0834
|
data/lib/eod_facade/options.rb
CHANGED
@@ -8,6 +8,7 @@ module EodFacade
|
|
8
8
|
def call(symbol)
|
9
9
|
underlying = EodServices::Contract.underlying_symbol(symbol)
|
10
10
|
expiry = EodServices::Contract.contract_expiry(symbol)
|
11
|
+
option_type = contract_type(symbol)
|
11
12
|
|
12
13
|
unless expiry
|
13
14
|
raise ArgumentError, "Invalid expiration date for option #{symbol}"
|
@@ -54,6 +55,19 @@ module EodFacade
|
|
54
55
|
|
55
56
|
contract.merge('expirationDate' => expiration_date)
|
56
57
|
end
|
58
|
+
|
59
|
+
def contract_type(symbol)
|
60
|
+
option_type = Trade::Option::ContractService.contract_type(symbol)
|
61
|
+
case option_type
|
62
|
+
when OptionType::CALL
|
63
|
+
'CALL'
|
64
|
+
when OptionType::PUT
|
65
|
+
'PUT'
|
66
|
+
else
|
67
|
+
raise ArgumentError,
|
68
|
+
"Invalid option_type #{option_type} for symbol #{symbol}"
|
69
|
+
end
|
70
|
+
end
|
57
71
|
end
|
58
72
|
end
|
59
73
|
end
|
data/sensei_eod_utils.gemspec
CHANGED