cryptum 0.0.333 → 0.0.335

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2adb75d68ee11c3e0a5ea432d5ef0518446fd37083e3e32eacbc04ace27ed2a
4
- data.tar.gz: 62cf49edadc308f82b464f3de1a4a80cfc1a45eec22b5f24d3e2fe215cf455a5
3
+ metadata.gz: 2e7aaa092e4bed9f901e33220f92b8c265967a232d65c10f7552fb568724bbdc
4
+ data.tar.gz: 52cb04ca782b3ff1fd86093b63542ba2a08f3e49faa048f07b4e91bdb08b6095
5
5
  SHA512:
6
- metadata.gz: 027211af32c6656c290a49916084d18edc818e897a4e4bdf6024fbbfe8da6089bbb239cd86f9098e8b4a4b045a11227f8efa06e2fcef6e9b1a3ef3749551c515
7
- data.tar.gz: 2c1e57c57e339c51996f29b977134669581f76bd4c51985285c989751334684507db164d5ac3eb8a1e9956fbc218c246a11846bc1c5ff8f01ef34291a34527f7
6
+ metadata.gz: 528dc2029f683179d4b355472fc23be687d63fef3cdd87d6203f307b5baf1643d2721d24956474f20ff6826d8e779d54419139e4696db2e5e538da0d347f700a
7
+ data.tar.gz: 48d45e80779b3f436ce285e1fdabd458ae6f57bc5d3e2da585a46b0df134002a8dd52472835e9af08e24fbf92ec4d1d46228512ed117da5640fcc82340bdf3b5
data/Gemfile CHANGED
@@ -17,6 +17,7 @@ gem 'bundler-audit', '0.9.1'
17
17
  gem 'curses', '1.4.4'
18
18
  gem 'eventmachine', '1.2.7'
19
19
  gem 'faye-websocket', '0.11.1'
20
+ gem 'permessage_deflate', '0.1.4'
20
21
  gem 'pry', '0.14.1'
21
22
  gem 'pry-doc', '1.3.0'
22
23
  gem 'rake', '13.0.6'
@@ -34,3 +35,4 @@ gem 'sinatra', '3.0.4'
34
35
  gem 'thin', '1.8.1'
35
36
  gem 'tty-prompt', '0.23.1'
36
37
  gem 'tty-spinner', '0.9.3'
38
+ gem 'websocket-extensions', '0.1.5'
data/lib/cryptum/api.rb CHANGED
@@ -86,9 +86,7 @@ module Cryptum
86
86
  api_secret = env[:api_secret]
87
87
  api_passphrase = env[:api_passphrase]
88
88
  api_endpoint = 'https://api.exchange.coinbase.com'
89
- api_endpoint = 'https://api-public.sandbox.pro.coinbase.com' if env[:env] == :sandbox
90
- # api_endpoint = 'https://api.pro.coinbase.com'
91
- # api_endpoint = 'https://api-public.sandbox.pro.coinbase.com' if env[:env] == :sandbox
89
+ api_endpoint = 'https://api-public.sandbox.exchange.coinbase.com' if env[:env] == :sandbox
92
90
  api_endpoint = opts[:api_endpoint] if opts[:api_endpoint]
93
91
 
94
92
  http_method = if opts[:http_method].nil?
@@ -409,30 +407,30 @@ module Cryptum
409
407
  raise e
410
408
  end
411
409
 
412
- public_class_method def self.cancel_open_order(opts = {})
413
- env = opts[:env]
414
- option_choice = opts[:option_choice]
415
- order_id = opts[:order_id]
416
- order_type = opts[:order_type]
410
+ # public_class_method def self.cancel_open_order(opts = {})
411
+ # env = opts[:env]
412
+ # option_choice = opts[:option_choice]
413
+ # order_id = opts[:order_id]
414
+ # order_type = opts[:order_type]
417
415
 
418
- product_id = option_choice.symbol.to_s.gsub('_', '-').upcase
416
+ # product_id = option_choice.symbol.to_s.gsub('_', '-').upcase
419
417
 
420
- order_hash = {}
421
- order_hash[:product_id] = product_id
418
+ # order_hash = {}
419
+ # order_hash[:product_id] = product_id
422
420
 
423
- params = order_hash
421
+ # params = order_hash
424
422
 
425
- rest_api_call(
426
- env: env,
427
- http_method: :DELETE,
428
- api_call: "/orders/#{order_id}",
429
- option_choice: option_choice,
430
- params: params,
431
- order_type: order_type
432
- )
433
- rescue StandardError => e
434
- raise e
435
- end
423
+ # rest_api_call(
424
+ # env: env,
425
+ # http_method: :DELETE,
426
+ # api_call: "/orders/#{order_id}",
427
+ # option_choice: option_choice,
428
+ # params: params,
429
+ # order_type: order_type
430
+ # )
431
+ # rescue StandardError => e
432
+ # raise e
433
+ # end
436
434
 
437
435
  public_class_method def self.cancel_all_open_orders(opts = {})
438
436
  env = opts[:env]
@@ -490,7 +488,7 @@ module Cryptum
490
488
  raise e
491
489
  end
492
490
 
493
- public_class_method def self.get_exchange_rates(opts = {})
491
+ private_class_method def self.get_exchange_rates(opts = {})
494
492
  option_choice = opts[:option_choice]
495
493
  env = opts[:env]
496
494
 
@@ -590,32 +588,32 @@ module Cryptum
590
588
  raise e
591
589
  end
592
590
 
