simplywallst_snowflake 0.1.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 +15 -0
- data/.gitignore +41 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +35 -0
- data/LICENSE.txt +21 -0
- data/README.md +61 -0
- data/Rakefile +12 -0
- data/bin/console +12 -0
- data/bin/setup +12 -0
- data/lib/simplywallst_snowflake.rb +83 -0
- data/lib/simplywallst_snowflake/version.rb +11 -0
- data/simplywallst_snowflake.gemspec +26 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MTlkYjFkMjQ5MmVjYTlkMThiNjU0NjA4NjMyMjJkOWNkZDRmMmU5MA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NzQ5ZDdjMDA0N2IxMjBlZGUyZmJkY2NhNmY0OGJkMmRkMGNjMmY3YQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZGIyM2U0ZDViZTllYjQwZGFiYjA3NGNiNjUzMzU0NjRhMzVmYTAwMmRkODc1
|
10
|
+
YzQyOTcyNjNhZmM2N2U1NjMzMmJlOWVhOTdmYTY0N2U0ODU5MmExOTYxNGM4
|
11
|
+
ZDYwZmI1N2Y1NGU4Mzc2ZGQwNTQxMGI5MjMxYjBiYWQ1Nzg2OTU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MzNiMjg4OWFmNTI2ZDQzNDRmYmFkOWU1YzMzNmQ0YzJkYTAzMTM3MGVkOGE5
|
14
|
+
MzM0MTFmNzhkY2Y2OWJmNjBmZTdiZmU1NzU2MWUwNzVjNjVmM2FlMDMzNTA5
|
15
|
+
OTY0YjZkODA5NDdhMjg4Mzk0YjgzNzRkNzUyYjM4MWZlY2NiZTU=
|
data/.gitignore
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Code coverage report generated files:
|
24
|
+
/coverage/
|
25
|
+
|
26
|
+
## Environment normalisation:
|
27
|
+
/.bundle/
|
28
|
+
/vendor/bundle
|
29
|
+
/lib/bundler/man/
|
30
|
+
|
31
|
+
# for a library or gem, you might want to ignore these files since the code is
|
32
|
+
# intended to run in multiple environments; otherwise, check them in:
|
33
|
+
# Gemfile.lock
|
34
|
+
# .ruby-version
|
35
|
+
# .ruby-gemset
|
36
|
+
|
37
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
38
|
+
.rvmrc
|
39
|
+
|
40
|
+
# rspec failure tracking
|
41
|
+
.rspec_status
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
simplywallst_snowflake (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.3)
|
10
|
+
rake (10.5.0)
|
11
|
+
rspec (3.5.0)
|
12
|
+
rspec-core (~> 3.5.0)
|
13
|
+
rspec-expectations (~> 3.5.0)
|
14
|
+
rspec-mocks (~> 3.5.0)
|
15
|
+
rspec-core (3.5.4)
|
16
|
+
rspec-support (~> 3.5.0)
|
17
|
+
rspec-expectations (3.5.0)
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
+
rspec-support (~> 3.5.0)
|
20
|
+
rspec-mocks (3.5.0)
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
+
rspec-support (~> 3.5.0)
|
23
|
+
rspec-support (3.5.0)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
bundler (~> 1.14)
|
30
|
+
rake (~> 10.0)
|
31
|
+
rspec (~> 3.0)
|
32
|
+
simplywallst_snowflake!
|
33
|
+
|
34
|
+
BUNDLED WITH
|
35
|
+
1.14.6
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Brendan Coles <bcoles@gmail.com>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# SimplyWallSt Snowflake API Client
|
2
|
+
|
3
|
+
An unofficial client for [Simply Wall St Snowflake API](https://simplywall.st/api/about).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'simplywallst_snowflake'
|
11
|
+
```
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
Create a new `SimplywallstSnowflake::Client` object with the desired exchange and stock ticker.
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
require 'simplywallst_snowflake'
|
19
|
+
client = SimplywallstSnowflake::Client.new(exchange, ticker)
|
20
|
+
```
|
21
|
+
|
22
|
+
For example:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
client = SimplywallstSnowflake::Client.new('ASX', 'TLS')
|
26
|
+
```
|
27
|
+
|
28
|
+
The following `client` properties are available:
|
29
|
+
|
30
|
+
```
|
31
|
+
response
|
32
|
+
url
|
33
|
+
company_name
|
34
|
+
unique_symbol
|
35
|
+
primary_exchange_symbol
|
36
|
+
primary_ticker_symbol
|
37
|
+
snowflake_scores
|
38
|
+
snowflake_colour
|
39
|
+
widget_url
|
40
|
+
snowflake_tile_url
|
41
|
+
value
|
42
|
+
future
|
43
|
+
past
|
44
|
+
health
|
45
|
+
income
|
46
|
+
```
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/bcoles/simplywallst_snowflake.
|
51
|
+
|
52
|
+
|
53
|
+
## Documentation
|
54
|
+
|
55
|
+
SimplyWall.St [Snowflake Widget API Documentation](https://simplywall.st/api/about)
|
56
|
+
|
57
|
+
|
58
|
+
## License
|
59
|
+
|
60
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
61
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2017 Brendan Coles <bcoles@gmail.com>
|
3
|
+
# SimplywallstSnowflake - https://github.com/bcoles/simplywallst_snowflake
|
4
|
+
# See the file 'LICENSE.txt' for copying permission
|
5
|
+
#
|
6
|
+
|
7
|
+
require "bundler/gem_tasks"
|
8
|
+
require "rspec/core/rake_task"
|
9
|
+
|
10
|
+
RSpec::Core::RakeTask.new(:spec)
|
11
|
+
|
12
|
+
task :default => :spec
|
data/bin/console
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
#
|
4
|
+
# Copyright (c) 2017 Brendan Coles <bcoles@gmail.com>
|
5
|
+
# SimplywallstSnowflake - https://github.com/bcoles/simplywallst_snowflake
|
6
|
+
# See the file 'LICENSE.txt' for copying permission
|
7
|
+
#
|
8
|
+
|
9
|
+
require "bundler/setup"
|
10
|
+
require "simplywallst_snowflake"
|
11
|
+
require "irb"
|
12
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Brendan Coles <bcoles@gmail.com>
|
4
|
+
# SimplywallstSnowflake - https://github.com/bcoles/simplywallst_snowflake
|
5
|
+
# See the file 'LICENSE.txt' for copying permission
|
6
|
+
#
|
7
|
+
|
8
|
+
set -euo pipefail
|
9
|
+
IFS=$'\n\t'
|
10
|
+
set -vx
|
11
|
+
|
12
|
+
bundle install
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Brendan Coles <bcoles@gmail.com>
|
4
|
+
# SimplywallstSnowflake - https://github.com/bcoles/simplywallst_snowflake
|
5
|
+
# See the file 'LICENSE.txt' for copying permission
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'simplywallst_snowflake/version'
|
9
|
+
require 'net/http'
|
10
|
+
require 'json'
|
11
|
+
|
12
|
+
module SimplywallstSnowflake
|
13
|
+
class Client
|
14
|
+
attr_reader :response
|
15
|
+
attr_reader :url
|
16
|
+
|
17
|
+
attr_reader :company_name
|
18
|
+
attr_reader :unique_symbol
|
19
|
+
attr_reader :primary_exchange_symbol
|
20
|
+
attr_reader :primary_ticker_symbol
|
21
|
+
attr_reader :snowflake_scores
|
22
|
+
attr_reader :snowflake_colour
|
23
|
+
attr_reader :widget_url
|
24
|
+
attr_reader :snowflake_tile_url
|
25
|
+
|
26
|
+
attr_reader :value
|
27
|
+
attr_reader :future
|
28
|
+
attr_reader :past
|
29
|
+
attr_reader :health
|
30
|
+
attr_reader :income
|
31
|
+
|
32
|
+
def initialize(exchange, ticker)
|
33
|
+
raise "Error - Invalid exchange: '#{exchange}'" unless exchange =~ /\A[a-zA-Z0-9]+\z/
|
34
|
+
raise "Error - Invalid ticker: '#{ticker}'" unless ticker =~ /\A[a-zA-Z0-9]+\z/
|
35
|
+
|
36
|
+
@url = URI("https://simplywall.st/api/snowflake/#{exchange}:#{ticker}")
|
37
|
+
|
38
|
+
begin
|
39
|
+
response = Net::HTTP.get(@url)
|
40
|
+
rescue => e
|
41
|
+
raise "Error - Could not connect to SimplyWall.St: #{e.message}"
|
42
|
+
end
|
43
|
+
|
44
|
+
if response.nil? || response.to_s.eql?('') || response.to_s.eql?('{}')
|
45
|
+
raise 'Error - No response from SimplyWall.St'
|
46
|
+
end
|
47
|
+
|
48
|
+
@response = JSON.parse(response)
|
49
|
+
|
50
|
+
unless @response['message'].nil?
|
51
|
+
raise "Error - Could not retrieve snowflake: #{@response['message']}"
|
52
|
+
end
|
53
|
+
|
54
|
+
# Shortened company name
|
55
|
+
@company_name = @response['companyName']
|
56
|
+
# Unique joined symbol for the company
|
57
|
+
@unique_symbol = @response['uniqueSymbol']
|
58
|
+
# Primary exchange symbol
|
59
|
+
@primary_exchange_symbol = @response['primaryExchangeSymbol']
|
60
|
+
# Primary ticker symbol
|
61
|
+
@primary_ticker_symbol = @response['primaryTickerSymbol']
|
62
|
+
# Array of scores for each axis of the snowflake [ Value, Future, Past, Health, Income ]
|
63
|
+
@snowflake_scores = @response['snowflakeScores']
|
64
|
+
# Scaled float used in colouring the snowflake, range 0.0 (healthy) to 1.0 (bad)
|
65
|
+
@snowflake_colour = @response['snowflakeColour']
|
66
|
+
# A URL to the snowflake tile as a widget to be used in an iframe
|
67
|
+
@widget_url = @response['widgetURL']
|
68
|
+
# A URL to a rendered tile of the companies snowflake
|
69
|
+
@snowflake_tile_url = @response['snowflakeTileURL']
|
70
|
+
|
71
|
+
# Value - value based on future cash flows and its price relative to the stock market
|
72
|
+
@value = @snowflake_scores[0]
|
73
|
+
# Future Performance - expected performance in the next 3 years
|
74
|
+
@future = @snowflake_scores[1]
|
75
|
+
# Past Performance - historical performance over the past 5 years
|
76
|
+
@past = @snowflake_scores[2]
|
77
|
+
# Health - financial health and the level of debt
|
78
|
+
@health = @snowflake_scores[3]
|
79
|
+
# Income - the current dividend yield, its volatility and sustainability
|
80
|
+
@income = @snowflake_scores[4]
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Brendan Coles <bcoles@gmail.com>
|
4
|
+
# SimplywallstSnowflake - https://github.com/bcoles/simplywallst_snowflake
|
5
|
+
# See the file 'LICENSE.txt' for copying permission
|
6
|
+
#
|
7
|
+
|
8
|
+
module SimplywallstSnowflake
|
9
|
+
# Gem version
|
10
|
+
VERSION = '0.1.0'.freeze
|
11
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'simplywallst_snowflake/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "simplywallst_snowflake"
|
8
|
+
spec.version = SimplywallstSnowflake::VERSION
|
9
|
+
spec.authors = ['Brendan Coles']
|
10
|
+
spec.email = ['bcoles@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = %q{An unofficial client for Simply Wall St Snowflake API.}
|
13
|
+
spec.homepage = 'https://github.com/bcoles/simplywallst_snowflake'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = 'exe'
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: simplywallst_snowflake
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brendan Coles
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-04-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- bcoles@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- .rspec
|
64
|
+
- .travis.yml
|
65
|
+
- Gemfile
|
66
|
+
- Gemfile.lock
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/console
|
71
|
+
- bin/setup
|
72
|
+
- lib/simplywallst_snowflake.rb
|
73
|
+
- lib/simplywallst_snowflake/version.rb
|
74
|
+
- simplywallst_snowflake.gemspec
|
75
|
+
homepage: https://github.com/bcoles/simplywallst_snowflake
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.2.2
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: An unofficial client for Simply Wall St Snowflake API.
|
99
|
+
test_files: []
|
100
|
+
has_rdoc:
|