alphavantagerb 1.0.0
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 +7 -0
- data/AlphavantageRB.gemspec +19 -0
- data/Gemfile +10 -0
- data/LICENSE.md +21 -0
- data/README.md +778 -0
- data/lib/Client.rb +70 -0
- data/lib/Crypto.rb +26 -0
- data/lib/Crypto_Timeseries.rb +67 -0
- data/lib/Errors.rb +9 -0
- data/lib/Exchange.rb +23 -0
- data/lib/Indicator.rb +135 -0
- data/lib/Sector.rb +34 -0
- data/lib/Stock.rb +49 -0
- data/lib/Timeseries.rb +76 -0
- data/lib/alphavantagerb.rb +13 -0
- data/lib/helper_function.rb +72 -0
- data/spec/config.yml +2 -0
- data/spec/lib/1.0.0/client.rb +44 -0
- data/spec/lib/1.0.0/crypto.rb +36 -0
- data/spec/lib/1.0.0/crypto_timeseries.rb +59 -0
- data/spec/lib/1.0.0/exchange.rb +49 -0
- data/spec/lib/1.0.0/indicator.rb +719 -0
- data/spec/lib/1.0.0/sector.rb +44 -0
- data/spec/lib/1.0.0/stock.rb +42 -0
- data/spec/lib/1.0.0/timeseries.rb +101 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/test_all.rb +8 -0
- metadata +98 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
require "httparty"
|
2
|
+
require "humanize"
|
3
|
+
require "open-uri"
|
4
|
+
require_relative "helper_function"
|
5
|
+
require_relative "Timeseries"
|
6
|
+
require_relative "Indicator"
|
7
|
+
require_relative "Stock"
|
8
|
+
require_relative "Errors"
|
9
|
+
require_relative "Exchange"
|
10
|
+
require_relative "Crypto"
|
11
|
+
require_relative "Crypto_Timeseries"
|
12
|
+
require_relative "Sector"
|
13
|
+
require_relative "Client"
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module HelperFunctions
|
2
|
+
def method_missing(method, *args, &block)
|
3
|
+
raise Alphavantage::Error.new message: "#{method} is undefined for #{self.class}"
|
4
|
+
end
|
5
|
+
|
6
|
+
def check_argument(list, value, attribute)
|
7
|
+
unless list.include? value
|
8
|
+
list.each{|l| l = "nil" if l.nil?}
|
9
|
+
raise Alphavantage::Error.new message: "Only #{list.join(", ")} are supported for #{attribute}",
|
10
|
+
data: {"list_valid" => list, "wrong_value" => value, "wrong_attribute" => attribute}
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def return_matype(val, val_string)
|
15
|
+
check_argument(["0", "1", "2", "3", "4", "5", "6", "7", "8", "SMA", "EMA", "WMA", "DEMA", "TEMA", "TRIMA", "T3", "KAMA", "MAMA"], val, "ma_type")
|
16
|
+
hash = {"SMA" => "0", "EMA" => "1", "WMA" => "2", "DEMA" => "3",
|
17
|
+
"TEMA" => "4", "TRIMA" => "5", "T3" => "6", "KAMA" => "7", "MAMA" => "8"}
|
18
|
+
val = hash[val] unless hash[val].nil?
|
19
|
+
return "&#{val_string}=#{val}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def return_int_val(val, val_string, type="integer", check_positivity=true)
|
23
|
+
value = case type
|
24
|
+
when "integer"
|
25
|
+
val.to_i
|
26
|
+
when "float"
|
27
|
+
val.to_f
|
28
|
+
end
|
29
|
+
if value.to_s != val
|
30
|
+
Alphavantage::Error.new message: "Error: #{val_string} is not a correct number"
|
31
|
+
elsif check_positivity && value <= 0
|
32
|
+
Alphavantage::Error.new message: "Error: #{val_string} is not a correct positive #{type}"
|
33
|
+
end
|
34
|
+
return "&#{val_string}=#{val}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def return_client(key, verbose=false)
|
38
|
+
if key.is_a?(String)
|
39
|
+
client = Alphavantage::Client.new key: key, verbose: verbose
|
40
|
+
elsif key.is_a?(Alphavantage::Client)
|
41
|
+
client = key
|
42
|
+
else
|
43
|
+
raise Alphavantage::Error.new message: "Key should be a string"
|
44
|
+
end
|
45
|
+
return client
|
46
|
+
end
|
47
|
+
|
48
|
+
def return_value(hash, val)
|
49
|
+
return hash.find{|key, value| key.include?(val)}&.dig(1)
|
50
|
+
end
|
51
|
+
|
52
|
+
def return_series(series, order)
|
53
|
+
order ||= "desc"
|
54
|
+
check_argument(["asc", "desc"], order, "order")
|
55
|
+
return series.sort_by{ |hsh| hsh[0]} if order == "asc"
|
56
|
+
return series
|
57
|
+
end
|
58
|
+
|
59
|
+
def recreate_metadata_key(key)
|
60
|
+
key_sym = key.split(" ")
|
61
|
+
key_sym.shift if key_sym.size > 1
|
62
|
+
if key_sym[-1] == "(USD)"
|
63
|
+
key_sym[-1] = "USD"
|
64
|
+
elsif key_sym[-1].include?("(") && key_sym[-1].include?(")")
|
65
|
+
key_sym.pop
|
66
|
+
end
|
67
|
+
key_sym = key_sym.join("_")
|
68
|
+
key_sym = key_sym.downcase.lstrip.gsub(" ", "_")
|
69
|
+
key_sym = key_sym.to_sym
|
70
|
+
return key_sym
|
71
|
+
end
|
72
|
+
end
|
data/spec/config.yml
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require_relative './../../spec_helper'
|
2
|
+
|
3
|
+
describe Alphavantage::Client do
|
4
|
+
context "#new" do
|
5
|
+
it "create a new client" do
|
6
|
+
client = Alphavantage::Client.new key: @config["key"]
|
7
|
+
expect(client.class).to eq Alphavantage::Client
|
8
|
+
end
|
9
|
+
|
10
|
+
it "can change verbose" do
|
11
|
+
bool = []
|
12
|
+
bool << @client.verbose
|
13
|
+
begin
|
14
|
+
@client.verbose = "ciao"
|
15
|
+
rescue Alphavantage::Error => e
|
16
|
+
bool << "error"
|
17
|
+
end
|
18
|
+
@client.verbose = true
|
19
|
+
bool << @client.verbose
|
20
|
+
@client.verbose = false
|
21
|
+
expect(bool).to eq [false, "error", true]
|
22
|
+
end
|
23
|
+
|
24
|
+
it "can create a new stock from client" do
|
25
|
+
stock = @client.stock symbol: "MSFT"
|
26
|
+
expect(stock.class).to eq Alphavantage::Stock
|
27
|
+
end
|
28
|
+
|
29
|
+
it "can create a new exchange from client" do
|
30
|
+
sleep(1); exchange = @client.exchange from: "USD", to: "DKK"
|
31
|
+
expect(exchange.class).to eq Alphavantage::Exchange
|
32
|
+
end
|
33
|
+
|
34
|
+
it "can create a new crypto from client" do
|
35
|
+
crypto = @client.crypto symbol: "BTC", market: "DKK"
|
36
|
+
expect(crypto.class).to eq Alphavantage::Crypto
|
37
|
+
end
|
38
|
+
|
39
|
+
it "can create a new sector from client" do
|
40
|
+
sleep(1); sector = @client.sector
|
41
|
+
expect(sector.class).to eq Alphavantage::Sector
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require_relative './../../spec_helper'
|
2
|
+
|
3
|
+
describe Alphavantage::Crypto do
|
4
|
+
context "#new" do
|
5
|
+
it "create a new crypto without client" do
|
6
|
+
stock = Alphavantage::Crypto.new symbol: "BTC", key: @config["key"], market: "DKK"
|
7
|
+
expect(stock.class).to eq Alphavantage::Crypto
|
8
|
+
end
|
9
|
+
|
10
|
+
it "create a new stock from client" do
|
11
|
+
crypto = @client.crypto symbol: "BTC", market: "DKK"
|
12
|
+
expect(crypto.class).to eq Alphavantage::Crypto
|
13
|
+
end
|
14
|
+
|
15
|
+
it "can change datatype" do
|
16
|
+
bool = []
|
17
|
+
stock = @client.crypto symbol: "BTC", market: "DKK"
|
18
|
+
bool << stock.datatype
|
19
|
+
begin
|
20
|
+
stock.datatype = "ciao"
|
21
|
+
rescue Alphavantage::Error => e
|
22
|
+
bool << "error"
|
23
|
+
end
|
24
|
+
stock.datatype = "csv"
|
25
|
+
bool <<stock.datatype
|
26
|
+
stock.datatype = "json"
|
27
|
+
expect(bool).to eq ["json", "error", "csv"]
|
28
|
+
end
|
29
|
+
|
30
|
+
it "can create a new timeseries from stock" do
|
31
|
+
stock = @client.crypto symbol: "BTC", market: "DKK"
|
32
|
+
timeseries = stock.timeseries
|
33
|
+
expect(timeseries.class).to eq Alphavantage::Crypto_Timeseries
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require_relative './../../spec_helper'
|
2
|
+
|
3
|
+
describe Alphavantage::Crypto_Timeseries do
|
4
|
+
context "#new" do
|
5
|
+
it "create a new timeseries without stock" do
|
6
|
+
sleep(1); stock = Alphavantage::Crypto_Timeseries.new symbol: "BTC", key: @config["key"], verbose: false, market: "DKK", type: "daily"
|
7
|
+
expect(stock.class).to eq Alphavantage::Crypto_Timeseries
|
8
|
+
end
|
9
|
+
|
10
|
+
it "create a new stock from stock" do
|
11
|
+
sleep(1); timeseries = @client.crypto(symbol: "BTC", market: "DKK").timeseries(type: "monthly")
|
12
|
+
expect(timeseries.class).to eq Alphavantage::Crypto_Timeseries
|
13
|
+
end
|
14
|
+
|
15
|
+
it "own multiple data" do
|
16
|
+
sleep(1); timeseries = @client.crypto(symbol: "BTC", market: "DKK").timeseries(type: "monthly")
|
17
|
+
bool = []
|
18
|
+
bool << timeseries.information.is_a?(String)
|
19
|
+
bool << (timeseries.digital_currency_code == "BTC")
|
20
|
+
bool << timeseries.digital_currency_name.is_a?(String)
|
21
|
+
bool << (timeseries.market_code == "DKK")
|
22
|
+
bool << timeseries.market_name.is_a?(String)
|
23
|
+
bool << timeseries.last_refreshed.is_a?(String)
|
24
|
+
bool << timeseries.time_zone.is_a?(String)
|
25
|
+
bool << timeseries.hash.is_a?(Hash)
|
26
|
+
bool << timeseries.open.is_a?(Array)
|
27
|
+
bool << timeseries.high.is_a?(Array)
|
28
|
+
bool << timeseries.low.is_a?(Array)
|
29
|
+
bool << timeseries.close.is_a?(Array)
|
30
|
+
bool << timeseries.volume("asc").is_a?(Array)
|
31
|
+
bool << timeseries.open_usd.is_a?(Array)
|
32
|
+
bool << timeseries.high_usd.is_a?(Array)
|
33
|
+
bool << timeseries.low_usd.is_a?(Array)
|
34
|
+
bool << timeseries.close_usd.is_a?(Array)
|
35
|
+
bool << timeseries.market_cap_usd.is_a?(Array)
|
36
|
+
expect(bool.all?{|e| e}).to eq true
|
37
|
+
end
|
38
|
+
|
39
|
+
it "cannot retrieve with wrong key" do
|
40
|
+
error = false
|
41
|
+
begin
|
42
|
+
sleep(1); stock = Alphavantage::Crypto_Timeseries.new symbol: "BTC", key: "wrong_key", market: "DKK", type: "daily"
|
43
|
+
rescue Alphavantage::Error => e
|
44
|
+
error = true
|
45
|
+
end
|
46
|
+
expect(error).to eq true
|
47
|
+
end
|
48
|
+
|
49
|
+
it "cannot retrieve with wrong symbol" do
|
50
|
+
error = false
|
51
|
+
begin
|
52
|
+
sleep(1); stock = Alphavantage::Crypto_Timeseries.new symbol: "wrong_symbol", key: @config["key"], market: "DKK", type: "daily"
|
53
|
+
rescue Alphavantage::Error => e
|
54
|
+
error = true
|
55
|
+
end
|
56
|
+
expect(error).to eq true
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require_relative './../../spec_helper'
|
2
|
+
|
3
|
+
describe Alphavantage::Exchange do
|
4
|
+
context "#new" do
|
5
|
+
it "create a new exchange without client" do
|
6
|
+
sleep(1); exchange = Alphavantage::Exchange.new from: "USD", to: "DKK", key: @config["key"]
|
7
|
+
expect(exchange.class).to eq Alphavantage::Exchange
|
8
|
+
end
|
9
|
+
|
10
|
+
it "create a new exchange with client" do
|
11
|
+
sleep(1); exchange = @client.exchange from: "USD", to: "DKK"
|
12
|
+
expect(exchange.class).to eq Alphavantage::Exchange
|
13
|
+
end
|
14
|
+
|
15
|
+
it "has several parameters" do
|
16
|
+
sleep(1); exchange = @client.exchange from: "USD", to: "DKK"
|
17
|
+
bool = []
|
18
|
+
bool << (exchange.from_currency_code == "USD")
|
19
|
+
bool << exchange.from_currency_name.is_a?(String)
|
20
|
+
bool << (exchange.to_currency_code == "DKK")
|
21
|
+
bool << exchange.to_currency_name.is_a?(String)
|
22
|
+
bool << exchange.exchange_rate.is_a?(String)
|
23
|
+
bool << exchange.last_refreshed.is_a?(String)
|
24
|
+
bool << exchange.time_zone.is_a?(String)
|
25
|
+
bool << exchange.hash.is_a?(Hash)
|
26
|
+
expect(bool.all?{|e| e}).to eq true
|
27
|
+
end
|
28
|
+
|
29
|
+
it "cannot retrieve with wrong key" do
|
30
|
+
error = false
|
31
|
+
begin
|
32
|
+
sleep(1); stock = Alphavantage::Exchange.new from: "USD", to: "DKK", key:"wrong_key"
|
33
|
+
rescue Alphavantage::Error => e
|
34
|
+
error = true
|
35
|
+
end
|
36
|
+
expect(error).to eq true
|
37
|
+
end
|
38
|
+
|
39
|
+
it "cannot retrieve with wrong symbol" do
|
40
|
+
error = false
|
41
|
+
begin
|
42
|
+
sleep(1); stock = Alphavantage::Exchange.new from: "wrong_from", to: "DKK", key: @config["key"]
|
43
|
+
rescue Alphavantage::Error => e
|
44
|
+
error = true
|
45
|
+
end
|
46
|
+
expect(error).to eq true
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,719 @@
|
|
1
|
+
require_relative './../../spec_helper'
|
2
|
+
|
3
|
+
describe Alphavantage::Indicator do
|
4
|
+
context "#new" do
|
5
|
+
it "create a new indicator without stock" do
|
6
|
+
sleep(1); indicator = Alphavantage::Indicator.new function: "SMA", symbol: "MSFT", key: @config["key"], verbose: false
|
7
|
+
expect(indicator.class).to eq Alphavantage::Indicator
|
8
|
+
end
|
9
|
+
|
10
|
+
it "create a new stock from stock" do
|
11
|
+
sleep(1); indicator = @client.stock(symbol: "MSFT").indicator(function: "SMA")
|
12
|
+
expect(indicator.class).to eq Alphavantage::Indicator
|
13
|
+
end
|
14
|
+
|
15
|
+
it "can be indicator SMA" do
|
16
|
+
bool = []
|
17
|
+
sleep(1); indicator = @stock.indicator(function: "SMA", interval: "weekly", time_period: "60", series_type: "close")
|
18
|
+
bool << (indicator.symbol == "MSFT")
|
19
|
+
bool << indicator.indicator.is_a?(String)
|
20
|
+
bool << indicator.last_refreshed.is_a?(String)
|
21
|
+
bool << (indicator.interval == "weekly")
|
22
|
+
bool << indicator.series_type.is_a?(String)
|
23
|
+
bool << indicator.time_period.is_a?(Fixnum)
|
24
|
+
bool << indicator.time_zone.is_a?(String)
|
25
|
+
bool << indicator.sma.is_a?(Array)
|
26
|
+
expect(bool.all?{|e| e}).to eq true
|
27
|
+
end
|
28
|
+
|
29
|
+
it "can be indicator EMA" do
|
30
|
+
bool = []
|
31
|
+
sleep(1); indicator = @stock.indicator(function: "EMA", interval: "weekly", time_period: "60", series_type: "close")
|
32
|
+
bool << (indicator.symbol == "MSFT")
|
33
|
+
bool << indicator.indicator.is_a?(String)
|
34
|
+
bool << indicator.last_refreshed.is_a?(String)
|
35
|
+
bool << (indicator.interval == "weekly")
|
36
|
+
bool << indicator.series_type.is_a?(String)
|
37
|
+
bool << indicator.time_zone.is_a?(String)
|
38
|
+
bool << indicator.ema.is_a?(Array)
|
39
|
+
expect(bool.all?{|e| e}).to eq true
|
40
|
+
end
|
41
|
+
|
42
|
+
it "can be indicator WMA" do
|
43
|
+
bool = []
|
44
|
+
sleep(1); indicator = @stock.indicator(function: "WMA", interval: "weekly", time_period: "60", series_type: "close")
|
45
|
+
bool << (indicator.symbol == "MSFT")
|
46
|
+
bool << indicator.indicator.is_a?(String)
|
47
|
+
bool << indicator.last_refreshed.is_a?(String)
|
48
|
+
bool << (indicator.interval == "weekly")
|
49
|
+
bool << indicator.series_type.is_a?(String)
|
50
|
+
bool << indicator.time_zone.is_a?(String)
|
51
|
+
bool << indicator.wma.is_a?(Array)
|
52
|
+
expect(bool.all?{|e| e}).to eq true
|
53
|
+
end
|
54
|
+
|
55
|
+
it "can be indicator DEMA" do
|
56
|
+
bool = []
|
57
|
+
sleep(1); indicator = @stock.indicator(function: "DEMA", interval: "weekly", time_period: "60", series_type: "close")
|
58
|
+
bool << (indicator.symbol == "MSFT")
|
59
|
+
bool << indicator.indicator.is_a?(String)
|
60
|
+
bool << indicator.last_refreshed.is_a?(String)
|
61
|
+
bool << (indicator.interval == "weekly")
|
62
|
+
bool << indicator.series_type.is_a?(String)
|
63
|
+
bool << indicator.time_zone.is_a?(String)
|
64
|
+
bool << indicator.dema.is_a?(Array)
|
65
|
+
expect(bool.all?{|e| e}).to eq true
|
66
|
+
end
|
67
|
+
|
68
|
+
it "can be indicator TEMA" do
|
69
|
+
bool = []
|
70
|
+
sleep(1); indicator = @stock.indicator(function: "TEMA", interval: "weekly", time_period: "60", series_type: "close")
|
71
|
+
bool << (indicator.symbol == "MSFT")
|
72
|
+
bool << indicator.indicator.is_a?(String)
|
73
|
+
bool << indicator.last_refreshed.is_a?(String)
|
74
|
+
bool << (indicator.interval == "weekly")
|
75
|
+
bool << indicator.series_type.is_a?(String)
|
76
|
+
bool << indicator.time_zone.is_a?(String)
|
77
|
+
bool << indicator.tema.is_a?(Array)
|
78
|
+
expect(bool.all?{|e| e}).to eq true
|
79
|
+
end
|
80
|
+
|
81
|
+
it "can be indicator TRIMA" do
|
82
|
+
bool = []
|
83
|
+
sleep(1); indicator = @stock.indicator(function: "TRIMA", interval: "weekly", time_period: "60", series_type: "close")
|
84
|
+
bool << (indicator.symbol == "MSFT")
|
85
|
+
bool << indicator.indicator.is_a?(String)
|
86
|
+
bool << indicator.last_refreshed.is_a?(String)
|
87
|
+
bool << (indicator.interval == "weekly")
|
88
|
+
bool << indicator.series_type.is_a?(String)
|
89
|
+
bool << indicator.time_zone.is_a?(String)
|
90
|
+
bool << indicator.trima.is_a?(Array)
|
91
|
+
expect(bool.all?{|e| e}).to eq true
|
92
|
+
end
|
93
|
+
|
94
|
+
it "can be indicator KAMA" do
|
95
|
+
bool = []
|
96
|
+
sleep(1); indicator = @stock.indicator(function: "KAMA", interval: "weekly", time_period: "60", series_type: "close")
|
97
|
+
bool << (indicator.symbol == "MSFT")
|
98
|
+
bool << indicator.indicator.is_a?(String)
|
99
|
+
bool << indicator.last_refreshed.is_a?(String)
|
100
|
+
bool << (indicator.interval == "weekly")
|
101
|
+
bool << indicator.series_type.is_a?(String)
|
102
|
+
bool << indicator.time_zone.is_a?(String)
|
103
|
+
bool << indicator.kama.is_a?(Array)
|
104
|
+
expect(bool.all?{|e| e}).to eq true
|
105
|
+
end
|
106
|
+
|
107
|
+
it "can be indicator MAMA" do
|
108
|
+
bool = []
|
109
|
+
sleep(1); indicator = @stock.indicator(function: "MAMA", interval: "weekly", series_type: "close", fastlimit: "0.02", slowlimit: "0.01")
|
110
|
+
bool << (indicator.symbol == "MSFT")
|
111
|
+
bool << indicator.indicator.is_a?(String)
|
112
|
+
bool << indicator.last_refreshed.is_a?(String)
|
113
|
+
bool << (indicator.interval == "weekly")
|
114
|
+
bool << (indicator.fast_limit == 0.02)
|
115
|
+
bool << (indicator.slow_limit == 0.01)
|
116
|
+
bool << indicator.series_type.is_a?(String)
|
117
|
+
bool << indicator.time_zone.is_a?(String)
|
118
|
+
bool << indicator.fama.is_a?(Array)
|
119
|
+
bool << indicator.mama.is_a?(Array)
|
120
|
+
expect(bool.all?{|e| e}).to eq true
|
121
|
+
end
|
122
|
+
|
123
|
+
it "can be indicator T3" do
|
124
|
+
bool = []
|
125
|
+
sleep(1); indicator = @stock.indicator(function: "T3", interval: "weekly", time_period: "60", series_type: "close")
|
126
|
+
bool << (indicator.symbol == "MSFT")
|
127
|
+
bool << indicator.indicator.is_a?(String)
|
128
|
+
bool << indicator.last_refreshed.is_a?(String)
|
129
|
+
bool << (indicator.interval == "weekly")
|
130
|
+
bool << indicator.volume_factor.is_a?(Float)
|
131
|
+
bool << indicator.series_type.is_a?(String)
|
132
|
+
bool << indicator.time_zone.is_a?(String)
|
133
|
+
bool << indicator.t3.is_a?(Array)
|
134
|
+
expect(bool.all?{|e| e}).to eq true
|
135
|
+
end
|
136
|
+
|
137
|
+
it "can be indicator MACD" do
|
138
|
+
bool = []
|
139
|
+
sleep(1); indicator = @stock.indicator(function: "MACD", interval: "weekly", time_period: "60", series_type: "close", fastperiod: "12", slowperiod: "26", signalperiod: "9")
|
140
|
+
bool << (indicator.symbol == "MSFT")
|
141
|
+
bool << indicator.indicator.is_a?(String)
|
142
|
+
bool << indicator.last_refreshed.is_a?(String)
|
143
|
+
bool << (indicator.interval == "weekly")
|
144
|
+
bool << indicator.fast_period.is_a?(Fixnum)
|
145
|
+
bool << indicator.slow_period.is_a?(Fixnum)
|
146
|
+
bool << indicator.signal_period.is_a?(Fixnum)
|
147
|
+
bool << indicator.series_type.is_a?(String)
|
148
|
+
bool << indicator.time_zone.is_a?(String)
|
149
|
+
bool << indicator.macd_signal.is_a?(Array)
|
150
|
+
bool << indicator.macd_hist.is_a?(Array)
|
151
|
+
bool << indicator.macd.is_a?(Array)
|
152
|
+
expect(bool.all?{|e| e}).to eq true
|
153
|
+
end
|
154
|
+
|
155
|
+
it "can be indicator MACDEXT" do
|
156
|
+
bool = []
|
157
|
+
sleep(1); indicator = @stock.indicator(function: "MACDEXT", interval: "weekly", time_period: "60", series_type: "close", fastperiod: "12", slowperiod: "26", signalperiod: "9", fastmatype: "0", slowmatype: "0", signalmatype: "0")
|
158
|
+
bool << (indicator.symbol == "MSFT")
|
159
|
+
bool << indicator.indicator.is_a?(String)
|
160
|
+
bool << indicator.last_refreshed.is_a?(String)
|
161
|
+
bool << (indicator.interval == "weekly")
|
162
|
+
bool << indicator.fast_period.is_a?(Fixnum)
|
163
|
+
bool << indicator.slow_period.is_a?(Fixnum)
|
164
|
+
bool << indicator.signal_period.is_a?(Fixnum)
|
165
|
+
bool << indicator.series_type.is_a?(String)
|
166
|
+
bool << indicator.signal_ma_type.is_a?(Fixnum)
|
167
|
+
bool << indicator.fast_ma_type.is_a?(Fixnum)
|
168
|
+
bool << indicator.slow_ma_type.is_a?(Fixnum)
|
169
|
+
bool << indicator.time_zone.is_a?(String)
|
170
|
+
bool << indicator.macd_signal.is_a?(Array)
|
171
|
+
bool << indicator.macd_hist.is_a?(Array)
|
172
|
+
bool << indicator.macd.is_a?(Array)
|
173
|
+
expect(bool.all?{|e| e}).to eq true
|
174
|
+
end
|
175
|
+
|
176
|
+
it "can be indicator STOCH" do
|
177
|
+
bool = []
|
178
|
+
sleep(1); indicator = @stock.indicator(function: "STOCH", interval: "weekly", fastkperiod: "5", slowkperiod: "3", slowdperiod: "3", slowkmatype: "0", slowdmatype: "0")
|
179
|
+
bool << (indicator.symbol == "MSFT")
|
180
|
+
bool << indicator.indicator.is_a?(String)
|
181
|
+
bool << indicator.last_refreshed.is_a?(String)
|
182
|
+
bool << (indicator.interval == "weekly")
|
183
|
+
bool << indicator.fastk_period.is_a?(Fixnum)
|
184
|
+
bool << indicator.slowk_period.is_a?(Fixnum)
|
185
|
+
bool << indicator.slowk_ma_type.is_a?(Fixnum)
|
186
|
+
bool << indicator.slowd_period.is_a?(Fixnum)
|
187
|
+
bool << indicator.slowd_ma_type.is_a?(Fixnum)
|
188
|
+
bool << indicator.time_zone.is_a?(String)
|
189
|
+
bool << indicator.slowk.is_a?(Array)
|
190
|
+
bool << indicator.slowd.is_a?(Array)
|
191
|
+
expect(bool.all?{|e| e}).to eq true
|
192
|
+
end
|
193
|
+
|
194
|
+
it "can be indicator STOCHF" do
|
195
|
+
bool = []
|
196
|
+
sleep(1); indicator = @stock.indicator(function: "STOCHF", interval: "weekly", fastkperiod: "5", fastdperiod: "3", fastdmatype: "0")
|
197
|
+
bool << (indicator.symbol == "MSFT")
|
198
|
+
bool << indicator.indicator.is_a?(String)
|
199
|
+
bool << indicator.last_refreshed.is_a?(String)
|
200
|
+
bool << (indicator.interval == "weekly")
|
201
|
+
bool << indicator.fastk_period.is_a?(Fixnum)
|
202
|
+
bool << indicator.fastd_period.is_a?(Fixnum)
|
203
|
+
bool << indicator.fastd_ma_type.is_a?(Fixnum)
|
204
|
+
bool << indicator.time_zone.is_a?(String)
|
205
|
+
bool << indicator.fastk.is_a?(Array)
|
206
|
+
bool << indicator.fastd.is_a?(Array)
|
207
|
+
expect(bool.all?{|e| e}).to eq true
|
208
|
+
end
|
209
|
+
|
210
|
+
it "can be indicator RSI" do
|
211
|
+
bool = []
|
212
|
+
sleep(1); indicator = @stock.indicator(function: "RSI", interval: "weekly", time_period: "60", series_type: "close")
|
213
|
+
bool << (indicator.symbol == "MSFT")
|
214
|
+
bool << indicator.indicator.is_a?(String)
|
215
|
+
bool << indicator.last_refreshed.is_a?(String)
|
216
|
+
bool << (indicator.interval == "weekly")
|
217
|
+
bool << indicator.series_type.is_a?(String)
|
218
|
+
bool << indicator.time_zone.is_a?(String)
|
219
|
+
bool << indicator.rsi.is_a?(Array)
|
220
|
+
expect(bool.all?{|e| e}).to eq true
|
221
|
+
end
|
222
|
+
|
223
|
+
it "can be indicator STOCHRSI" do
|
224
|
+
bool = []
|
225
|
+
sleep(1); indicator = @stock.indicator(function: "STOCHRSI", interval: "weekly", time_period: "60", fastkperiod: "5", fastdperiod: "3", fastdmatype: "0")
|
226
|
+
bool << (indicator.symbol == "MSFT")
|
227
|
+
bool << indicator.indicator.is_a?(String)
|
228
|
+
bool << indicator.last_refreshed.is_a?(String)
|
229
|
+
bool << (indicator.interval == "weekly")
|
230
|
+
bool << indicator.fastk_period.is_a?(Fixnum)
|
231
|
+
bool << indicator.fastd_period.is_a?(Fixnum)
|
232
|
+
bool << indicator.fastd_ma_type.is_a?(Fixnum)
|
233
|
+
bool << indicator.time_zone.is_a?(String)
|
234
|
+
bool << indicator.fastk.is_a?(Array)
|
235
|
+
bool << indicator.fastd.is_a?(Array)
|
236
|
+
expect(bool.all?{|e| e}).to eq true
|
237
|
+
end
|
238
|
+
|
239
|
+
it "can be indicator WILLR" do
|
240
|
+
bool = []
|
241
|
+
sleep(1); indicator = @stock.indicator(function: "WILLR", interval: "weekly", time_period: "60")
|
242
|
+
bool << (indicator.symbol == "MSFT")
|
243
|
+
bool << indicator.indicator.is_a?(String)
|
244
|
+
bool << indicator.last_refreshed.is_a?(String)
|
245
|
+
bool << (indicator.interval == "weekly")
|
246
|
+
bool << indicator.time_zone.is_a?(String)
|
247
|
+
bool << indicator.willr.is_a?(Array)
|
248
|
+
expect(bool.all?{|e| e}).to eq true
|
249
|
+
end
|
250
|
+
|
251
|
+
it "can be indicator ADX" do
|
252
|
+
bool = []
|
253
|
+
sleep(1); indicator = @stock.indicator(function: "ADX", interval: "weekly", time_period: "60")
|
254
|
+
bool << (indicator.symbol == "MSFT")
|
255
|
+
bool << indicator.indicator.is_a?(String)
|
256
|
+
bool << indicator.last_refreshed.is_a?(String)
|
257
|
+
bool << (indicator.interval == "weekly")
|
258
|
+
bool << indicator.time_zone.is_a?(String)
|
259
|
+
bool << indicator.adx.is_a?(Array)
|
260
|
+
expect(bool.all?{|e| e}).to eq true
|
261
|
+
end
|
262
|
+
|
263
|
+
it "can be indicator ADXR" do
|
264
|
+
bool = []
|
265
|
+
sleep(1); indicator = @stock.indicator(function: "ADXR", interval: "weekly", time_period: "60")
|
266
|
+
bool << (indicator.symbol == "MSFT")
|
267
|
+
bool << indicator.indicator.is_a?(String)
|
268
|
+
bool << indicator.last_refreshed.is_a?(String)
|
269
|
+
bool << (indicator.interval == "weekly")
|
270
|
+
bool << indicator.time_zone.is_a?(String)
|
271
|
+
bool << indicator.adxr.is_a?(Array)
|
272
|
+
expect(bool.all?{|e| e}).to eq true
|
273
|
+
end
|
274
|
+
|
275
|
+
it "can be indicator APO" do
|
276
|
+
bool = []
|
277
|
+
sleep(1); indicator = @stock.indicator(function: "APO", interval: "weekly", series_type: "close", fastperiod: "12", slowperiod: "26", signalperiod: "9", matype: "0")
|
278
|
+
bool << (indicator.symbol == "MSFT")
|
279
|
+
bool << indicator.indicator.is_a?(String)
|
280
|
+
bool << indicator.last_refreshed.is_a?(String)
|
281
|
+
bool << (indicator.interval == "weekly")
|
282
|
+
bool << indicator.fast_period.is_a?(Fixnum)
|
283
|
+
bool << indicator.slow_period.is_a?(Fixnum)
|
284
|
+
bool << indicator.ma_type.is_a?(Fixnum)
|
285
|
+
bool << indicator.series_type.is_a?(String)
|
286
|
+
bool << indicator.time_zone.is_a?(String)
|
287
|
+
bool << indicator.apo.is_a?(Array)
|
288
|
+
expect(bool.all?{|e| e}).to eq true
|
289
|
+
end
|
290
|
+
|
291
|
+
it "can be indicator PPO" do
|
292
|
+
bool = []
|
293
|
+
sleep(1); indicator = @stock.indicator(function: "PPO", interval: "weekly", series_type: "close", fastperiod: "12", slowperiod: "26", signalperiod: "9", matype: "0")
|
294
|
+
bool << (indicator.symbol == "MSFT")
|
295
|
+
bool << indicator.indicator.is_a?(String)
|
296
|
+
bool << indicator.last_refreshed.is_a?(String)
|
297
|
+
bool << (indicator.interval == "weekly")
|
298
|
+
bool << indicator.fast_period.is_a?(Fixnum)
|
299
|
+
bool << indicator.slow_period.is_a?(Fixnum)
|
300
|
+
bool << indicator.ma_type.is_a?(Fixnum)
|
301
|
+
bool << indicator.series_type.is_a?(String)
|
302
|
+
bool << indicator.time_zone.is_a?(String)
|
303
|
+
bool << indicator.ppo.is_a?(Array)
|
304
|
+
expect(bool.all?{|e| e}).to eq true
|
305
|
+
end
|
306
|
+
|
307
|
+
it "can be indicator MOM" do
|
308
|
+
bool = []
|
309
|
+
sleep(1); indicator = @stock.indicator(function: "MOM", interval: "weekly", time_period: "60", series_type: "close")
|
310
|
+
bool << (indicator.symbol == "MSFT")
|
311
|
+
bool << indicator.indicator.is_a?(String)
|
312
|
+
bool << indicator.last_refreshed.is_a?(String)
|
313
|
+
bool << (indicator.interval == "weekly")
|
314
|
+
bool << indicator.series_type.is_a?(String)
|
315
|
+
bool << indicator.time_zone.is_a?(String)
|
316
|
+
bool << indicator.mom.is_a?(Array)
|
317
|
+
expect(bool.all?{|e| e}).to eq true
|
318
|
+
end
|
319
|
+
|
320
|
+
it "can be indicator BOP" do
|
321
|
+
bool = []
|
322
|
+
sleep(1); indicator = @stock.indicator(function: "BOP", interval: "weekly")
|
323
|
+
bool << (indicator.symbol == "MSFT")
|
324
|
+
bool << indicator.indicator.is_a?(String)
|
325
|
+
bool << indicator.last_refreshed.is_a?(String)
|
326
|
+
bool << (indicator.interval == "weekly")
|
327
|
+
bool << indicator.time_zone.is_a?(String)
|
328
|
+
bool << indicator.bop.is_a?(Array)
|
329
|
+
expect(bool.all?{|e| e}).to eq true
|
330
|
+
end
|
331
|
+
|
332
|
+
it "can be indicator CCI" do
|
333
|
+
bool = []
|
334
|
+
sleep(1); indicator = @stock.indicator(function: "CCI", interval: "weekly", time_period: "60")
|
335
|
+
bool << (indicator.symbol == "MSFT")
|
336
|
+
bool << indicator.indicator.is_a?(String)
|
337
|
+
bool << indicator.last_refreshed.is_a?(String)
|
338
|
+
bool << (indicator.interval == "weekly")
|
339
|
+
bool << indicator.time_zone.is_a?(String)
|
340
|
+
bool << indicator.cci.is_a?(Array)
|
341
|
+
expect(bool.all?{|e| e}).to eq true
|
342
|
+
end
|
343
|
+
|
344
|
+
it "can be indicator CMO" do
|
345
|
+
bool = []
|
346
|
+
sleep(1); indicator = @stock.indicator(function: "CMO", interval: "weekly", time_period: "60", series_type: "close")
|
347
|
+
bool << (indicator.symbol == "MSFT")
|
348
|
+
bool << indicator.indicator.is_a?(String)
|
349
|
+
bool << indicator.last_refreshed.is_a?(String)
|
350
|
+
bool << (indicator.interval == "weekly")
|
351
|
+
bool << indicator.series_type.is_a?(String)
|
352
|
+
bool << indicator.time_zone.is_a?(String)
|
353
|
+
bool << indicator.cmo.is_a?(Array)
|
354
|
+
expect(bool.all?{|e| e}).to eq true
|
355
|
+
end
|
356
|
+
|
357
|
+
it "can be indicator ROC" do
|
358
|
+
bool = []
|
359
|
+
sleep(1); indicator = @stock.indicator(function: "ROC", interval: "weekly", time_period: "60", series_type: "close")
|
360
|
+
bool << (indicator.symbol == "MSFT")
|
361
|
+
bool << indicator.indicator.is_a?(String)
|
362
|
+
bool << indicator.last_refreshed.is_a?(String)
|
363
|
+
bool << (indicator.interval == "weekly")
|
364
|
+
bool << indicator.series_type.is_a?(String)
|
365
|
+
bool << indicator.time_zone.is_a?(String)
|
366
|
+
bool << indicator.roc.is_a?(Array)
|
367
|
+
expect(bool.all?{|e| e}).to eq true
|
368
|
+
end
|
369
|
+
|
370
|
+
it "can be indicator ROCR" do
|
371
|
+
bool = []
|
372
|
+
sleep(1); indicator = @stock.indicator(function: "ROCR", interval: "weekly", time_period: "60", series_type: "close")
|
373
|
+
bool << (indicator.symbol == "MSFT")
|
374
|
+
bool << indicator.indicator.is_a?(String)
|
375
|
+
bool << indicator.last_refreshed.is_a?(String)
|
376
|
+
bool << (indicator.interval == "weekly")
|
377
|
+
bool << indicator.series_type.is_a?(String)
|
378
|
+
bool << indicator.time_zone.is_a?(String)
|
379
|
+
bool << indicator.rocr.is_a?(Array)
|
380
|
+
expect(bool.all?{|e| e}).to eq true
|
381
|
+
end
|
382
|
+
|
383
|
+
it "can be indicator AROON" do
|
384
|
+
bool = []
|
385
|
+
sleep(1); indicator = @stock.indicator(function: "AROON", interval: "weekly", time_period: "60")
|
386
|
+
bool << (indicator.symbol == "MSFT")
|
387
|
+
bool << indicator.indicator.is_a?(String)
|
388
|
+
bool << indicator.last_refreshed.is_a?(String)
|
389
|
+
bool << (indicator.interval == "weekly")
|
390
|
+
bool << indicator.time_zone.is_a?(String)
|
391
|
+
bool << indicator.aroon_down.is_a?(Array)
|
392
|
+
bool << indicator.aroon_up.is_a?(Array)
|
393
|
+
expect(bool.all?{|e| e}).to eq true
|
394
|
+
end
|
395
|
+
|
396
|
+
it "can be indicator AROONOSC" do
|
397
|
+
bool = []
|
398
|
+
sleep(1); indicator = @stock.indicator(function: "AROONOSC", interval: "weekly", time_period: "60")
|
399
|
+
bool << (indicator.symbol == "MSFT")
|
400
|
+
bool << indicator.indicator.is_a?(String)
|
401
|
+
bool << indicator.last_refreshed.is_a?(String)
|
402
|
+
bool << (indicator.interval == "weekly")
|
403
|
+
bool << indicator.time_zone.is_a?(String)
|
404
|
+
bool << indicator.aroonosc.is_a?(Array)
|
405
|
+
expect(bool.all?{|e| e}).to eq true
|
406
|
+
end
|
407
|
+
|
408
|
+
it "can be indicator MFI" do
|
409
|
+
bool = []
|
410
|
+
sleep(1); indicator = @stock.indicator(function: "MFI", interval: "weekly", time_period: "60")
|
411
|
+
bool << (indicator.symbol == "MSFT")
|
412
|
+
bool << indicator.indicator.is_a?(String)
|
413
|
+
bool << indicator.last_refreshed.is_a?(String)
|
414
|
+
bool << (indicator.interval == "weekly")
|
415
|
+
bool << indicator.time_zone.is_a?(String)
|
416
|
+
bool << indicator.mfi.is_a?(Array)
|
417
|
+
expect(bool.all?{|e| e}).to eq true
|
418
|
+
end
|
419
|
+
|
420
|
+
it "can be indicator TRIX" do
|
421
|
+
bool = []
|
422
|
+
sleep(1); indicator = @stock.indicator(function: "TRIX", interval: "weekly", time_period: "60", series_type: "close")
|
423
|
+
bool << (indicator.symbol == "MSFT")
|
424
|
+
bool << indicator.indicator.is_a?(String)
|
425
|
+
bool << indicator.last_refreshed.is_a?(String)
|
426
|
+
bool << (indicator.interval == "weekly")
|
427
|
+
bool << indicator.series_type.is_a?(String)
|
428
|
+
bool << indicator.time_zone.is_a?(String)
|
429
|
+
bool << indicator.trix.is_a?(Array)
|
430
|
+
expect(bool.all?{|e| e}).to eq true
|
431
|
+
end
|
432
|
+
|
433
|
+
it "can be indicator ULTOSC" do
|
434
|
+
bool = []
|
435
|
+
sleep(1); indicator = @stock.indicator(function: "ULTOSC", interval: "weekly", timeperiod1: "7", timeperiod2: "14", timeperiod3: "28")
|
436
|
+
bool << (indicator.symbol == "MSFT")
|
437
|
+
bool << indicator.indicator.is_a?(String)
|
438
|
+
bool << indicator.last_refreshed.is_a?(String)
|
439
|
+
bool << (indicator.interval == "weekly")
|
440
|
+
bool << indicator.time_zone.is_a?(String)
|
441
|
+
bool << indicator.time_period_1.is_a?(Fixnum)
|
442
|
+
bool << indicator.time_period_2.is_a?(Fixnum)
|
443
|
+
bool << indicator.time_period_3.is_a?(Fixnum)
|
444
|
+
bool << indicator.ultosc.is_a?(Array)
|
445
|
+
expect(bool.all?{|e| e}).to eq true
|
446
|
+
end
|
447
|
+
|
448
|
+
it "can be indicator DX" do
|
449
|
+
bool = []
|
450
|
+
sleep(1); indicator = @stock.indicator(function: "DX", interval: "weekly", time_period: "60")
|
451
|
+
bool << (indicator.symbol == "MSFT")
|
452
|
+
bool << indicator.indicator.is_a?(String)
|
453
|
+
bool << indicator.last_refreshed.is_a?(String)
|
454
|
+
bool << (indicator.interval == "weekly")
|
455
|
+
bool << indicator.time_zone.is_a?(String)
|
456
|
+
bool << indicator.dx.is_a?(Array)
|
457
|
+
expect(bool.all?{|e| e}).to eq true
|
458
|
+
end
|
459
|
+
|
460
|
+
it "can be indicator MINUS_DI" do
|
461
|
+
bool = []
|
462
|
+
sleep(1); indicator = @stock.indicator(function: "MINUS_DI", interval: "weekly", time_period: "60")
|
463
|
+
bool << (indicator.symbol == "MSFT")
|
464
|
+
bool << indicator.indicator.is_a?(String)
|
465
|
+
bool << indicator.last_refreshed.is_a?(String)
|
466
|
+
bool << (indicator.interval == "weekly")
|
467
|
+
bool << indicator.time_zone.is_a?(String)
|
468
|
+
bool << indicator.minus_di.is_a?(Array)
|
469
|
+
expect(bool.all?{|e| e}).to eq true
|
470
|
+
end
|
471
|
+
|
472
|
+
it "can be indicator PLUS_DI" do
|
473
|
+
bool = []
|
474
|
+
sleep(1); indicator = @stock.indicator(function: "PLUS_DI", interval: "weekly", time_period: "60")
|
475
|
+
bool << (indicator.symbol == "MSFT")
|
476
|
+
bool << indicator.indicator.is_a?(String)
|
477
|
+
bool << indicator.last_refreshed.is_a?(String)
|
478
|
+
bool << (indicator.interval == "weekly")
|
479
|
+
bool << indicator.time_zone.is_a?(String)
|
480
|
+
bool << indicator.plus_di.is_a?(Array)
|
481
|
+
expect(bool.all?{|e| e}).to eq true
|
482
|
+
end
|
483
|
+
|
484
|
+
it "can be indicator MINUS_DM" do
|
485
|
+
bool = []
|
486
|
+
sleep(1); indicator = @stock.indicator(function: "MINUS_DM", interval: "weekly", time_period: "60")
|
487
|
+
bool << (indicator.symbol == "MSFT")
|
488
|
+
bool << indicator.indicator.is_a?(String)
|
489
|
+
bool << indicator.last_refreshed.is_a?(String)
|
490
|
+
bool << (indicator.interval == "weekly")
|
491
|
+
bool << indicator.time_zone.is_a?(String)
|
492
|
+
bool << indicator.minus_dm.is_a?(Array)
|
493
|
+
expect(bool.all?{|e| e}).to eq true
|
494
|
+
end
|
495
|
+
|
496
|
+
it "can be indicator PLUS_DM" do
|
497
|
+
bool = []
|
498
|
+
sleep(1); indicator = @stock.indicator(function: "PLUS_DM", interval: "weekly", time_period: "60")
|
499
|
+
bool << (indicator.symbol == "MSFT")
|
500
|
+
bool << indicator.indicator.is_a?(String)
|
501
|
+
bool << indicator.last_refreshed.is_a?(String)
|
502
|
+
bool << (indicator.interval == "weekly")
|
503
|
+
bool << indicator.time_zone.is_a?(String)
|
504
|
+
bool << indicator.plus_dm.is_a?(Array)
|
505
|
+
expect(bool.all?{|e| e}).to eq true
|
506
|
+
end
|
507
|
+
|
508
|
+
it "can be indicator BBANDS" do
|
509
|
+
bool = []
|
510
|
+
sleep(1); indicator = @stock.indicator(function: "BBANDS", interval: "weekly", time_period: "60", series_type: "close", matype: "0", nbdevup: "2", nbdevdn: "2")
|
511
|
+
bool << (indicator.symbol == "MSFT")
|
512
|
+
bool << indicator.indicator.is_a?(String)
|
513
|
+
bool << indicator.last_refreshed.is_a?(String)
|
514
|
+
bool << (indicator.interval == "weekly")
|
515
|
+
bool << indicator.series_type.is_a?(String)
|
516
|
+
bool << indicator.time_zone.is_a?(String)
|
517
|
+
bool << indicator.deviation_multiplier_for_upper_band.is_a?(Fixnum)
|
518
|
+
bool << indicator.deviation_multiplier_for_lower_band.is_a?(Fixnum)
|
519
|
+
bool << indicator.ma_type.is_a?(Fixnum)
|
520
|
+
bool << indicator.real_lower_band.is_a?(Array)
|
521
|
+
bool << indicator.real_middle_band.is_a?(Array)
|
522
|
+
bool << indicator.real_upper_band.is_a?(Array)
|
523
|
+
expect(bool.all?{|e| e}).to eq true
|
524
|
+
end
|
525
|
+
|
526
|
+
it "can be indicator MIDPOINT" do
|
527
|
+
bool = []
|
528
|
+
sleep(1); indicator = @stock.indicator(function: "MIDPOINT", interval: "weekly", time_period: "60", series_type: "close")
|
529
|
+
bool << (indicator.symbol == "MSFT")
|
530
|
+
bool << indicator.indicator.is_a?(String)
|
531
|
+
bool << indicator.last_refreshed.is_a?(String)
|
532
|
+
bool << (indicator.interval == "weekly")
|
533
|
+
bool << indicator.series_type.is_a?(String)
|
534
|
+
bool << indicator.time_zone.is_a?(String)
|
535
|
+
bool << indicator.midpoint.is_a?(Array)
|
536
|
+
expect(bool.all?{|e| e}).to eq true
|
537
|
+
end
|
538
|
+
|
539
|
+
it "can be indicator MIDPRICE" do
|
540
|
+
bool = []
|
541
|
+
sleep(1); indicator = @stock.indicator(function: "MIDPRICE", interval: "weekly", time_period: "60")
|
542
|
+
bool << (indicator.symbol == "MSFT")
|
543
|
+
bool << indicator.indicator.is_a?(String)
|
544
|
+
bool << indicator.last_refreshed.is_a?(String)
|
545
|
+
bool << (indicator.interval == "weekly")
|
546
|
+
bool << indicator.time_zone.is_a?(String)
|
547
|
+
bool << indicator.midprice.is_a?(Array)
|
548
|
+
expect(bool.all?{|e| e}).to eq true
|
549
|
+
end
|
550
|
+
|
551
|
+
it "can be indicator SAR" do
|
552
|
+
bool = []
|
553
|
+
sleep(1); indicator = @stock.indicator(function: "SAR", interval: "weekly", acceleration: "0.01", maximum: "0.20")
|
554
|
+
bool << (indicator.symbol == "MSFT")
|
555
|
+
bool << indicator.indicator.is_a?(String)
|
556
|
+
bool << indicator.last_refreshed.is_a?(String)
|
557
|
+
bool << (indicator.interval == "weekly")
|
558
|
+
bool << indicator.time_zone.is_a?(String)
|
559
|
+
bool << indicator.acceleration.is_a?(Float)
|
560
|
+
bool << indicator.maximum.is_a?(Float)
|
561
|
+
bool << indicator.sar.is_a?(Array)
|
562
|
+
expect(bool.all?{|e| e}).to eq true
|
563
|
+
end
|
564
|
+
|
565
|
+
it "can be indicator TRANGE" do
|
566
|
+
bool = []
|
567
|
+
sleep(1); indicator = @stock.indicator(function: "TRANGE", interval: "weekly")
|
568
|
+
bool << (indicator.symbol == "MSFT")
|
569
|
+
bool << indicator.indicator.is_a?(String)
|
570
|
+
bool << indicator.last_refreshed.is_a?(String)
|
571
|
+
bool << (indicator.interval == "weekly")
|
572
|
+
bool << indicator.time_zone.is_a?(String)
|
573
|
+
bool << indicator.trange.is_a?(Array)
|
574
|
+
expect(bool.all?{|e| e}).to eq true
|
575
|
+
end
|
576
|
+
|
577
|
+
it "can be indicator ATR" do
|
578
|
+
bool = []
|
579
|
+
sleep(1); indicator = @stock.indicator(function: "ATR", interval: "weekly", time_period: "60")
|
580
|
+
bool << (indicator.symbol == "MSFT")
|
581
|
+
bool << indicator.indicator.is_a?(String)
|
582
|
+
bool << indicator.last_refreshed.is_a?(String)
|
583
|
+
bool << (indicator.interval == "weekly")
|
584
|
+
bool << indicator.time_zone.is_a?(String)
|
585
|
+
bool << indicator.atr.is_a?(Array)
|
586
|
+
expect(bool.all?{|e| e}).to eq true
|
587
|
+
end
|
588
|
+
|
589
|
+
it "can be indicator NATR" do
|
590
|
+
bool = []
|
591
|
+
sleep(1); indicator = @stock.indicator(function: "NATR", interval: "weekly", time_period: "60")
|
592
|
+
bool << (indicator.symbol == "MSFT")
|
593
|
+
bool << indicator.indicator.is_a?(String)
|
594
|
+
bool << indicator.last_refreshed.is_a?(String)
|
595
|
+
bool << (indicator.interval == "weekly")
|
596
|
+
bool << indicator.time_zone.is_a?(String)
|
597
|
+
bool << indicator.natr.is_a?(Array)
|
598
|
+
expect(bool.all?{|e| e}).to eq true
|
599
|
+
end
|
600
|
+
|
601
|
+
it "can be indicator AD" do
|
602
|
+
bool = []
|
603
|
+
sleep(1); indicator = @stock.indicator(function: "AD", interval: "weekly")
|
604
|
+
bool << (indicator.symbol == "MSFT")
|
605
|
+
bool << indicator.indicator.is_a?(String)
|
606
|
+
bool << indicator.last_refreshed.is_a?(String)
|
607
|
+
bool << (indicator.interval == "weekly")
|
608
|
+
bool << indicator.time_zone.is_a?(String)
|
609
|
+
bool << indicator.chaikin_ad.is_a?(Array)
|
610
|
+
expect(bool.all?{|e| e}).to eq true
|
611
|
+
end
|
612
|
+
|
613
|
+
it "can be indicator ADOSC" do
|
614
|
+
bool = []
|
615
|
+
sleep(1); indicator = @stock.indicator(function: "ADOSC", interval: "weekly", fastperiod: "12", slowperiod: "26")
|
616
|
+
bool << (indicator.symbol == "MSFT")
|
617
|
+
bool << indicator.indicator.is_a?(String)
|
618
|
+
bool << indicator.last_refreshed.is_a?(String)
|
619
|
+
bool << (indicator.interval == "weekly")
|
620
|
+
bool << indicator.fastk_period.is_a?(Fixnum)
|
621
|
+
bool << indicator.slowk_period.is_a?(Fixnum)
|
622
|
+
bool << indicator.time_zone.is_a?(String)
|
623
|
+
bool << indicator.adosc.is_a?(Array)
|
624
|
+
expect(bool.all?{|e| e}).to eq true
|
625
|
+
end
|
626
|
+
|
627
|
+
it "can be indicator OBV" do
|
628
|
+
bool = []
|
629
|
+
sleep(1); indicator = @stock.indicator(function: "OBV", interval: "weekly")
|
630
|
+
bool << (indicator.symbol == "MSFT")
|
631
|
+
bool << indicator.indicator.is_a?(String)
|
632
|
+
bool << indicator.last_refreshed.is_a?(String)
|
633
|
+
bool << (indicator.interval == "weekly")
|
634
|
+
bool << indicator.time_zone.is_a?(String)
|
635
|
+
bool << indicator.obv.is_a?(Array)
|
636
|
+
expect(bool.all?{|e| e}).to eq true
|
637
|
+
end
|
638
|
+
|
639
|
+
it "can be indicator HT_TRENDLINE" do
|
640
|
+
bool = []
|
641
|
+
sleep(1); indicator = @stock.indicator(function: "HT_TRENDLINE", interval: "weekly", series_type: "close")
|
642
|
+
bool << (indicator.symbol == "MSFT")
|
643
|
+
bool << indicator.indicator.is_a?(String)
|
644
|
+
bool << indicator.last_refreshed.is_a?(String)
|
645
|
+
bool << (indicator.interval == "weekly")
|
646
|
+
bool << indicator.series_type.is_a?(String)
|
647
|
+
bool << indicator.time_zone.is_a?(String)
|
648
|
+
bool << indicator.ht_trendline.is_a?(Array)
|
649
|
+
expect(bool.all?{|e| e}).to eq true
|
650
|
+
end
|
651
|
+
|
652
|
+
it "can be indicator HT_SINE" do
|
653
|
+
bool = []
|
654
|
+
sleep(1); indicator = @stock.indicator(function: "HT_SINE", interval: "weekly", series_type: "close")
|
655
|
+
bool << (indicator.symbol == "MSFT")
|
656
|
+
bool << indicator.indicator.is_a?(String)
|
657
|
+
bool << indicator.last_refreshed.is_a?(String)
|
658
|
+
bool << (indicator.interval == "weekly")
|
659
|
+
bool << indicator.series_type.is_a?(String)
|
660
|
+
bool << indicator.time_zone.is_a?(String)
|
661
|
+
bool << indicator.sine.is_a?(Array)
|
662
|
+
bool << indicator.lead_sine.is_a?(Array)
|
663
|
+
expect(bool.all?{|e| e}).to eq true
|
664
|
+
end
|
665
|
+
|
666
|
+
it "can be indicator HT_TRENDMODE" do
|
667
|
+
bool = []
|
668
|
+
sleep(1); indicator = @stock.indicator(function: "HT_TRENDMODE", interval: "weekly", series_type: "close")
|
669
|
+
bool << (indicator.symbol == "MSFT")
|
670
|
+
bool << indicator.indicator.is_a?(String)
|
671
|
+
bool << indicator.last_refreshed.is_a?(String)
|
672
|
+
bool << (indicator.interval == "weekly")
|
673
|
+
bool << indicator.series_type.is_a?(String)
|
674
|
+
bool << indicator.time_zone.is_a?(String)
|
675
|
+
bool << indicator.trendmode.is_a?(Array)
|
676
|
+
expect(bool.all?{|e| e}).to eq true
|
677
|
+
end
|
678
|
+
|
679
|
+
it "can be indicator HT_DCPERIOD" do
|
680
|
+
bool = []
|
681
|
+
sleep(1); indicator = @stock.indicator(function: "HT_DCPERIOD", interval: "weekly", series_type: "close")
|
682
|
+
bool << (indicator.symbol == "MSFT")
|
683
|
+
bool << indicator.indicator.is_a?(String)
|
684
|
+
bool << indicator.last_refreshed.is_a?(String)
|
685
|
+
bool << (indicator.interval == "weekly")
|
686
|
+
bool << indicator.series_type.is_a?(String)
|
687
|
+
bool << indicator.time_zone.is_a?(String)
|
688
|
+
bool << indicator.dcperiod.is_a?(Array)
|
689
|
+
expect(bool.all?{|e| e}).to eq true
|
690
|
+
end
|
691
|
+
|
692
|
+
it "can be indicator HT_DCPHASE" do
|
693
|
+
bool = []
|
694
|
+
sleep(1); indicator = @stock.indicator(function: "HT_DCPHASE", interval: "weekly", series_type: "close")
|
695
|
+
bool << (indicator.symbol == "MSFT")
|
696
|
+
bool << indicator.indicator.is_a?(String)
|
697
|
+
bool << indicator.last_refreshed.is_a?(String)
|
698
|
+
bool << (indicator.interval == "weekly")
|
699
|
+
bool << indicator.series_type.is_a?(String)
|
700
|
+
bool << indicator.time_zone.is_a?(String)
|
701
|
+
bool << indicator.ht_dcphase.is_a?(Array)
|
702
|
+
expect(bool.all?{|e| e}).to eq true
|
703
|
+
end
|
704
|
+
|
705
|
+
it "can be indicator HT_PHASOR" do
|
706
|
+
bool = []
|
707
|
+
sleep(1); indicator = @stock.indicator(function: "HT_PHASOR", interval: "weekly", series_type: "close")
|
708
|
+
bool << (indicator.symbol == "MSFT")
|
709
|
+
bool << indicator.indicator.is_a?(String)
|
710
|
+
bool << indicator.last_refreshed.is_a?(String)
|
711
|
+
bool << (indicator.interval == "weekly")
|
712
|
+
bool << indicator.series_type.is_a?(String)
|
713
|
+
bool << indicator.time_zone.is_a?(String)
|
714
|
+
bool << indicator.quadrature.is_a?(Array)
|
715
|
+
bool << indicator.phase.is_a?(Array)
|
716
|
+
expect(bool.all?{|e| e}).to eq true
|
717
|
+
end
|
718
|
+
end
|
719
|
+
end
|