eod 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -11
- data/bin/eod +4 -7
- data/lib/eod/api.rb +5 -7
- data/lib/eod/command.rb +75 -76
- data/lib/eod/exceptions.rb +1 -1
- data/lib/eod/version.rb +2 -2
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bd6ad52b91c2195a4d42e75945b713a2d844fa233f5866f0e15a0f24d2db36e
|
4
|
+
data.tar.gz: 78aa2f9f78b9b1a2bd77e5d9dfcaac25085f3fb7ac6c55e76ab8bef202a401f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0abd6015fd69695e8fc177d2a1ed0847bc23367ab2d65a809857790bb308fdf6aead6864a98a21f8916855e62b66bc884e8d51fb74b0e9d618e0f452afc7388
|
7
|
+
data.tar.gz: d69cfc7faa9cbe072aab80f19e446e4600e43d1c2178216d495f11534596d526173e65465776888998d47262b270e722cd39f6d7bca0ecaa292b0c02d1b33df7
|
data/README.md
CHANGED
@@ -2,12 +2,15 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/eod.svg)](https://badge.fury.io/rb/eod)
|
4
4
|
[![Build Status](https://github.com/DannyBen/eod/workflows/Test/badge.svg)](https://github.com/DannyBen/eod/actions?query=workflow%3ATest)
|
5
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/52438abcc1532b93b525/maintainability)](https://codeclimate.com/github/DannyBen/eod/maintainability)
|
5
6
|
|
6
7
|
---
|
7
8
|
|
8
9
|
This gem provides both a Ruby library and a command line interface for the
|
9
10
|
[EOD Historical Data][docs] data service.
|
10
11
|
|
12
|
+
This gem is not affiliated with EOD Historical Data.
|
13
|
+
|
11
14
|
---
|
12
15
|
|
13
16
|
|
@@ -130,8 +133,6 @@ Or, to save CSV, use the `save_csv` method:
|
|
130
133
|
api.save_csv "filename.csv", "eod/AAPL.US", period: 'm'
|
131
134
|
```
|
132
135
|
|
133
|
-
|
134
|
-
|
135
136
|
## Command Line Interface
|
136
137
|
|
137
138
|
The command line utility `eod` that is installed when installing the gem acts
|
@@ -163,6 +164,12 @@ $ eod data AAPL.US --format csv --save aapl.csv from:2022-01-01 period:m
|
|
163
164
|
Run [`eod --help`](#full-command-line-usage-patterns) for the full list of usage
|
164
165
|
patterns.
|
165
166
|
|
167
|
+
## Supported endpoints
|
168
|
+
|
169
|
+
- The Ruby library supports all current and future endpoints.
|
170
|
+
- The CLI supports most (if not all) current endpoints. If you know of an
|
171
|
+
endpoint that is not supported, please create an [issue][issues].
|
172
|
+
|
166
173
|
|
167
174
|
## Caching
|
168
175
|
|
@@ -174,18 +181,18 @@ a later stage.
|
|
174
181
|
|
175
182
|
```ruby
|
176
183
|
# Disable cache completely
|
177
|
-
api = EOD::API.new api_token, use_cache:
|
184
|
+
api = EOD::API.new api_token, use_cache: false
|
178
185
|
|
179
186
|
# Set different cache directory or lifetime
|
180
187
|
api = EOD::API.new api_token, cache_dir: 'data', cache_ilfe: '2h'
|
181
188
|
|
182
|
-
#
|
189
|
+
# Or configure cache after initializaation:
|
183
190
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
191
|
+
api = EOD::API.new api_token
|
192
|
+
api.cache.disable
|
193
|
+
api.cache.enable
|
194
|
+
api.cache.dir = 'tmp/cache' # Change cache folder
|
195
|
+
api.cache.life = '30m' # Change cache life to 30 minutes
|
189
196
|
```
|
190
197
|
|
191
198
|
To enable caching for the command line, simply set one or both of
|
@@ -207,12 +214,15 @@ The cache life argument supports these formats:
|
|
207
214
|
|
208
215
|
## Full command line usage patterns
|
209
216
|
|
217
|
+
<!-- USAGE -->
|
210
218
|
```
|
211
219
|
$ eod --help
|
212
220
|
|
213
|
-
<!-- USAGE -->
|
214
221
|
EOD Historical Data API
|
215
222
|
|
223
|
+
API Documentation:
|
224
|
+
https://eodhistoricaldata.com/financial-apis/
|
225
|
+
|
216
226
|
Usage:
|
217
227
|
eod bond SYMBOL [options] [PARAMS...]
|
218
228
|
eod bulk EXCHANGE [options] [PARAMS...]
|
@@ -361,9 +371,9 @@ Examples:
|
|
361
371
|
eod technical AAPL.US function:sma
|
362
372
|
eod macro USA indicator:inflation_consumer_prices_annual
|
363
373
|
|
374
|
+
```
|
364
375
|
<!-- USAGE -->
|
365
376
|
|
366
|
-
````
|
367
377
|
|
368
378
|
## Contributing / Support
|
369
379
|
|
data/bin/eod
CHANGED
@@ -8,18 +8,15 @@ runner = EOD::CLI.runner
|
|
8
8
|
|
9
9
|
begin
|
10
10
|
exit runner.run ARGV
|
11
|
-
|
12
11
|
rescue Interrupt
|
13
12
|
say "\nGoodbye"
|
14
|
-
exit 1
|
15
|
-
|
13
|
+
exit 1
|
16
14
|
rescue => e
|
17
15
|
if ENV['DEBUG']
|
18
|
-
puts e.backtrace.reverse
|
19
|
-
say
|
16
|
+
puts e.backtrace.reverse
|
17
|
+
say ''
|
20
18
|
end
|
21
|
-
say "
|
19
|
+
say "ru`ERROR: #{e.class}`"
|
22
20
|
say e.message
|
23
21
|
exit 1
|
24
|
-
|
25
22
|
end
|
data/lib/eod/api.rb
CHANGED
@@ -16,13 +16,13 @@ module EOD
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def default_query
|
19
|
-
{ api_token: api_token, fmt: :json }
|
19
|
+
{ api_token: api_token, fmt: :json }
|
20
20
|
end
|
21
21
|
|
22
22
|
def get_csv(*args)
|
23
|
-
payload = get!
|
23
|
+
payload = get!(*args)
|
24
24
|
|
25
|
-
if payload.response.code !=
|
25
|
+
if payload.response.code != '200'
|
26
26
|
raise BadResponse, "#{payload.response.code} #{payload.response.msg}"
|
27
27
|
end
|
28
28
|
|
@@ -31,12 +31,10 @@ module EOD
|
|
31
31
|
|
32
32
|
header = data.first.keys
|
33
33
|
|
34
|
-
|
34
|
+
CSV.generate do |csv|
|
35
35
|
csv << header
|
36
36
|
data.each { |row| csv << row.values }
|
37
37
|
end
|
38
|
-
|
39
|
-
result
|
40
38
|
end
|
41
39
|
end
|
42
|
-
end
|
40
|
+
end
|
data/lib/eod/command.rb
CHANGED
@@ -9,85 +9,85 @@ module EOD
|
|
9
9
|
help "EOD Historical Data API\n\n API Documentation:\n https://eodhistoricaldata.com/financial-apis/"
|
10
10
|
version EOD::VERSION
|
11
11
|
|
12
|
-
usage
|
13
|
-
usage
|
14
|
-
usage
|
15
|
-
usage
|
16
|
-
usage
|
17
|
-
usage
|
18
|
-
usage
|
19
|
-
usage
|
20
|
-
usage
|
21
|
-
usage
|
22
|
-
usage
|
23
|
-
usage
|
24
|
-
usage
|
25
|
-
usage
|
26
|
-
usage
|
27
|
-
usage
|
28
|
-
usage
|
29
|
-
usage
|
30
|
-
usage
|
31
|
-
usage
|
32
|
-
usage
|
33
|
-
usage
|
34
|
-
|
35
|
-
command
|
36
|
-
command
|
37
|
-
command
|
38
|
-
command
|
39
|
-
command
|
40
|
-
command
|
41
|
-
command
|
42
|
-
command
|
43
|
-
command
|
44
|
-
command
|
45
|
-
command
|
46
|
-
command
|
47
|
-
command
|
48
|
-
command
|
49
|
-
command
|
50
|
-
command
|
51
|
-
command
|
52
|
-
command
|
53
|
-
command
|
54
|
-
command
|
55
|
-
command
|
56
|
-
|
57
|
-
option
|
58
|
-
option
|
59
|
-
|
60
|
-
param
|
61
|
-
param
|
62
|
-
param
|
63
|
-
param
|
64
|
-
param
|
12
|
+
usage 'eod bond SYMBOL [options] [PARAMS...]'
|
13
|
+
usage 'eod bulk EXCHANGE [options] [PARAMS...]'
|
14
|
+
usage 'eod calendar CALENDAR [options] [PARAMS...]'
|
15
|
+
usage 'eod data SYMBOL [options] [PARAMS...]'
|
16
|
+
usage 'eod dividends SYMBOL [options] [PARAMS...]'
|
17
|
+
usage 'eod events [options] [PARAMS...]'
|
18
|
+
usage 'eod exchange EXCHANGE [options] [PARAMS...]'
|
19
|
+
usage 'eod exchanges [options] [PARAMS...]'
|
20
|
+
usage 'eod fundamental SYMBOL [options] [PARAMS...]'
|
21
|
+
usage 'eod fundamental_bulk SYMBOL [options] [PARAMS...]'
|
22
|
+
usage 'eod insider [options] [PARAMS...]'
|
23
|
+
usage 'eod intraday SYMBOL [options] [PARAMS...]'
|
24
|
+
usage 'eod live SYMBOL [options] [PARAMS...]'
|
25
|
+
usage 'eod macro COUNTRY [options] [PARAMS...]'
|
26
|
+
usage 'eod news [options] [PARAMS...]'
|
27
|
+
usage 'eod opts SYMBOL [options] [PARAMS...]'
|
28
|
+
usage 'eod screener [options] [PARAMS...]'
|
29
|
+
usage 'eod search QUERY [options] [PARAMS...]'
|
30
|
+
usage 'eod splits SYMBOL [options] [PARAMS...]'
|
31
|
+
usage 'eod symbols EXCHANGE [options] [PARAMS...]'
|
32
|
+
usage 'eod technical SYMBOL [options] [PARAMS...]'
|
33
|
+
usage 'eod (-h|--help|--version)'
|
34
|
+
|
35
|
+
command 'bond', 'Bond fundamental data (/bond-fundamentals)'
|
36
|
+
command 'bulk', 'Historical EOD bulk data (/eod-bulk-last-day)'
|
37
|
+
command 'calendar', 'Calendar data (earnings, trends, IPOs and splits) (/calendar)'
|
38
|
+
command 'data', 'Historical EOD data (/eod)'
|
39
|
+
command 'dividends', 'Dividends data (/div)'
|
40
|
+
command 'events', 'Economic events data (/economic-events)'
|
41
|
+
command 'exchange', 'Details about an exchange (/exchanges-details)'
|
42
|
+
command 'exchanges', 'List of exchanges (/exchanges-list)'
|
43
|
+
command 'fundamental', 'Fundamental data (/fundamentals)'
|
44
|
+
command 'fundamental_bulk', 'Bulk fundamental data (/bulk-fundamentals)'
|
45
|
+
command 'insider', 'Insider transactions data (/insider-transactions)'
|
46
|
+
command 'intraday', 'Intraday data (/intraday)'
|
47
|
+
command 'live', 'Live data (/real-time)'
|
48
|
+
command 'macro', 'Macroeconomics data (/macro-indicator)'
|
49
|
+
command 'news', 'Financial news (/news)'
|
50
|
+
command 'opts', 'Options data (/options)'
|
51
|
+
command 'screener', 'Stock market screener (/screener)'
|
52
|
+
command 'search', 'Search for stocks, ETFs, funds or indices (/search)'
|
53
|
+
command 'splits', 'Splits data (/splits)'
|
54
|
+
command 'symbols', 'List of symbols for an exchange (/exchange-symbol-list)'
|
55
|
+
command 'technical', 'Technical data (/technical)'
|
56
|
+
|
57
|
+
option '-f --format FORMAT', 'Output format: csv, json, yaml, pretty or url [default: pretty]'
|
58
|
+
option '-s --save PATH', 'Save output to file'
|
59
|
+
|
60
|
+
param 'SYMBOL', 'Ticker symbol'
|
61
|
+
param 'CALENDAR', 'Calendar type: earnings, trends, ipos or splits'
|
62
|
+
param 'COUNTRY', 'Country code in the Alpha-3 ISO format'
|
63
|
+
param 'EXCHANGE', 'Exchange code'
|
64
|
+
param 'PARAMS', <<~USAGE
|
65
65
|
An optional list of query string parameters, separated by a space, to send with the request. \
|
66
66
|
Each parameter should be in the format of key:value.
|
67
67
|
example: period:w from:2022-01-01
|
68
68
|
|
69
69
|
See https://eodhistoricaldata.com/financial-apis/ for all supported params.
|
70
|
-
|
71
|
-
|
72
|
-
environment
|
73
|
-
environment
|
74
|
-
environment
|
70
|
+
USAGE
|
71
|
+
|
72
|
+
environment 'EOD_API_TOKEN', 'Your EOD Historical Data API token [required]'
|
73
|
+
environment 'EOD_CACHE_DIR', 'API cache diredctory [default: cache]'
|
74
|
+
environment 'EOD_CACHE_LIFE', <<~USAGE
|
75
75
|
API cache life. These formats are supported:
|
76
76
|
off - No cache
|
77
77
|
20s - 20 seconds
|
78
78
|
10m - 10 minutes
|
79
79
|
10h - 10 hours
|
80
80
|
10d - 10 days
|
81
|
-
|
82
|
-
environment
|
81
|
+
USAGE
|
82
|
+
environment 'EOD_API_URI', "Override the API URI [default: #{EOD::API.base_uri}]"
|
83
83
|
|
84
|
-
example
|
85
|
-
example
|
86
|
-
example
|
87
|
-
example
|
84
|
+
example 'eod symbols NASDAQ'
|
85
|
+
example 'eod data AAPL.US'
|
86
|
+
example 'eod data AAPL.US --format csv period:m from:2022-01-01'
|
87
|
+
example 'eod live AAPL.US -fyaml'
|
88
88
|
example "eod fundamental 'AAPL.US' filter:General"
|
89
|
-
example
|
90
|
-
example
|
89
|
+
example 'eod technical AAPL.US function:sma'
|
90
|
+
example 'eod macro USA indicator:inflation_consumer_prices_annual'
|
91
91
|
|
92
92
|
def bond_command
|
93
93
|
disallow :csv
|
@@ -100,7 +100,7 @@ module EOD
|
|
100
100
|
|
101
101
|
def calendar_command
|
102
102
|
allowed = %w[earnings trends ipos splits]
|
103
|
-
|
103
|
+
|
104
104
|
unless allowed.include? calendar
|
105
105
|
raise InputError, "Invalid calendar #{calendar}. Expecting earnings, trends, ipos or splits"
|
106
106
|
end
|
@@ -117,7 +117,7 @@ module EOD
|
|
117
117
|
end
|
118
118
|
|
119
119
|
def events_command
|
120
|
-
send_output get(
|
120
|
+
send_output get('economic-events')
|
121
121
|
end
|
122
122
|
|
123
123
|
def exchange_command
|
@@ -126,7 +126,7 @@ module EOD
|
|
126
126
|
end
|
127
127
|
|
128
128
|
def exchanges_command
|
129
|
-
send_output get(
|
129
|
+
send_output get('exchanges-list')
|
130
130
|
end
|
131
131
|
|
132
132
|
def fundamental_command
|
@@ -140,7 +140,7 @@ module EOD
|
|
140
140
|
end
|
141
141
|
|
142
142
|
def insider_command
|
143
|
-
send_output get(
|
143
|
+
send_output get('insider-transactions')
|
144
144
|
end
|
145
145
|
|
146
146
|
def intraday_command
|
@@ -157,7 +157,7 @@ module EOD
|
|
157
157
|
|
158
158
|
def news_command
|
159
159
|
disallow :csv
|
160
|
-
send_output get(
|
160
|
+
send_output get('news')
|
161
161
|
end
|
162
162
|
|
163
163
|
def opts_command
|
@@ -166,7 +166,7 @@ module EOD
|
|
166
166
|
end
|
167
167
|
|
168
168
|
def screener_command
|
169
|
-
send_output get(
|
169
|
+
send_output get('screener')
|
170
170
|
end
|
171
171
|
|
172
172
|
def search_command
|
@@ -216,9 +216,9 @@ module EOD
|
|
216
216
|
def api
|
217
217
|
@api ||= begin
|
218
218
|
EOD::API.base_uri ENV['EOD_API_URI'] if ENV['EOD_API_URI']
|
219
|
-
EOD::API.new api_token,
|
220
|
-
use_cache:
|
221
|
-
cache_dir:
|
219
|
+
EOD::API.new api_token,
|
220
|
+
use_cache: (ENV['EOD_CACHE_LIFE'] != 'off'),
|
221
|
+
cache_dir: ENV['EOD_CACHE_DIR'],
|
222
222
|
cache_life: ENV['EOD_CACHE_LIFE']
|
223
223
|
end
|
224
224
|
end
|
@@ -262,6 +262,5 @@ module EOD
|
|
262
262
|
def save
|
263
263
|
args['--save']
|
264
264
|
end
|
265
|
-
|
266
265
|
end
|
267
266
|
end
|
data/lib/eod/exceptions.rb
CHANGED
data/lib/eod/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module EOD
|
2
|
-
VERSION =
|
3
|
-
end
|
2
|
+
VERSION = '0.1.1'
|
3
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: apicake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: lp
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,19 +39,19 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: mister_bin
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.7'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
54
|
+
version: '0.7'
|
55
55
|
description: Easy to use API for eodhistoricaldata.com Data service with a command
|
56
56
|
line interface
|
57
57
|
email: db@dannyben.com
|
@@ -77,6 +77,7 @@ metadata:
|
|
77
77
|
changelog_uri: https://github.com/DannyBen/eod/blob/master/CHANGELOG.md
|
78
78
|
homepage_uri: https://github.com/DannyBen/eod
|
79
79
|
source_code_uri: https://github.com/DannyBen/eod
|
80
|
+
rubygems_mfa_required: 'true'
|
80
81
|
post_install_message:
|
81
82
|
rdoc_options: []
|
82
83
|
require_paths:
|
@@ -92,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
93
|
- !ruby/object:Gem::Version
|
93
94
|
version: '0'
|
94
95
|
requirements: []
|
95
|
-
rubygems_version: 3.
|
96
|
+
rubygems_version: 3.4.9
|
96
97
|
signing_key:
|
97
98
|
specification_version: 4
|
98
99
|
summary: EOD Historical Data API Library and Command Line
|