cmecloud 0.0.1

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.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cmecloud.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Johnny Khai Nguyen
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ CME Cloud
2
+ =========
3
+
4
+ Ruby library for the [Chicago Mercantile Exchange (CME) DataCloud API](http://www.cmedatacloud.com/)
5
+
6
+ ## Try it out
7
+
8
+ Set up the configuration with your API Token/Username found [here](https://www.cmedatacloud.com/MyAccount/Tokens.aspx):
9
+
10
+ Cmecloud.configure do |config|
11
+ config.username = "email@domain.com"
12
+ end
13
+
14
+ Futures and Options Example:
15
+
16
+ response = Cmecloud::futures_and_options("GetLastFutureSettlement", {Exchange: "CME", ContractSymbol: "LEM2")
17
+ response.body["ArrayOfFutureSettlement"]["FutureSettlement"]["Settlements"]
18
+
19
+ => #<Hashie::Mash Settlement=#<Hashie::Mash BlockVolume="0" Delay="0" EFPVolume="0" EFRVolume="0" EFSVolume="0" EOOVolume="0" ElectronicVolume="0" FutureProductKeyId="1416" OPNTVolume="0" OpenInterest="0" OpenOutcryAndPNTVolume="0" OpenOutcryVolume="0" Outcome="Success" PNTVolume="0" Price="0" SUBVolume="0" SettlementDate="7/2/2012 12:00:00 AM" TASBlockVolume="0" TASVolume="0" TotalVolume="0">>
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/cmecloud/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Johnny Khai Nguyen"]
6
+ gem.email = ["johnnyn@gmail.com"]
7
+ gem.description = %q{Ruby library for the Chicago Mercantile Exchange (CME) DataCloud}
8
+ gem.summary = %q{Ruby library for the Chicago Mercantile Exchange (CME) DataCloud}
9
+ gem.homepage = "https://github.com/phuphighter/cmecloud"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "cmecloud"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Cmecloud::VERSION
17
+
18
+ gem.add_development_dependency "faraday_middleware"
19
+ gem.add_development_dependency "hashie"
20
+ gem.add_development_dependency "multi_xml"
21
+ end
@@ -0,0 +1,54 @@
1
+ require "cmecloud/version"
2
+ require 'faraday_middleware'
3
+ require 'hashie/mash'
4
+ require 'multi_xml'
5
+
6
+ module Cmecloud
7
+ module Configuration
8
+ attr_accessor :username
9
+
10
+ def configure
11
+ yield self
12
+ end
13
+ end
14
+
15
+ module Connection
16
+ def connection
17
+ @connection ||= Faraday.new('http://ws.cmedatacloud.com/v1/') do |conn|
18
+ conn.request :url_encoded
19
+ conn.response :mashify
20
+ conn.response :xml, :content_type => /\bxml$/
21
+ conn.adapter Faraday.default_adapter
22
+ end
23
+ end
24
+
25
+ def get(path, params = nil)
26
+ connection.get(path) do |request|
27
+ request.params[:Header_Username] = Cmecloud.username if Cmecloud.username
28
+ request.params.update(params) if params
29
+ end
30
+ end
31
+ end
32
+
33
+ module ApiMethods
34
+ def futures_and_options(operation, *args)
35
+ get("CMEFuturesAndOptions.asmx/#{operation}", *args)
36
+ end
37
+
38
+ def credit_default_swaps(operation, *args)
39
+ get("CMECreditDefaultSwaps.asmx/#{operation}", *args)
40
+ end
41
+
42
+ def interest_rate_swaps(operation, *args)
43
+ get("CMEInterestRateSwaps.asmx/#{operation}", *args)
44
+ end
45
+
46
+ def otc_global_trades_and_quotes(operation, *args)
47
+ get("OTCGlobalTradesAndQuotes.asmx/#{operation}", *args)
48
+ end
49
+ end
50
+
51
+ extend Configuration
52
+ extend Connection
53
+ extend ApiMethods
54
+ end
@@ -0,0 +1,3 @@
1
+ module Cmecloud
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cmecloud
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Johnny Khai Nguyen
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-08-21 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: faraday_middleware
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ type: :development
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: hashie
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: "0"
35
+ type: :development
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: multi_xml
39
+ prerelease: false
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ type: :development
47
+ version_requirements: *id003
48
+ description: Ruby library for the Chicago Mercantile Exchange (CME) DataCloud
49
+ email:
50
+ - johnnyn@gmail.com
51
+ executables: []
52
+
53
+ extensions: []
54
+
55
+ extra_rdoc_files: []
56
+
57
+ files:
58
+ - .gitignore
59
+ - Gemfile
60
+ - LICENSE
61
+ - README.md
62
+ - Rakefile
63
+ - cmecloud.gemspec
64
+ - lib/cmecloud.rb
65
+ - lib/cmecloud/version.rb
66
+ homepage: https://github.com/phuphighter/cmecloud
67
+ licenses: []
68
+
69
+ post_install_message:
70
+ rdoc_options: []
71
+
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: "0"
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: "0"
86
+ requirements: []
87
+
88
+ rubyforge_project:
89
+ rubygems_version: 1.8.15
90
+ signing_key:
91
+ specification_version: 3
92
+ summary: Ruby library for the Chicago Mercantile Exchange (CME) DataCloud
93
+ test_files: []
94
+