rulethu_stock_exchange 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -5
- data/lib/rulethu_stock_exchange/exchanges.rb +17 -17
- data/lib/rulethu_stock_exchange/io.rb +2 -1
- data/lib/rulethu_stock_exchange/version.rb +1 -1
- metadata +1 -9
- data/.idea/.gitignore +0 -8
- data/.idea/misc.xml +0 -4
- data/.idea/modules.xml +0 -8
- data/.idea/rulethu_stock_exchange.iml +0 -88
- data/.idea/vcs.xml +0 -6
- data/data/lse/21-03-2024-data.csv +0 -8
- data/data/lse/21-03-2024-data.json +0 -1
- data/rulethu_stock_exchange.gemspec +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a3ee797d52de72598f1ba0a62c04e37c726ef976d402848e920fede14855aba
|
4
|
+
data.tar.gz: f428fb1cf6b17525a2548a2d7e33152bf4599c4b69ef989830d0a6b7af8a3c95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 519259bfa7d65c8e7a1672546516384b785413498339dfce1c63c830cf8b0a18a988a527380c17bc7e5060a7a96c97f47ef539b711ac4a79dbe5a499c84736a1
|
7
|
+
data.tar.gz: 61c0221871d3d07d45148ff0119fd251db7aa39fa96648c526133c2d6a145d3373bfc6c909ac1f765cf17431010d6355bb577cdb68f169981a24a835ca32714d
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# RulethuStockExchange
|
2
2
|
|
3
3
|
This gem allows you to scrape stock exchange data from the following exchanges:
|
4
|
-
* Zimbabwe Stock Exchange
|
5
|
-
* Johannesburg Stock Exchange
|
6
|
-
* London Stock Exchange
|
4
|
+
* Zimbabwe Stock Exchange (ZSE)
|
5
|
+
* Johannesburg Stock Exchange (JSE)
|
6
|
+
* London Stock Exchange (LSE)
|
7
7
|
|
8
8
|
|
9
9
|
## Installation
|
@@ -19,8 +19,12 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
19
19
|
## Usage
|
20
20
|
|
21
21
|
### Example 1: Scraping Data From London Stock Exchange
|
22
|
+
Require the gem
|
23
|
+
```ruby
|
24
|
+
require 'rulethu_stock_exchange'
|
25
|
+
```
|
22
26
|
|
23
|
-
Get
|
27
|
+
Get the stock exchange. (Currently available stock exchanges are ZSE, JSE and LSE)
|
24
28
|
|
25
29
|
```ruby
|
26
30
|
exchange = RulethuStockExchange::Exchanges::LSE
|
@@ -47,7 +51,7 @@ data = parser.parse()
|
|
47
51
|
|
48
52
|
Write the data to JSON file
|
49
53
|
```ruby
|
50
|
-
filename
|
54
|
+
filename = RulethuStockExchange::IO.write_to_json_file data, 'lse'
|
51
55
|
```
|
52
56
|
|
53
57
|
Convert the JSON file to CSV
|
@@ -1,21 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module RulethuStockExchange::Exchanges
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
4
|
+
ALL = [
|
5
|
+
LSE = {
|
6
|
+
name: 'London Stock Exchange',
|
7
|
+
url: 'https://www.londonstockexchange.com/indices?tab=ftse-indices',
|
8
|
+
selector: 'section#indices-table-IntradayValues > table'
|
9
|
+
},
|
10
|
+
JSE = {
|
11
|
+
name: 'Johannesburg Stock Exchange',
|
12
|
+
url: 'https://www.jse.co.za/indices',
|
13
|
+
selector: 'table'
|
14
|
+
},
|
15
|
+
ZSE = {
|
16
|
+
name: 'Zimbabwe Stock Exchange',
|
17
|
+
url: 'https://www.zse.co.zw/price-sheet/',
|
18
|
+
selector: 'table'
|
19
|
+
}
|
20
|
+
]
|
21
21
|
end
|
@@ -14,7 +14,7 @@ module RulethuStockExchange
|
|
14
14
|
File.open(filename, 'w') do |f|
|
15
15
|
f.write(JSON.dump(data))
|
16
16
|
end
|
17
|
-
|
17
|
+
filename
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.json_to_csv(json_file)
|
@@ -32,6 +32,7 @@ module RulethuStockExchange
|
|
32
32
|
csv << row.values
|
33
33
|
end
|
34
34
|
end
|
35
|
+
filename
|
35
36
|
end
|
36
37
|
end
|
37
38
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rulethu_stock_exchange
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blessed Sibanda
|
@@ -31,26 +31,18 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
-
- ".idea/.gitignore"
|
35
|
-
- ".idea/misc.xml"
|
36
|
-
- ".idea/modules.xml"
|
37
|
-
- ".idea/rulethu_stock_exchange.iml"
|
38
|
-
- ".idea/vcs.xml"
|
39
34
|
- ".standard.yml"
|
40
35
|
- CHANGELOG.md
|
41
36
|
- LICENSE.txt
|
42
37
|
- LSE-Data-21-03-2024.png
|
43
38
|
- README.md
|
44
39
|
- Rakefile
|
45
|
-
- data/lse/21-03-2024-data.csv
|
46
|
-
- data/lse/21-03-2024-data.json
|
47
40
|
- lib/rulethu_stock_exchange.rb
|
48
41
|
- lib/rulethu_stock_exchange/exchanges.rb
|
49
42
|
- lib/rulethu_stock_exchange/io.rb
|
50
43
|
- lib/rulethu_stock_exchange/parser.rb
|
51
44
|
- lib/rulethu_stock_exchange/scraper.rb
|
52
45
|
- lib/rulethu_stock_exchange/version.rb
|
53
|
-
- rulethu_stock_exchange.gemspec
|
54
46
|
- sig/rulethu_stock_exchange.rbs
|
55
47
|
homepage: https://github.com/rulethu/rulethu_stock_exchange.git
|
56
48
|
licenses:
|
data/.idea/.gitignore
DELETED
data/.idea/misc.xml
DELETED
data/.idea/modules.xml
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<project version="4">
|
3
|
-
<component name="ProjectModuleManager">
|
4
|
-
<modules>
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/rulethu_stock_exchange.iml" filepath="$PROJECT_DIR$/.idea/rulethu_stock_exchange.iml" />
|
6
|
-
</modules>
|
7
|
-
</component>
|
8
|
-
</project>
|
@@ -1,88 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<module type="RUBY_MODULE" version="4">
|
3
|
-
<component name="ModuleRunConfigurationManager">
|
4
|
-
<shared />
|
5
|
-
</component>
|
6
|
-
<component name="NewModuleRootManager">
|
7
|
-
<content url="file://$MODULE_DIR$">
|
8
|
-
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
9
|
-
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
10
|
-
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
11
|
-
</content>
|
12
|
-
<orderEntry type="inheritedJdk" />
|
13
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
14
|
-
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, asdf: 3.2.2) [gem]" level="application" />
|
15
|
-
<orderEntry type="library" scope="PROVIDED" name="base64 (v0.2.0, asdf: 3.2.2) [gem]" level="application" />
|
16
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.5.6, asdf: 3.2.2) [gem]" level="application" />
|
17
|
-
<orderEntry type="library" scope="PROVIDED" name="json (v2.7.1, asdf: 3.2.2) [gem]" level="application" />
|
18
|
-
<orderEntry type="library" scope="PROVIDED" name="language_server-protocol (v3.17.0.3, asdf: 3.2.2) [gem]" level="application" />
|
19
|
-
<orderEntry type="library" scope="PROVIDED" name="lint_roller (v1.1.0, asdf: 3.2.2) [gem]" level="application" />
|
20
|
-
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.22.3, asdf: 3.2.2) [gem]" level="application" />
|
21
|
-
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.24.0, asdf: 3.2.2) [gem]" level="application" />
|
22
|
-
<orderEntry type="library" scope="PROVIDED" name="parser (v3.3.0.5, asdf: 3.2.2) [gem]" level="application" />
|
23
|
-
<orderEntry type="library" scope="PROVIDED" name="racc (v1.7.3, asdf: 3.2.2) [gem]" level="application" />
|
24
|
-
<orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, asdf: 3.2.2) [gem]" level="application" />
|
25
|
-
<orderEntry type="library" scope="PROVIDED" name="rake (v13.1.0, asdf: 3.2.2) [gem]" level="application" />
|
26
|
-
<orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.9.0, asdf: 3.2.2) [gem]" level="application" />
|
27
|
-
<orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.6, asdf: 3.2.2) [gem]" level="application" />
|
28
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.62.1, asdf: 3.2.2) [gem]" level="application" />
|
29
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.31.2, asdf: 3.2.2) [gem]" level="application" />
|
30
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop-performance (v1.20.2, asdf: 3.2.2) [gem]" level="application" />
|
31
|
-
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.13.0, asdf: 3.2.2) [gem]" level="application" />
|
32
|
-
<orderEntry type="library" scope="PROVIDED" name="rubyzip (v2.3.2, asdf: 3.2.2) [gem]" level="application" />
|
33
|
-
<orderEntry type="library" scope="PROVIDED" name="selenium-webdriver (v4.18.1, asdf: 3.2.2) [gem]" level="application" />
|
34
|
-
<orderEntry type="library" scope="PROVIDED" name="standard (v1.35.1, asdf: 3.2.2) [gem]" level="application" />
|
35
|
-
<orderEntry type="library" scope="PROVIDED" name="standard-custom (v1.0.2, asdf: 3.2.2) [gem]" level="application" />
|
36
|
-
<orderEntry type="library" scope="PROVIDED" name="standard-performance (v1.3.1, asdf: 3.2.2) [gem]" level="application" />
|
37
|
-
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.5.0, asdf: 3.2.2) [gem]" level="application" />
|
38
|
-
<orderEntry type="library" scope="PROVIDED" name="websocket (v1.2.10, asdf: 3.2.2) [gem]" level="application" />
|
39
|
-
</component>
|
40
|
-
<component name="RakeTasksCache-v2">
|
41
|
-
<option name="myRootTask">
|
42
|
-
<RakeTaskImpl id="rake">
|
43
|
-
<subtasks>
|
44
|
-
<RakeTaskImpl description="Build rulethu_stock_exchange-0.1.0.gem into the pkg directory" fullCommand="build" id="build" />
|
45
|
-
<RakeTaskImpl id="build">
|
46
|
-
<subtasks>
|
47
|
-
<RakeTaskImpl description="Generate SHA512 checksum if rulethu_stock_exchange-0.1.0.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
|
48
|
-
</subtasks>
|
49
|
-
</RakeTaskImpl>
|
50
|
-
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
51
|
-
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
52
|
-
<RakeTaskImpl description="Build and install rulethu_stock_exchange-0.1.0.gem into system gems" fullCommand="install" id="install" />
|
53
|
-
<RakeTaskImpl id="install">
|
54
|
-
<subtasks>
|
55
|
-
<RakeTaskImpl description="Build and install rulethu_stock_exchange-0.1.0.gem into system gems without network access" fullCommand="install:local" id="local" />
|
56
|
-
</subtasks>
|
57
|
-
</RakeTaskImpl>
|
58
|
-
<RakeTaskImpl description="Create tag v0.1.0 and build and push rulethu_stock_exchange-0.1.0.gem to https://github.com/rulethu/rulethu_stock_exchange.git" fullCommand="release[remote]" id="release[remote]" />
|
59
|
-
<RakeTaskImpl description="Lint with the Standard Ruby style guide" fullCommand="standard" id="standard" />
|
60
|
-
<RakeTaskImpl id="standard">
|
61
|
-
<subtasks>
|
62
|
-
<RakeTaskImpl description="Lint and automatically make safe fixes with the Standard Ruby style guide" fullCommand="standard:fix" id="fix" />
|
63
|
-
<RakeTaskImpl description="Lint and automatically make fixes (even unsafe ones" fullCommand="standard:fix_unsafely" id="fix_unsafely" />
|
64
|
-
</subtasks>
|
65
|
-
</RakeTaskImpl>
|
66
|
-
<RakeTaskImpl description="Run the test suite" fullCommand="test" id="test" />
|
67
|
-
<RakeTaskImpl id="test">
|
68
|
-
<subtasks>
|
69
|
-
<RakeTaskImpl description="Print out the test command" fullCommand="test:cmd" id="cmd" />
|
70
|
-
<RakeTaskImpl description="Show which test files fail when run in isolation" fullCommand="test:isolated" id="isolated" />
|
71
|
-
<RakeTaskImpl description="Show bottom 25 tests wrt time" fullCommand="test:slow" id="slow" />
|
72
|
-
<RakeTaskImpl description="" fullCommand="test:deps" id="deps" />
|
73
|
-
</subtasks>
|
74
|
-
</RakeTaskImpl>
|
75
|
-
<RakeTaskImpl description="" fullCommand="default" id="default" />
|
76
|
-
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
77
|
-
<RakeTaskImpl id="release">
|
78
|
-
<subtasks>
|
79
|
-
<RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
|
80
|
-
<RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
|
81
|
-
<RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
|
82
|
-
</subtasks>
|
83
|
-
</RakeTaskImpl>
|
84
|
-
</subtasks>
|
85
|
-
</RakeTaskImpl>
|
86
|
-
</option>
|
87
|
-
</component>
|
88
|
-
</module>
|
data/.idea/vcs.xml
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
Index,Value,Change,High,Low,Prev close
|
2
|
-
FTSE 100,"7,737.38",-0.92 (-0.01%),"7,749.39","7,711.46","7,738.30"
|
3
|
-
FTSE 250,"19,484.40",51.59 (0.27%),"19,506.67","19,420.99","19,432.81"
|
4
|
-
FTSE 350,"4,268.83",1.15 (0.03%),"4,274.93","4,254.63","4,267.68"
|
5
|
-
FTSE All-Share,"4,225.49",1.13 (0.03%),"4,231.39","4,211.62","4,224.36"
|
6
|
-
FTSE AIM UK 50 Index,"3,869.45",-23.25 (-0.60%),"3,899.37","3,863.99","3,892.70"
|
7
|
-
FTSE AIM 100 Index,"3,550.67",4.54 (0.13%),"3,554.44","3,539.44","3,546.13"
|
8
|
-
FTSE AIM All-Share,735.59,0.03 (-),736.96,734.18,735.56
|
@@ -1 +0,0 @@
|
|
1
|
-
[{"Index":"FTSE 100","Value":"7,737.38","Change":"-0.92 (-0.01%)","High":"7,749.39","Low":"7,711.46","Prev close":"7,738.30"},{"Index":"FTSE 250","Value":"19,484.40","Change":"51.59 (0.27%)","High":"19,506.67","Low":"19,420.99","Prev close":"19,432.81"},{"Index":"FTSE 350","Value":"4,268.83","Change":"1.15 (0.03%)","High":"4,274.93","Low":"4,254.63","Prev close":"4,267.68"},{"Index":"FTSE All-Share","Value":"4,225.49","Change":"1.13 (0.03%)","High":"4,231.39","Low":"4,211.62","Prev close":"4,224.36"},{"Index":"FTSE AIM UK 50 Index","Value":"3,869.45","Change":"-23.25 (-0.60%)","High":"3,899.37","Low":"3,863.99","Prev close":"3,892.70"},{"Index":"FTSE AIM 100 Index","Value":"3,550.67","Change":"4.54 (0.13%)","High":"3,554.44","Low":"3,539.44","Prev close":"3,546.13"},{"Index":"FTSE AIM All-Share","Value":"735.59","Change":"0.03 (-)","High":"736.96","Low":"734.18","Prev close":"735.56"}]
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "lib/rulethu_stock_exchange/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "rulethu_stock_exchange"
|
7
|
-
spec.version = RulethuStockExchange::VERSION
|
8
|
-
spec.authors = ["Blessed Sibanda"]
|
9
|
-
spec.email = ["blessed@rulethu.com"]
|
10
|
-
|
11
|
-
spec.summary = "Get Stock Exchange Data"
|
12
|
-
spec.description = "Get Stock Exchange Data Needed by Rulethu from the Web"
|
13
|
-
spec.homepage = "https://github.com/rulethu/rulethu_stock_exchange.git"
|
14
|
-
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">= 3.0.0"
|
16
|
-
|
17
|
-
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
18
|
-
|
19
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
-
spec.metadata["source_code_uri"] = "https://github.com/rulethu/rulethu_stock_exchange.git"
|
21
|
-
spec.metadata["changelog_uri"] = "https://github.com/rulethu/rulethu_stock_exchange/blob/main/CHANGELOG.md"
|
22
|
-
|
23
|
-
# Specify which files should be added to the gem when it is released.
|
24
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
-
spec.files = Dir.chdir(__dir__) do
|
26
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
27
|
-
(File.expand_path(f) == __FILE__) ||
|
28
|
-
f.start_with?(*%w[bin/ test/ spec/ features/ .git appveyor Gemfile])
|
29
|
-
end
|
30
|
-
end
|
31
|
-
spec.bindir = "exe"
|
32
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
33
|
-
spec.require_paths = ["lib"]
|
34
|
-
|
35
|
-
# Uncomment to register a new dependency of your gem
|
36
|
-
spec.add_dependency "selenium-webdriver", "~> 4.18"
|
37
|
-
|
38
|
-
# For more information and examples about making a new gem, check out our
|
39
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
40
|
-
end
|