finviz_rails 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/finviz_rails.rb +1 -0
- data/lib/finviz_rails/finviz.rb +4 -0
- data/lib/finviz_rails/series.rb +61 -0
- data/lib/finviz_rails/version.rb +1 -1
- data/test/dummy/log/test.log +73 -0
- data/test/finviz_rails_test.rb +1 -7
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 223d8fc0a307e9f2cb6ddbbb120c564157e5ec2e
|
4
|
+
data.tar.gz: 340e379415036d294cd00f594cfe0eaf27c3eeb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bcddd10139710b6dce243d7705b6f90fa5ebca0d6ecc2217343f462e547123d5a8bc1dcf0993a6ca75df2b68e71d8904c64f2fe881b2f4c7f13d4d5c5f0f780
|
7
|
+
data.tar.gz: 3d7631c883f5cd238558d508d2d8e863263ae61bb49d685efaeb585d4890b78828b3e6d7575b82a86076335b97928d8db745ab9b1bec4089caa73d2f7a0b1a19
|
data/lib/finviz_rails.rb
CHANGED
data/lib/finviz_rails/finviz.rb
CHANGED
@@ -0,0 +1,61 @@
|
|
1
|
+
class Series
|
2
|
+
def initialize(symbol, params, agent)
|
3
|
+
@symbol = symbol
|
4
|
+
@params = params
|
5
|
+
@agent = agent
|
6
|
+
end
|
7
|
+
|
8
|
+
INTERVAL_OPTIONS = ["m", "w", "d", "i1", "i3", "i5", "i15"]
|
9
|
+
|
10
|
+
def run
|
11
|
+
@agent.get(url)
|
12
|
+
result
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def result
|
18
|
+
[
|
19
|
+
json["date"],
|
20
|
+
json["volume"],
|
21
|
+
json["open"],
|
22
|
+
json["high"],
|
23
|
+
json["low"],
|
24
|
+
json["close"]
|
25
|
+
].transpose.map do |date, volume, open, close, high, low|
|
26
|
+
{
|
27
|
+
date: date,
|
28
|
+
volume: volume,
|
29
|
+
open: open,
|
30
|
+
high: high,
|
31
|
+
low: low,
|
32
|
+
close: close
|
33
|
+
}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def json
|
38
|
+
@json ||= JSON.parse(json_string)
|
39
|
+
end
|
40
|
+
|
41
|
+
def json_string
|
42
|
+
html.match(/var data = ({.*?})/)[1]
|
43
|
+
end
|
44
|
+
|
45
|
+
def html
|
46
|
+
@html ||= @agent.page.content
|
47
|
+
end
|
48
|
+
|
49
|
+
def interval
|
50
|
+
if @params["interval"]
|
51
|
+
throw "incorrect interval type" unless INTERVAL_OPTIONS.include?(@params["interval"])
|
52
|
+
@params["interval"]
|
53
|
+
else
|
54
|
+
"d"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def url
|
59
|
+
"http://elite.finviz.com/quote.ashx?t=TNET&ty=c&ta=2&p=#{interval}&b=1"
|
60
|
+
end
|
61
|
+
end
|
data/lib/finviz_rails/version.rb
CHANGED
data/test/dummy/log/test.log
CHANGED
@@ -545,5 +545,78 @@ FinvizRailsTest: test_non-auth_screener_get_first_page_of_data
|
|
545
545
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
546
546
|
--------------------------------------------------------------
|
547
547
|
FinvizRailsTest: test_non-auth_screener_get_first_page_of_data
|
548
|
+
--------------------------------------------------------------
|
549
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
550
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
551
|
+
--------------------------------------------------------------
|
552
|
+
FinvizRailsTest: test_non-auth_screener_get_first_page_of_data
|
553
|
+
--------------------------------------------------------------
|
554
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
555
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
556
|
+
--------------------------------------------------------------
|
557
|
+
FinvizRailsTest: test_non-auth_screener_get_first_page_of_data
|
558
|
+
--------------------------------------------------------------
|
559
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
560
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
561
|
+
--------------------------------------------------------------
|
562
|
+
FinvizRailsTest: test_non-auth_screener_get_first_page_of_data
|
563
|
+
--------------------------------------------------------------
|
564
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
565
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
566
|
+
--------------------------------------------------------------
|
567
|
+
FinvizRailsTest: test_non-auth_screener_get_first_page_of_data
|
568
|
+
--------------------------------------------------------------
|
569
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
570
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
571
|
+
--------------------------------------------------------------
|
572
|
+
FinvizRailsTest: test_non-auth_screener_get_first_page_of_data
|
573
|
+
--------------------------------------------------------------
|
574
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
575
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
576
|
+
--------------------------------------------------------------
|
577
|
+
FinvizRailsTest: test_non-auth_screener_get_first_page_of_data
|
578
|
+
--------------------------------------------------------------
|
579
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
580
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
581
|
+
--------------------------------------------------------------
|
582
|
+
FinvizRailsTest: test_non-auth_screener_get_first_page_of_data
|
583
|
+
--------------------------------------------------------------
|
584
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
585
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
586
|
+
--------------------------------------------------------------
|
587
|
+
FinvizRailsTest: test_non-auth_screener_get_first_page_of_data
|
588
|
+
--------------------------------------------------------------
|
589
|
+
[1m[36m (2.1ms)[0m [1mbegin transaction[0m
|
590
|
+
--------------------------------------------------------------
|
591
|
+
FinvizRailsTest: test_non-auth_screener_get_first_page_of_data
|
592
|
+
--------------------------------------------------------------
|
593
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
594
|
+
--------------------------------------------------------------
|
595
|
+
FinvizRailsTest: test_non-auth_screener_get_first_page_of_data
|
596
|
+
--------------------------------------------------------------
|
597
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
598
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
599
|
+
--------------------------------------------------------------
|
600
|
+
FinvizRailsTest: test_non-auth_screener_get_first_page_of_data
|
601
|
+
--------------------------------------------------------------
|
602
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
603
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
604
|
+
--------------------------------------------------------------
|
605
|
+
FinvizRailsTest: test_non-auth_screener_get_first_page_of_data
|
606
|
+
--------------------------------------------------------------
|
607
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
608
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
609
|
+
--------------------------------------------------------------
|
610
|
+
FinvizRailsTest: test_non-auth_screener_get_first_page_of_data
|
611
|
+
--------------------------------------------------------------
|
612
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
613
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
614
|
+
--------------------------------------------------------------
|
615
|
+
FinvizRailsTest: test_non-auth_screener_get_first_page_of_data
|
616
|
+
--------------------------------------------------------------
|
617
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
618
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
619
|
+
--------------------------------------------------------------
|
620
|
+
FinvizRailsTest: test_non-auth_screener_get_first_page_of_data
|
548
621
|
--------------------------------------------------------------
|
549
622
|
[1m[35m (0.1ms)[0m rollback transaction
|
data/test/finviz_rails_test.rb
CHANGED
@@ -4,12 +4,6 @@ require "pp"
|
|
4
4
|
class FinvizRailsTest < ActiveSupport::TestCase
|
5
5
|
test "non-auth screener get first page of data" do
|
6
6
|
finviz = Finviz.new
|
7
|
-
pp finviz.
|
8
|
-
price_range: "2to3",
|
9
|
-
analyst_recommendation: "strongbuy",
|
10
|
-
average_volume: "o50",
|
11
|
-
pattern: "wedgedown",
|
12
|
-
is_active: true
|
13
|
-
)
|
7
|
+
pp finviz.series("TNET", {"interval" => "i1"})
|
14
8
|
end
|
15
9
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: finviz_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nemrow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- lib/finviz_rails/indices.rb
|
83
83
|
- lib/finviz_rails/login.rb
|
84
84
|
- lib/finviz_rails/screener.rb
|
85
|
+
- lib/finviz_rails/series.rb
|
85
86
|
- lib/finviz_rails/url_formatter.rb
|
86
87
|
- lib/finviz_rails/version.rb
|
87
88
|
- lib/tasks/finviz_rails_tasks.rake
|