593
- public_class_method def self.get_profiles(opts = {})
594
- option_choice = opts[:option_choice]
595
- env = opts[:env]
591
+ # public_class_method def self.get_profiles(opts = {})
592
+ # option_choice = opts[:option_choice]
593
+ # env = opts[:env]
596
594
 
597
- profiles_api_call = '/profiles'
595
+ # profiles_api_call = '/profiles'
598
596
 
599
- # We don't always get fees back from Coinbase...
600
- # This is a hack to ensure we do.
601
- profiles = {}
602
- # loop do
603
- profiles = rest_api_call(
604
- option_choice: option_choice,
605
- env: env,
606
- http_method: :GET,
607
- api_call: profiles_api_call
608
- )
597
+ # # We don't always get fees back from Coinbase...
598
+ # # This is a hack to ensure we do.
599
+ # profiles = {}
600
+ # # loop do
601
+ # profiles = rest_api_call(
602
+ # option_choice: option_choice,
603
+ # env: env,
604
+ # http_method: :GET,
605
+ # api_call: profiles_api_call
606
+ # )
609
607
 
610
- # break unless fees.empty?
608
+ # # break unless fees.empty?
611
609
 
612
- # sleep 0.3
613
- # end
610
+ # # sleep 0.3
611
+ # # end
614
612
 
615
- profiles
616
- rescue StandardError => e
617
- raise e
618
- end
613
+ # profiles
614
+ # rescue StandardError => e
615
+ # raise e
616
+ # end
619
617
 
620
618
  public_class_method def self.get_order_history(opts = {})
621
619
  option_choice = opts[:option_choice]
@@ -28,10 +28,21 @@ module Cryptum
28
28
 
29
29
  sequence = event[:sequence].to_i
30
30
  last_sequence = order_book[:sequence].to_i
31
+ order_book[:sequence] = sequence
31
32
 
32
- raise "ERROR: Sequence Order Mismatch - #{last_sequence} #{sequence}" unless sequence >= last_sequence
33
+ return unless sequence >= last_sequence
34
+
35
+ if last_sequence + 1 < sequence
36
+ sequence_diff = sequence - last_sequence
37
+ f.puts Time.now.strftime('%Y-%m-%d %H:%M:%S.%N %z')
38
+ f.puts "Module: #{self}"
39
+ f.puts 'Messages likely dropped:'
40
+ f.puts "This Sequence: #{sequence}"
41
+ f.puts "Last Sequence: #{last_sequence}"
42
+ f.puts "Sequence Diff: #{sequence_diff}\n\n\n"
43
+ end
44
+ # raise "ERROR: Sequence Order Mismatch - #{last_sequence} #{sequence}" unless sequence >= last_sequence
33
45
 
34
- order_book[:sequence] = sequence
35
46
  open_24h = event[:open_24h].to_f
36
47
  order_book[:open_24h] = open_24h
37
48
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.333'
4
+ VERSION = '0.0.335'
5
5
  end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'faye/websocket'
4
+ require 'websocket/extensions'
5
+ require 'permessage_deflate'
4
6
 
5
7
  module Cryptum
6
8
  # This plugin is used to Establish a Web
@@ -14,8 +16,13 @@ module Cryptum
14
16
  option_choice = opts[:option_choice]
15
17
  env = opts[:env]
16
18
 
17
- cb_pro_ws_feed = 'wss://ws-feed.pro.coinbase.com'
18
- cb_pro_ws_feed = 'wss://ws-feed-public.sandbox.pro.coinbase.com' if env[:env] == :sandbox
19
+ # cb_pro_ws_feed = 'wss://ws-feed.pro.coinbase.com'
20
+ # cb_pro_ws_feed = 'wss://ws-feed-public.sandbox.pro.coinbase.com' if env[:env] == :sandbox
21
+ cb_pro_ws_feed = 'wss://ws-feed.exchange.coinbase.com'
22
+ cb_pro_ws_feed = 'wss://ws-feed-public.sandbox.exchange.coinbase.com' if env[:env] == :sandbox
23
+
24
+ extensions = [PermessageDeflate]
25
+
19
26
  if option_choice.proxy
20
27
  tls_opts = {
21
28
  verify_peer: false
@@ -30,13 +37,15 @@ module Cryptum
30
37
  [],
31
38
  tls: tls_opts,
32
39
  proxy: proxy_opts,
33
- ping: 30
40
+ extensions: extensions,
41
+ ping: 9
34
42
  )
35
43
  else
36
44
  ws = Faye::WebSocket::Client.new(
37
45
  cb_pro_ws_feed,
38
46
  [],
39
- ping: 30
47
+ extensions: extensions,
48
+ ping: 9
40
49
  )
41
50
  end
42
51
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.333
4
+ version: 0.0.335
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.11.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: permessage_deflate
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 0.1.4
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 0.1.4
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: pry
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -332,6 +346,20 @@ dependencies:
332
346
  - - '='
333
347
  - !ruby/object:Gem::Version
334
348
  version: 0.9.3
349
+ - !ruby/object:Gem::Dependency
350
+ name: websocket-extensions
351
+ requirement: !ruby/object:Gem::Requirement
352
+ requirements:
353
+ - - '='
354
+ - !ruby/object:Gem::Version
355
+ version: 0.1.5
356
+ type: :runtime
357
+ prerelease: false
358
+ version_requirements: !ruby/object:Gem::Requirement
359
+ requirements:
360
+ - - '='
361
+ - !ruby/object:Gem::Version
362
+ version: 0.1.5
335
363
  description: Personalized High-Frequency Trading Bot
336
364
  email:
337
365
  - request.pentest@0dayinc.com