stockcruncher 1.4.0 → 1.4.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aff25a8077f9f28f5a5a82e91d1f7bc75bebc6c2f84a71b56bc40c003d2ed2fb
|
4
|
+
data.tar.gz: fd3e9d18afdc9b7a2a32353b2a1705e21873b6eec4e53ee1e78fb3adcb6f7456
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39e33d26ee32fd116eaf6421149721a678ffbcbab220c9ffbe00e7e5138320ea5d46e557c62fbdfa201364939764f21568fc9df0e0c8321fc69cc82961c8a7d2
|
7
|
+
data.tar.gz: 121229b80af6b2945acd446dfd2dfa5313ba3f4afaa900c834e1c262c2aa1161808074aad04d6e4a96f40b757f5568a4a3d1c024f64189867b4d2d6b544b1969
|
@@ -49,7 +49,7 @@ module StockCruncher
|
|
49
49
|
def export_history(symbol, timeseries, catchup)
|
50
50
|
tags = create_tags(symbol)
|
51
51
|
if catchup
|
52
|
-
series = get_daily_values(symbol,
|
52
|
+
series = get_daily_values(symbol, true)
|
53
53
|
series['time'].each { |date| timeseries.delete(date) }
|
54
54
|
end
|
55
55
|
timeseries.each_pair do |date, values|
|
@@ -26,12 +26,24 @@ describe StockCruncher::CLI do # rubocop:disable Metrics/BlockLength
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
context 'daily SYM -u -c spec/files/stockcruncher.yml' do
|
30
|
+
it 'Get the daily time serie for SYM.' do
|
31
|
+
expect { start(self) }.to output(daily).to_stdout
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
29
35
|
context 'movingaverages SYM -c spec/files/stockcruncher.yml' do
|
30
36
|
it 'Get the daily time serie for SYM.' do
|
31
37
|
expect { start(self) }.to output('').to_stdout
|
32
38
|
end
|
33
39
|
end
|
34
40
|
|
41
|
+
context 'movingaverages SYM -u -c spec/files/stockcruncher.yml' do
|
42
|
+
it 'Get the daily time serie for SYM.' do
|
43
|
+
expect { start(self) }.to output('').to_stdout
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
35
47
|
context 'quote NODATA -c spec/files/stockcruncher.yml' do
|
36
48
|
it 'Should not get any data and should fail.' do
|
37
49
|
expect { start(self) }.to raise_error(SystemExit)
|
@@ -12,6 +12,10 @@ daily = "timestamp,open,high,low,close,volume\r\n2020-08-03,23.8500,24.6500," \
|
|
12
12
|
"\n2020-07-29,24.7500,25.0300,24.0400,24.5600,4605804\r\n2020-07-28," \
|
13
13
|
"25.9900,26.0700,24.5100,24.7500,6904261\r\n"
|
14
14
|
d_err = "{\n \"Error Message\": \"Invalid API call.\"\n}"
|
15
|
+
i_ema = "q=SELECT ema200 FROM ema WHERE symbol = 'SYM' ORDER BY time DESC"
|
16
|
+
maval = '{"results":[{"statement_id":0,"series":[{"name":"ema","columns":[' \
|
17
|
+
'"time","ema200"],"values":[["2017-' \
|
18
|
+
'03-01T18:00:00Z",1]]}]}]}'
|
15
19
|
mvavg = '{"results":[{"statement_id":0,"series":[{"name":"daily","columns":[' \
|
16
20
|
'"time","close","change","changePercent","volume"],"values":[["2017-' \
|
17
21
|
'03-01T18:00:00Z",1,0,0,1],["2017-03-02T18:00:00Z",1,0,0,1],["2017-0' \
|
@@ -35,6 +39,9 @@ RSpec.configure do |config|
|
|
35
39
|
'function=TIME_SERIES_DAILY&symbol=SYM&apikey=demo' \
|
36
40
|
'&datatype=csv&outputsize=compact')
|
37
41
|
.to_return('status' => 200, 'body' => daily, 'headers' => {})
|
42
|
+
stub_request(:post, 'http://localhost:8086/query?db=test')
|
43
|
+
.with(body: i_ema)
|
44
|
+
.to_return('status' => 204, 'body' => maval, 'headers' => {})
|
38
45
|
stub_request(:post, 'http://localhost:8086/query?db=test')
|
39
46
|
.to_return('status' => 204, 'body' => mvavg, 'headers' => {})
|
40
47
|
stub_request(:post, 'http://localhost:8086/write?db=test')
|