dss_reuters 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/dss_reuters.gemspec +2 -0
- data/lib/dss_reuters/version.rb +1 -1
- data/lib/dss_reuters.rb +45 -29
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82f3b0e58e871c1c0d18c097772be1698cee53bd1174869a7c4003b71d90871e
|
4
|
+
data.tar.gz: 93355f8d00576644293dae7c535e4dd3ee0d5a07706a74527bcf9d4365ba36e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5d0e5be88cc4574a7ed36428a2b466540167f45b26c37a771913851eb545b666144a4ebd88b5f6f446133f562b0b5dc7b153a1ed8362c8abb1c2edeca09b7f7
|
7
|
+
data.tar.gz: 7c220efba39f63cd2b3dfd699ccabe71504625d31c83def77f995db3f15dfc4c75ef1ea497b60384edd3ab7591779d3103bf175637d5900553018d6cadbd5873
|
data/README.md
CHANGED
@@ -38,8 +38,9 @@ Usage flow goes like this :
|
|
38
38
|
|
39
39
|
Default request fires a Composite extraction request. You can customize your request like :
|
40
40
|
|
41
|
-
req = api.extract_with_isin "KE1000001402", ["Life High", "Life Low", "Year High", "Year Low"]
|
42
|
-
req = api.extract_with_isin "KE1000001402", ["Net Change - Close Price - 1 Day"]
|
41
|
+
req = api.extract_with_isin "KE1000001402", :intraday_pricing, ["Life High", "Life Low", "Year High", "Year Low"]
|
42
|
+
req = api.extract_with_isin "KE1000001402", :technical_indicators, ["Net Change - Close Price - 1 Day"]
|
43
|
+
req = api.extract_with_isin "KE1000001402", :time_series, ["Close Price", "Trade Date"], {"StartDate" => "2018-01-01", "EndDate" => "2018-08-01"}
|
43
44
|
|
44
45
|
## Contributing
|
45
46
|
|
data/dss_reuters.gemspec
CHANGED
@@ -24,4 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.16"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
26
|
spec.add_dependency "httparty", "~> 0.16.2"
|
27
|
+
spec.add_dependency "pry-byebug", "~> 3.6.0"
|
28
|
+
spec.add_dependency "dotenv", "~> 2.5.0"
|
27
29
|
end
|
data/lib/dss_reuters/version.rb
CHANGED
data/lib/dss_reuters.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "dotenv/load"
|
1
2
|
require "logger"
|
2
3
|
require "httparty"
|
3
4
|
require "dss_reuters/version"
|
@@ -60,42 +61,52 @@ module DssReuters
|
|
60
61
|
class OnDemandExtract
|
61
62
|
include HTTParty
|
62
63
|
base_uri Config::BASE_URI
|
63
|
-
attr_reader :result
|
64
|
+
attr_reader :result
|
65
|
+
attr_accessor :status, :location
|
64
66
|
|
65
67
|
def camelize(str)
|
66
68
|
str.to_s.split('_').collect(&:capitalize).join
|
67
69
|
end
|
68
70
|
|
69
|
-
def
|
71
|
+
def self.init_with_location(session, location)
|
72
|
+
ins = self.new(session)
|
73
|
+
ins.status = :in_progress
|
74
|
+
ins.location = location
|
75
|
+
ins
|
76
|
+
end
|
77
|
+
|
78
|
+
def initialize(session, identifiers=nil, type=nil, fields=nil, condition=nil)
|
70
79
|
@session = session
|
71
80
|
@status = :init
|
72
81
|
path = "/RestApi/v1/Extractions/ExtractWithNotes"
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
"
|
83
|
-
|
84
|
-
"
|
85
|
-
"
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
82
|
+
|
83
|
+
if fields
|
84
|
+
options = {
|
85
|
+
headers: {
|
86
|
+
"Prefer" => "respond-async; wait=5",
|
87
|
+
"Content-Type" => "application/json; odata=minimalmetadata",
|
88
|
+
"Authorization" => "Token #{@session.token}"
|
89
|
+
},
|
90
|
+
body: {
|
91
|
+
"ExtractionRequest" => {
|
92
|
+
"@odata.type" => "#{camelize(type)}ExtractionRequest",
|
93
|
+
"ContentFieldNames" => fields,
|
94
|
+
"IdentifierList" => {
|
95
|
+
"@odata.type" => "InstrumentIdentifierList",
|
96
|
+
"InstrumentIdentifiers" => identifiers,
|
97
|
+
"ValidationOptions" => nil,
|
98
|
+
"UseUserPreferencesForValidationOptions" => false
|
99
|
+
},
|
100
|
+
"Condition" => condition
|
101
|
+
}
|
102
|
+
}.to_json
|
103
|
+
}
|
104
|
+
resp = self.class.post path, options
|
105
|
+
if check_status(resp)
|
106
|
+
@location = resp["location"]
|
107
|
+
end
|
108
|
+
@session.logger.debug resp
|
96
109
|
end
|
97
|
-
pp resp
|
98
|
-
@session.logger.debug resp
|
99
110
|
end
|
100
111
|
|
101
112
|
def check_status(resp)
|
@@ -117,6 +128,7 @@ module DssReuters
|
|
117
128
|
@result = self.class.get @location, options
|
118
129
|
check_status @result
|
119
130
|
@session.logger.debug @result
|
131
|
+
@status
|
120
132
|
end
|
121
133
|
end
|
122
134
|
end
|
@@ -130,7 +142,11 @@ module DssReuters
|
|
130
142
|
@user = User.new(@session)
|
131
143
|
end
|
132
144
|
|
133
|
-
def
|
145
|
+
def extract_with_location(location)
|
146
|
+
OnDemandExtract.init_with_location(@session, location)
|
147
|
+
end
|
148
|
+
|
149
|
+
def extract_with_isin(isin_code, type=:composite, fields=nil, condition=nil)
|
134
150
|
fields ||= [
|
135
151
|
"Close Price",
|
136
152
|
"Contributor Code Description",
|
@@ -148,7 +164,7 @@ module DssReuters
|
|
148
164
|
"IdentifierType" => "Isin"
|
149
165
|
}
|
150
166
|
]
|
151
|
-
OnDemandExtract.new(@session,
|
167
|
+
OnDemandExtract.new(@session, identifiers, type, fields, condition)
|
152
168
|
end
|
153
169
|
end
|
154
170
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dss_reuters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arda Karaduman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.16.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry-byebug
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.6.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.6.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: dotenv
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.5.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.5.0
|
55
83
|
description: This is a simple gem to extract data from DSS Reuters
|
56
84
|
email:
|
57
85
|
- akaraduman@gmail.com
|