massiveclient 0.3.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.
@@ -0,0 +1,101 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MassiveClient
4
+ module Websocket
5
+ class WebsocketEvent < Dry::Struct
6
+ Statuses = Types::String.enum("connected", "successful", "auth_timeout", "auth_success", "success")
7
+
8
+ attribute :ev, Types::String
9
+ attribute :status, Statuses
10
+ attribute :message, Types::String
11
+ end
12
+
13
+ class ForexQuoteEvent < Dry::Struct
14
+ attribute :ev, Types::String.enum("C")
15
+ attribute :p, Types::String # Currency pair
16
+ attribute :x, Types::Integer # FX Exchange ID
17
+ attribute :a, Types::JSON::Decimal # Ask Price
18
+ attribute :b, Types::JSON::Decimal # Bid Price
19
+ attribute :t, Types::Integer # Quote Timestamp ( Unix MS )
20
+ end
21
+
22
+ class ForexAggregateEvent < Dry::Struct
23
+ attribute :ev, Types::String.enum("CA")
24
+ attribute :pair, Types::String
25
+ attribute :o, Types::JSON::Decimal # Open Price
26
+ attribute :c, Types::JSON::Decimal # Close Price
27
+ attribute :h, Types::JSON::Decimal # High Price
28
+ attribute :l, Types::JSON::Decimal # Low Price
29
+ attribute :v, Types::Integer # Volume ( Quotes during this duration )
30
+ attribute :s, Types::Integer # Tick Start Timestamp
31
+ end
32
+
33
+ class CryptoQuoteEvent < Dry::Struct
34
+ attribute :ev, Types::String.enum("XQ")
35
+ attribute :pair, Types::String
36
+ attribute :lp, Types::JSON::Decimal # Last Trade Price
37
+ attribute :ls, Types::JSON::Decimal # Last Trade Size
38
+ attribute :bp, Types::JSON::Decimal # Bid Price
39
+ attribute :bs, Types::JSON::Decimal # Bid Size
40
+ attribute :ap, Types::JSON::Decimal # Ask Price
41
+ attribute :as, Types::JSON::Decimal # Ask Size
42
+ attribute :t, Types::Integer # Exchange Timestamp Unix ( ms )
43
+ attribute :x, Types::Integer # Exchange ID
44
+ attribute :r, Types::Integer # Received @ Polygon Timestamp
45
+ end
46
+
47
+ class CryptoTradeEvent < Dry::Struct
48
+ attribute :ev, Types::String.enum("XT")
49
+ attribute :pair, Types::String
50
+ attribute :p, Types::JSON::Decimal # Price
51
+ attribute :t, Types::Integer # Timestamp Unix ( ms )
52
+ attribute :s, Types::JSON::Decimal # Size
53
+ attribute :c, Types::Array.of(Types::Integer) # Condition
54
+ attribute :i, Types::String # Trade ID ( Optional )
55
+ attribute :x, Types::Integer # Exchange ID
56
+ attribute :r, Types::Integer # Received @ Polygon Timestamp
57
+ end
58
+
59
+ class CryptoAggregateEvent < Dry::Struct
60
+ attribute :ev, Types::String.enum("XA")
61
+ attribute :pair, Types::String
62
+ attribute :o, Types::JSON::Decimal # Open Price
63
+ attribute? :ox, Types::Integer # Open Exchange
64
+ attribute :h, Types::JSON::Decimal # High Price
65
+ attribute? :hx, Types::Integer # High Exchange
66
+ attribute :l, Types::JSON::Decimal # Low Price
67
+ attribute? :lx, Types::Integer # Low Exchange
68
+ attribute :c, Types::JSON::Decimal # Close Price
69
+ attribute? :cx, Types::Integer # Close Exchange
70
+ attribute :v, Types::JSON::Decimal # Volume of Trades in Tick
71
+ attribute :s, Types::Integer # Tick Start Timestamp
72
+ attribute :e, Types::Integer # Tick End Timestamp
73
+ end
74
+
75
+ class CryptoSipEvent < Dry::Struct
76
+ attribute :ev, Types::String.enum("XS")
77
+ attribute :pair, Types::String
78
+ attribute :as, Types::JSON::Decimal # Ask Size
79
+ attribute :ap, Types::JSON::Decimal # Ask Price
80
+ attribute :ax, Types::Integer # Ask Exchange
81
+ attribute :bs, Types::JSON::Decimal # Bid Size
82
+ attribute :bp, Types::JSON::Decimal # Bid Price
83
+ attribute :bx, Types::Integer # Bid Exchange
84
+ attribute :t, Types::Integer # Tick Start Timestamp
85
+ end
86
+
87
+ class CryptoLevel2Event < Dry::Struct
88
+ attribute :ev, Types::String.enum("XL2")
89
+ attribute :pair, Types::String
90
+ attribute :b, Types::Array.of(Types::Array.of(Types::JSON::Decimal))
91
+ # Bid Prices ( 100 depth cap )
92
+ # [ Price, Size ]
93
+ attribute :a, Types::Array.of(Types::Array.of(Types::JSON::Decimal))
94
+ # Ask Prices ( 100 depth cap )
95
+ # [ Price, Size ]
96
+ attribute :t, Types::Integer # Timestamp Unix ( ms )
97
+ attribute :x, Types::Integer # Exchange ID
98
+ attribute :r, Types::Integer # Tick Received @ Polygon Timestamp
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "websocket/client"
4
+ require_relative "websocket/errors"
5
+ require_relative "websocket/events"
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "massiveclient/version"
4
+
5
+ require "eventmachine"
6
+ require "faraday"
7
+ require "faraday/retry"
8
+ require "dry-struct"
9
+ require "dry-types"
10
+ require "permessage_deflate"
11
+ require "websocket/driver"
12
+
13
+ require "massiveclient/types"
14
+ require "massiveclient/rest"
15
+ require "massiveclient/websocket"
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("lib", __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "massiveclient/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "massiveclient"
9
+ spec.version = MassiveClient::VERSION
10
+ spec.authors = ["Lance Carlson"]
11
+ spec.email = ["lancecarlson@gmail.com"]
12
+
13
+ spec.license = "MIT"
14
+ spec.homepage = "https://github.com/lancecarlson/massive-rb"
15
+
16
+ spec.summary = "Client library for Massive.com (formerly Polygon.io). Massive is an API for real-time and historical market data."
17
+ spec.description = "Client library for Massive.com's REST and Websocket API's. Massive (formerly Polygon.io) is an API for real-time and historical market data for stocks, crypto, and forex."
18
+
19
+ spec.metadata = {
20
+ "source_code_uri" => "https://github.com/lancecarlson/massive-rb",
21
+ "bug_tracker_uri" => "https://github.com/lancecarlson/massive-rb/issues",
22
+ "changelog_uri" => "https://github.com/lancecarlson/massive-rb/blob/main/CHANGELOG.md"
23
+ }
24
+
25
+ spec.required_ruby_version = ">= 3.0"
26
+
27
+ # Specify which files should be added to the gem when it is released.
28
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
29
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
30
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
31
+ end
32
+ spec.bindir = "exe"
33
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
34
+ spec.require_paths = ["lib"]
35
+
36
+ spec.add_runtime_dependency "activesupport", "~> 8.0"
37
+ spec.add_runtime_dependency "dry-struct", "~> 1.2"
38
+ spec.add_runtime_dependency "dry-types", "~> 1.2"
39
+ spec.add_runtime_dependency "eventmachine", "~> 1.2"
40
+ spec.add_runtime_dependency "faraday", "~> 2.0"
41
+ spec.add_runtime_dependency "faraday-retry", "~> 2.0"
42
+ spec.add_runtime_dependency "oj", "~> 3.10"
43
+ spec.add_runtime_dependency "permessage_deflate", "~> 0.1"
44
+ spec.add_runtime_dependency "websocket-driver", "~> 0.7"
45
+
46
+ spec.add_development_dependency "bundler", "~> 2.3"
47
+ spec.add_development_dependency "dotenv", "~> 3.0"
48
+ spec.add_development_dependency "faker", "~> 3.0"
49
+ spec.add_development_dependency "minitest", "~> 5.0"
50
+ spec.add_development_dependency "rake", "~> 13.0"
51
+ spec.add_development_dependency "rubocop", "~> 1.50"
52
+ spec.add_development_dependency "rubocop-performance", "~> 1.11"
53
+ spec.add_development_dependency "vcr", "~> 6.0"
54
+ end
metadata ADDED
@@ -0,0 +1,311 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: massiveclient
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Lance Carlson
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: activesupport
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '8.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '8.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: dry-struct
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '1.2'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.2'
40
+ - !ruby/object:Gem::Dependency
41
+ name: dry-types
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.2'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.2'
54
+ - !ruby/object:Gem::Dependency
55
+ name: eventmachine
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.2'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.2'
68
+ - !ruby/object:Gem::Dependency
69
+ name: faraday
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '2.0'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '2.0'
82
+ - !ruby/object:Gem::Dependency
83
+ name: faraday-retry
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '2.0'
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '2.0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: oj
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '3.10'
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '3.10'
110
+ - !ruby/object:Gem::Dependency
111
+ name: permessage_deflate
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '0.1'
117
+ type: :runtime
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '0.1'
124
+ - !ruby/object:Gem::Dependency
125
+ name: websocket-driver
126
+ requirement: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '0.7'
131
+ type: :runtime
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '0.7'
138
+ - !ruby/object:Gem::Dependency
139
+ name: bundler
140
+ requirement: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '2.3'
145
+ type: :development
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '2.3'
152
+ - !ruby/object:Gem::Dependency
153
+ name: dotenv
154
+ requirement: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: '3.0'
159
+ type: :development
160
+ prerelease: false
161
+ version_requirements: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - "~>"
164
+ - !ruby/object:Gem::Version
165
+ version: '3.0'
166
+ - !ruby/object:Gem::Dependency
167
+ name: faker
168
+ requirement: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - "~>"
171
+ - !ruby/object:Gem::Version
172
+ version: '3.0'
173
+ type: :development
174
+ prerelease: false
175
+ version_requirements: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - "~>"
178
+ - !ruby/object:Gem::Version
179
+ version: '3.0'
180
+ - !ruby/object:Gem::Dependency
181
+ name: minitest
182
+ requirement: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - "~>"
185
+ - !ruby/object:Gem::Version
186
+ version: '5.0'
187
+ type: :development
188
+ prerelease: false
189
+ version_requirements: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - "~>"
192
+ - !ruby/object:Gem::Version
193
+ version: '5.0'
194
+ - !ruby/object:Gem::Dependency
195
+ name: rake
196
+ requirement: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - "~>"
199
+ - !ruby/object:Gem::Version
200
+ version: '13.0'
201
+ type: :development
202
+ prerelease: false
203
+ version_requirements: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - "~>"
206
+ - !ruby/object:Gem::Version
207
+ version: '13.0'
208
+ - !ruby/object:Gem::Dependency
209
+ name: rubocop
210
+ requirement: !ruby/object:Gem::Requirement
211
+ requirements:
212
+ - - "~>"
213
+ - !ruby/object:Gem::Version
214
+ version: '1.50'
215
+ type: :development
216
+ prerelease: false
217
+ version_requirements: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - "~>"
220
+ - !ruby/object:Gem::Version
221
+ version: '1.50'
222
+ - !ruby/object:Gem::Dependency
223
+ name: rubocop-performance
224
+ requirement: !ruby/object:Gem::Requirement
225
+ requirements:
226
+ - - "~>"
227
+ - !ruby/object:Gem::Version
228
+ version: '1.11'
229
+ type: :development
230
+ prerelease: false
231
+ version_requirements: !ruby/object:Gem::Requirement
232
+ requirements:
233
+ - - "~>"
234
+ - !ruby/object:Gem::Version
235
+ version: '1.11'
236
+ - !ruby/object:Gem::Dependency
237
+ name: vcr
238
+ requirement: !ruby/object:Gem::Requirement
239
+ requirements:
240
+ - - "~>"
241
+ - !ruby/object:Gem::Version
242
+ version: '6.0'
243
+ type: :development
244
+ prerelease: false
245
+ version_requirements: !ruby/object:Gem::Requirement
246
+ requirements:
247
+ - - "~>"
248
+ - !ruby/object:Gem::Version
249
+ version: '6.0'
250
+ description: Client library for Massive.com's REST and Websocket API's. Massive (formerly
251
+ Polygon.io) is an API for real-time and historical market data for stocks, crypto,
252
+ and forex.
253
+ email:
254
+ - lancecarlson@gmail.com
255
+ executables: []
256
+ extensions: []
257
+ extra_rdoc_files: []
258
+ files:
259
+ - ".gitignore"
260
+ - ".rubocop.yml"
261
+ - CHANGELOG.md
262
+ - Gemfile
263
+ - Gemfile.lock
264
+ - README.md
265
+ - Rakefile
266
+ - bin/console
267
+ - lib/massiveclient.rb
268
+ - lib/massiveclient/rest.rb
269
+ - lib/massiveclient/rest/api.rb
270
+ - lib/massiveclient/rest/api/crypto.rb
271
+ - lib/massiveclient/rest/api/forex.rb
272
+ - lib/massiveclient/rest/api/reference/locales.rb
273
+ - lib/massiveclient/rest/api/reference/markets.rb
274
+ - lib/massiveclient/rest/api/reference/stocks.rb
275
+ - lib/massiveclient/rest/api/reference/tickers.rb
276
+ - lib/massiveclient/rest/api/stocks.rb
277
+ - lib/massiveclient/rest/client.rb
278
+ - lib/massiveclient/rest/errors.rb
279
+ - lib/massiveclient/types.rb
280
+ - lib/massiveclient/version.rb
281
+ - lib/massiveclient/websocket.rb
282
+ - lib/massiveclient/websocket/client.rb
283
+ - lib/massiveclient/websocket/errors.rb
284
+ - lib/massiveclient/websocket/events.rb
285
+ - massiveclient.gemspec
286
+ homepage: https://github.com/lancecarlson/massive-rb
287
+ licenses:
288
+ - MIT
289
+ metadata:
290
+ source_code_uri: https://github.com/lancecarlson/massive-rb
291
+ bug_tracker_uri: https://github.com/lancecarlson/massive-rb/issues
292
+ changelog_uri: https://github.com/lancecarlson/massive-rb/blob/main/CHANGELOG.md
293
+ rdoc_options: []
294
+ require_paths:
295
+ - lib
296
+ required_ruby_version: !ruby/object:Gem::Requirement
297
+ requirements:
298
+ - - ">="
299
+ - !ruby/object:Gem::Version
300
+ version: '3.0'
301
+ required_rubygems_version: !ruby/object:Gem::Requirement
302
+ requirements:
303
+ - - ">="
304
+ - !ruby/object:Gem::Version
305
+ version: '0'
306
+ requirements: []
307
+ rubygems_version: 3.6.9
308
+ specification_version: 4
309
+ summary: Client library for Massive.com (formerly Polygon.io). Massive is an API for
310
+ real-time and historical market data.
311
+ test_files: []