mic 0.9.0 → 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 +4 -4
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/README.md +6 -1
- data/lib/mic/mic.rb +0 -1
- data/lib/mic/version.rb +1 -1
- data/spec/mic_spec.rb +80 -0
- data/spec/spec_helper.rb +93 -0
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e517d114c91f543b1ddad23536593bc03366a71
|
4
|
+
data.tar.gz: 52e0bf7bebd613f8f3bda6b8a2f64b22a414bd20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52adbd9a58cf7f248268ce3b26c656d8bf29ed070368ec3ecd4f5a8849cd9db27eaf4ba341ff115f7a9d250722748d2ae8aaca7013c3beece9fbd683e2c0c837
|
7
|
+
data.tar.gz: 843f1715ffb20c9621ece544644dae8823b2b16235c4ff896b6dd95c8c4a0948b6eeb8fd4fe9a808df3bb4b72216136c81b8b93d1590c44cfcb461407ae33f8c
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -89,12 +89,17 @@ By default, only operating markets are returned, but it is also possible to incl
|
|
89
89
|
|
90
90
|
## Contributing
|
91
91
|
|
92
|
-
1. Fork it ( http://github.com
|
92
|
+
1. Fork it ( http://github.com/javiervidal/mic/fork )
|
93
93
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
94
94
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
95
95
|
4. Push to the branch (`git push origin my-new-feature`)
|
96
96
|
5. Create new Pull Request
|
97
97
|
|
98
|
+
## Code Status
|
99
|
+
|
100
|
+
[](https://travis-ci.org/javiervidal/mic)
|
101
|
+
[](https://codeclimate.com/github/javiervidal/mic)
|
102
|
+
|
98
103
|
## Copyright
|
99
104
|
|
100
105
|
Copyright (c) 2014 – ∞ Javier Vidal
|
data/lib/mic/mic.rb
CHANGED
@@ -8,7 +8,6 @@ class Mic
|
|
8
8
|
|
9
9
|
def where(options = {})
|
10
10
|
include_segments = options[:include_segments] || false
|
11
|
-
puts include_segments
|
12
11
|
a = Mic::Search.new
|
13
12
|
a = a.select_by(:mic, options[:mic], include_segments) if options[:mic]
|
14
13
|
a = a.select_by(:operating_mic, options[:operating_mic], include_segments) if options[:operating_mic]
|
data/lib/mic/version.rb
CHANGED
data/spec/mic_spec.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Mic do
|
4
|
+
|
5
|
+
context 'when not asking for market segments' do
|
6
|
+
|
7
|
+
it 'markets can be found by mic and market segments are not returned' do
|
8
|
+
markets = Mic.where(mic: 'XTSE')
|
9
|
+
expect(markets).to match_array([
|
10
|
+
{:mic => "XTSE", :acronym => "TSX", :market_name => "TORONTO STOCK EXCHANGE", :market_type => "O", :operating_mic => "XTSE", :country_code => "CA", :country_name => "CANADA", :city => "TORONTO", :website => "WWW.TSE.COM"}
|
11
|
+
])
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'markets can be found by market_name and market segments are not returned' do
|
15
|
+
markets = Mic.where(market_name: 'Toronto')
|
16
|
+
expect(markets).to match_array([
|
17
|
+
{:mic=>"XTSE", :acronym=>"TSX", :market_name=>"TORONTO STOCK EXCHANGE", :market_type=>"O", :operating_mic=>"XTSE", :country_code=>"CA", :country_name=>"CANADA", :city=>"TORONTO", :website=>"WWW.TSE.COM"}
|
18
|
+
])
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'markets can be found by country_code and market segments are not returned' do
|
22
|
+
markets = Mic.where(country_code: 'DK')
|
23
|
+
expect(markets).to match_array([
|
24
|
+
{:mic => "DKTC", :acronym => nil, :market_name => "DANSK OTC", :market_type => "O", :operating_mic => "DKTC", :country_code => "DK", :country_name => "DENMARK", :city => "HORSENS", :website => "WWW.DANSKOTC.DK"},
|
25
|
+
{:mic => "GXGR", :acronym => "DANSK AMP", :market_name => "GXG MARKETS A/S", :market_type => "O", :operating_mic => "GXGR", :country_code => "DK", :country_name => "DENMARK", :city => "HORSENS", :website => "WWW.GXGMARKETS.COM"},
|
26
|
+
{:mic => "NPGA", :acronym => nil, :market_name => "NORD POOL GAS A/S", :market_type => "O", :operating_mic => "NPGA", :country_code => "DK", :country_name => "DENMARK", :city => "COPENHAGEN", :website => "WWW.NORDPOOLGAS.COM"},
|
27
|
+
{:mic => "XCSE", :acronym => nil, :market_name => "OMX NORDIC EXCHANGE COPENHAGEN A/S", :market_type => "O", :operating_mic => "XCSE", :country_code => "DK", :country_name => "DENMARK", :city => "COPENHAGEN", :website => "WWW.OMXNORDICEXCHANGE.COM"}
|
28
|
+
])
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'markets can be found by operating_mic and market segments are not returned' do
|
32
|
+
markets = Mic.where(operating_mic: 'XNAS')
|
33
|
+
expect(markets).to match_array([
|
34
|
+
{:mic=>"XNAS", :acronym=>"NASDAQ", :market_name=>"NASDAQ - ALL MARKETS", :market_type=>"O", :operating_mic=>"XNAS", :country_code=>"US", :country_name=>"UNITED STATES OF AMERICA", :city=>"NEW YORK", :website=>"WWW.NASDAQ.COM"}
|
35
|
+
])
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'when asking for market segments' do
|
41
|
+
|
42
|
+
it 'markets can be found by operating_mic and market segments are returned' do
|
43
|
+
markets = Mic.where(operating_mic: 'XNAS', include_segments: true)
|
44
|
+
expect(markets).to match_array([
|
45
|
+
{:mic=>"XNAS", :acronym=>"NASDAQ", :market_name=>"NASDAQ - ALL MARKETS", :market_type=>"O", :operating_mic=>"XNAS", :country_code=>"US", :country_name=>"UNITED STATES OF AMERICA", :city=>"NEW YORK", :website=>"WWW.NASDAQ.COM"},
|
46
|
+
{:mic=>"BOSD", :acronym=>"NQBXDARK", :market_name=>"NASDAQ OMX BX DARK", :market_type=>"S", :operating_mic=>"XNAS", :country_code=>"US", :country_name=>"UNITED STATES OF AMERICA", :city=>"NEW YORK", :website=>"WWW.NASDAQOMXTRADER.COM"},
|
47
|
+
{:mic=>"ESPD", :acronym=>"ESPEED", :market_name=>"NASDAQ OMX ESPEED", :market_type=>"S", :operating_mic=>"XNAS", :country_code=>"US", :country_name=>"UNITED STATES OF AMERICA", :city=>"NEW YORK", :website=>"WWW.NASDAQOMX.COM"},
|
48
|
+
{:mic=>"NASD", :acronym=>"NSDQDARK", :market_name=>"NSDQ DARK", :market_type=>"S", :operating_mic=>"XNAS", :country_code=>"US", :country_name=>"UNITED STATES OF AMERICA", :city=>"NEW YORK", :website=>"WWW.NASDAQ.COM"},
|
49
|
+
{:mic=>"XBOS", :acronym=>"BSE", :market_name=>"NASDAQ OMX BX", :market_type=>"S", :operating_mic=>"XNAS", :country_code=>"US", :country_name=>"UNITED STATES OF AMERICA", :city=>"NEW YORK", :website=>"WWW.NASDAQOMXTRADER.COM"},
|
50
|
+
{:mic=>"XBRT", :acronym=>"BRUT", :market_name=>"BRUT ECN", :market_type=>"S", :operating_mic=>"XNAS", :country_code=>"US", :country_name=>"UNITED STATES OF AMERICA", :city=>"NEW YORK", :website=>"WWW.NASDAQTRADER.COM"},
|
51
|
+
{:mic=>"XBXO", :acronym=>nil, :market_name=>"NASDAQ OMX BX OPTIONS", :market_type=>"S", :operating_mic=>"XNAS", :country_code=>"US", :country_name=>"UNITED STATES OF AMERICA", :city=>"NEW YORK", :website=>"WWW.NASDAQOMXTRADER.COM"},
|
52
|
+
{:mic=>"XNCM", :acronym=>nil, :market_name=>"NASDAQ CAPITAL MARKET", :market_type=>"S", :operating_mic=>"XNAS", :country_code=>"US", :country_name=>"UNITED STATES OF AMERICA", :city=>"NEW YORK", :website=>"WWW.NASDAQ.COM"},
|
53
|
+
{:mic=>"XNDQ", :acronym=>nil, :market_name=>"NASDAQ OPTIONS MARKET", :market_type=>"S", :operating_mic=>"XNAS", :country_code=>"US", :country_name=>"UNITED STATES OF AMERICA", :city=>"NEW YORK", :website=>"WWW.NASDAQ.COM"},
|
54
|
+
{:mic=>"XNGS", :acronym=>"NGS", :market_name=>"NASDAQ/NGS (GLOBAL SELECT MARKET)", :market_type=>"S", :operating_mic=>"XNAS", :country_code=>"US", :country_name=>"UNITED STATES OF AMERICA", :city=>"NEW YORK", :website=>"WWW.NASDAQ.COM"},
|
55
|
+
{:mic=>"XNIM", :acronym=>nil, :market_name=>"NASDAQ INTERMARKET", :market_type=>"S", :operating_mic=>"XNAS", :country_code=>"US", :country_name=>"UNITED STATES OF AMERICA", :city=>"NEW YORK", :website=>"WWW.NASDAQ.COM"},
|
56
|
+
{:mic=>"XNMS", :acronym=>nil, :market_name=>"NASDAQ/NMS (GLOBAL MARKET)", :market_type=>"S", :operating_mic=>"XNAS", :country_code=>"US", :country_name=>"UNITED STATES OF AMERICA", :city=>"NEW YORK", :website=>"WWW.NASDAQ.COM"},
|
57
|
+
{:mic=>"XPBT", :acronym=>"NFX", :market_name=>"NASDAQ OMX FUTURES EXCHANGE", :market_type=>"S", :operating_mic=>"XNAS", :country_code=>"US", :country_name=>"UNITED STATES OF AMERICA", :city=>"PHILADELPHIA", :website=>"WWW.NASDAQTRADER.COM"},
|
58
|
+
{:mic=>"XPHL", :acronym=>"PHLX", :market_name=>"NASDAQ OMX PHLX", :market_type=>"S", :operating_mic=>"XNAS", :country_code=>"US", :country_name=>"UNITED STATES OF AMERICA", :city=>"PHILADELPHIA", :website=>"WWW.PHLX.COM"},
|
59
|
+
{:mic=>"XPHO", :acronym=>nil, :market_name=>"PHILADELPHIA OPTIONS EXCHANGE", :market_type=>"S", :operating_mic=>"XNAS", :country_code=>"US", :country_name=>"UNITED STATES OF AMERICA", :city=>"PHILADELPHIA", :website=>"WWW.PHLX.COM"},
|
60
|
+
{:mic=>"XPOR", :acronym=>nil, :market_name=>"PORTAL", :market_type=>"S", :operating_mic=>"XNAS", :country_code=>"US", :country_name=>"UNITED STATES OF AMERICA", :city=>"WASHINGTON", :website=>"WWW.NASDAQPORTALMARKET.COM"},
|
61
|
+
{:mic=>"XPSX", :acronym=>"PSX", :market_name=>"NASDAQ OMX PSX", :market_type=>"S", :operating_mic=>"XNAS", :country_code=>"US", :country_name=>"UNITED STATES OF AMERICA", :city=>"NEW YORK", :website=>"WWW.NASDAQTRADER.COM"}
|
62
|
+
])
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'markets can be found by country_code and market segments are not returned' do
|
66
|
+
markets = Mic.where(country_code: 'DK', include_segments: true)
|
67
|
+
expect(markets).to match_array([
|
68
|
+
{:mic=>"DKTC", :acronym=>nil, :market_name=>"DANSK OTC", :market_type=>"O", :operating_mic=>"DKTC", :country_code=>"DK", :country_name=>"DENMARK", :city=>"HORSENS", :website=>"WWW.DANSKOTC.DK"},
|
69
|
+
{:mic=>"GXGR", :acronym=>"DANSK AMP", :market_name=>"GXG MARKETS A/S", :market_type=>"O", :operating_mic=>"GXGR", :country_code=>"DK", :country_name=>"DENMARK", :city=>"HORSENS", :website=>"WWW.GXGMARKETS.COM"},
|
70
|
+
{:mic=>"GXGF", :acronym=>nil, :market_name=>"GXG MTF FIRST QUOTE", :market_type=>"S", :operating_mic=>"GXGR", :country_code=>"DK", :country_name=>"DENMARK", :city=>"HORSENS", :website=>"WWW.GXGMARKETS.COM"},
|
71
|
+
{:mic=>"GXGM", :acronym=>nil, :market_name=>"GXG MTF", :market_type=>"S", :operating_mic=>"GXGR", :country_code=>"DK", :country_name=>"DENMARK", :city=>"HORSENS", :website=>"WWW.GXGMARKETS.COM"},
|
72
|
+
{:mic=>"NPGA", :acronym=>nil, :market_name=>"NORD POOL GAS A/S", :market_type=>"O", :operating_mic=>"NPGA", :country_code=>"DK", :country_name=>"DENMARK", :city=>"COPENHAGEN", :website=>"WWW.NORDPOOLGAS.COM"},
|
73
|
+
{:mic=>"XCSE", :acronym=>nil, :market_name=>"OMX NORDIC EXCHANGE COPENHAGEN A/S", :market_type=>"O", :operating_mic=>"XCSE", :country_code=>"DK", :country_name=>"DENMARK", :city=>"COPENHAGEN", :website=>"WWW.OMXNORDICEXCHANGE.COM"},
|
74
|
+
{:mic=>"XFND", :acronym=>nil, :market_name=>"FIRST NORTH DENMARK", :market_type=>"S", :operating_mic=>"XCSE", :country_code=>"DK", :country_name=>"DENMARK", :city=>"COPENHAGEN", :website=>"WWW.OMXNORDICEXCHANGE.COM"}
|
75
|
+
])
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start
|
3
|
+
require 'mic'
|
4
|
+
|
5
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
6
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
7
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
8
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
9
|
+
#
|
10
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
11
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
12
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
13
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
14
|
+
# a separate helper file that requires the additional dependencies and performs
|
15
|
+
# the additional setup, and require it from the spec files that actually need it.
|
16
|
+
#
|
17
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
18
|
+
# users commonly want.
|
19
|
+
#
|
20
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
21
|
+
RSpec.configure do |config|
|
22
|
+
# rspec-expectations config goes here. You can use an alternate
|
23
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
24
|
+
# assertions if you prefer.
|
25
|
+
config.expect_with :rspec do |expectations|
|
26
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
27
|
+
# and `failure_message` of custom matchers include text for helper methods
|
28
|
+
# defined using `chain`, e.g.:
|
29
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
30
|
+
# # => "be bigger than 2 and smaller than 4"
|
31
|
+
# ...rather than:
|
32
|
+
# # => "be bigger than 2"
|
33
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
34
|
+
end
|
35
|
+
|
36
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
37
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
38
|
+
config.mock_with :rspec do |mocks|
|
39
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
40
|
+
# a real object. This is generally recommended, and will default to
|
41
|
+
# `true` in RSpec 4.
|
42
|
+
mocks.verify_partial_doubles = true
|
43
|
+
end
|
44
|
+
|
45
|
+
# The settings below are suggested to provide a good initial experience
|
46
|
+
# with RSpec, but feel free to customize to your heart's content.
|
47
|
+
=begin
|
48
|
+
# These two settings work together to allow you to limit a spec run
|
49
|
+
# to individual examples or groups you care about by tagging them with
|
50
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
51
|
+
# get run.
|
52
|
+
config.filter_run :focus
|
53
|
+
config.run_all_when_everything_filtered = true
|
54
|
+
|
55
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
56
|
+
# For more details, see:
|
57
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
58
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
59
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
60
|
+
config.disable_monkey_patching!
|
61
|
+
|
62
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
63
|
+
# be too noisy due to issues in dependencies.
|
64
|
+
config.warnings = true
|
65
|
+
|
66
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
67
|
+
# file, and it's useful to allow more verbose output when running an
|
68
|
+
# individual spec file.
|
69
|
+
if config.files_to_run.one?
|
70
|
+
# Use the documentation formatter for detailed output,
|
71
|
+
# unless a formatter has already been configured
|
72
|
+
# (e.g. via a command-line flag).
|
73
|
+
config.default_formatter = 'doc'
|
74
|
+
end
|
75
|
+
|
76
|
+
# Print the 10 slowest examples and example groups at the
|
77
|
+
# end of the spec run, to help surface which specs are running
|
78
|
+
# particularly slow.
|
79
|
+
config.profile_examples = 10
|
80
|
+
|
81
|
+
# Run specs in random order to surface order dependencies. If you find an
|
82
|
+
# order dependency and want to debug it, you can fix the order by providing
|
83
|
+
# the seed, which is printed after each run.
|
84
|
+
# --seed 1234
|
85
|
+
config.order = :random
|
86
|
+
|
87
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
88
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
89
|
+
# test failures related to randomization by passing the same `--seed` value
|
90
|
+
# as the one that triggered the failure.
|
91
|
+
Kernel.srand config.seed
|
92
|
+
=end
|
93
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javier Vidal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -91,6 +91,8 @@ extensions: []
|
|
91
91
|
extra_rdoc_files: []
|
92
92
|
files:
|
93
93
|
- ".gitignore"
|
94
|
+
- ".rspec"
|
95
|
+
- ".travis.yml"
|
94
96
|
- Gemfile
|
95
97
|
- LICENSE.txt
|
96
98
|
- README.md
|
@@ -101,6 +103,8 @@ files:
|
|
101
103
|
- lib/mic/search.rb
|
102
104
|
- lib/mic/version.rb
|
103
105
|
- mic.gemspec
|
106
|
+
- spec/mic_spec.rb
|
107
|
+
- spec/spec_helper.rb
|
104
108
|
homepage: https://github.com/javiervidal/mic
|
105
109
|
licenses:
|
106
110
|
- MIT
|
@@ -125,4 +129,6 @@ rubygems_version: 2.2.2
|
|
125
129
|
signing_key:
|
126
130
|
specification_version: 4
|
127
131
|
summary: ISO 10383 - Market Identifier Codes (MIC)
|
128
|
-
test_files:
|
132
|
+
test_files:
|
133
|
+
- spec/mic_spec.rb
|
134
|
+
- spec/spec_helper.rb
|