cstock 0.5.0 → 0.5.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 +12 -1
- data/bin/cstock +7 -1
- data/lib/cstock/stock.rb +1 -0
- data/lib/cstock/version.rb +1 -1
- data/spec/cstock_spec.rb +9 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 387ed4929610308f06eff131dfb90d4b346b0ac9
|
4
|
+
data.tar.gz: 86440cee74bcf3998f83f6f3f2239133cb629f80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 942dddc69faec6dc7278400522e940a48357127df8d90e7bd0bda1856809ec71edd2d88821e61ef79ae53eb63f1bac485d09b8305c3e83e43e9e5c38e2fb625c
|
7
|
+
data.tar.gz: 6ac939d2298a2cea96cb3b026cce97a6378abf5f97ee24f7a94e5aa96134eb879f2419bd4df1e694eb66584ad12b32b40feb347e907fa418f4b5d19b36aa1268
|
data/README.md
CHANGED
@@ -34,8 +34,20 @@ stock = CStock::Stock.new('600000')
|
|
34
34
|
stock.name #=> 浦发银行
|
35
35
|
stock.股票名 #=> 浦发银行
|
36
36
|
stock. open_price #=> 16.00
|
37
|
+
|
38
|
+
# wrong stock code, its attrs will be nil
|
39
|
+
stock = CStock::Stock.new('错误的')
|
40
|
+
stock.name #=> nil
|
41
|
+
|
42
|
+
# refresh data
|
43
|
+
stock.refresh
|
44
|
+
|
45
|
+
# refresh multi stocks at one quote
|
46
|
+
CStock::Stock.refresh([stock1, stock2])
|
37
47
|
```
|
38
48
|
|
49
|
+
Read spec for more usage.
|
50
|
+
|
39
51
|
## in terminal
|
40
52
|
|
41
53
|
```bash
|
@@ -77,5 +89,4 @@ stock. open_price #=> 16.00
|
|
77
89
|
```
|
78
90
|
# TODO
|
79
91
|
|
80
|
-
* stock code without 'sh' or 'ss'
|
81
92
|
* more indicator
|
data/bin/cstock
CHANGED
data/lib/cstock/stock.rb
CHANGED
data/lib/cstock/version.rb
CHANGED
data/spec/cstock_spec.rb
CHANGED
@@ -77,4 +77,13 @@ describe CStock::Stock do
|
|
77
77
|
expect(s2.name).to eq("浦发银行")
|
78
78
|
end
|
79
79
|
end
|
80
|
+
|
81
|
+
describe "wrong stock code" do
|
82
|
+
it "return nil when refresh" do
|
83
|
+
s = CStock::Stock.new("1")
|
84
|
+
expect(s.name).to eq(nil)
|
85
|
+
s = CStock::Stock.new("错误")
|
86
|
+
expect(s.name).to eq(nil)
|
87
|
+
end
|
88
|
+
end
|
80
89
|
end
|