ib-api 972.3.1 → 972.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 308cf77f0e3710e72998e8f645c7fd1465d7be1831a9ddc48b673499e1533709
4
- data.tar.gz: 7695bd42bf2d174dd124fc93bb2786d77f0301ef63a62f6918c6115dd6aca5df
3
+ metadata.gz: fe3f4d98e27f1480eafe5ed066e42410fc97527fef692aba69b02a1db61836de
4
+ data.tar.gz: 8e9e733f6e383313a4c4275d5f95853944c573fb543c78f85280d41988c0e842
5
5
  SHA512:
6
- metadata.gz: 3f9da9a7fc9cef3ff061cc48c0f3508be2b7111f70fe65111cf8683efb03b33e7a80ad2a56093206bed15223adb6e2155c104db1e3f5a36cff52faf46a82e064
7
- data.tar.gz: f7d6ac4e1a73efdeed9032e6302df00efa3881ffaa98ca6ff557cc9c989d89c245e8a7782ecf0be0ba75f5cea938d839090ac92ca696fa78fef8e8b514b5d769
6
+ metadata.gz: 306dfc26bb138a25e1f9136a24f590d47ac1f555f94936960287937888e50c107bb7bc6f5c9f802ceb6096218a4c4a22ba363b36bccb47f25c206ea6f71b0772
7
+ data.tar.gz: 4d97ce95ccc74a2c3b6d1d88b0472433b0a9382bc5433d0fd100337d6906a84570d09c363e8282e44259deb0bf8f21cfe80814a904d46e8379938ec8b7f67b9a
data/Gemfile.lock CHANGED
@@ -1,22 +1,22 @@
1
1
  GIT
2
2
  remote: https://github.com/ohler55/ox.git
3
- revision: 67ce6ecb45a0d1354e1f8ed9a155826ba986e21e
3
+ revision: 59c4234fe01fb5de08d49b39ecf5fc7338c1ffdc
4
4
  specs:
5
- ox (2.13.4)
5
+ ox (2.14.4)
6
6
 
7
7
  PATH
8
8
  remote: .
9
9
  specs:
10
- ib-api (972.2)
10
+ ib-api (972.3.1)
11
11
  activemodel
12
12
  activesupport (>= 6.0)
13
13
 
14
14
  GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
- activemodel (6.1.2.1)
18
- activesupport (= 6.1.2.1)
19
- activesupport (6.1.2.1)
17
+ activemodel (6.1.3.2)
18
+ activesupport (= 6.1.3.2)
19
+ activesupport (6.1.3.2)
20
20
  concurrent-ruby (~> 1.0, >= 1.0.2)
21
21
  i18n (>= 1.6, < 2)
22
22
  minitest (>= 5.1)
@@ -25,7 +25,7 @@ GEM
25
25
  coderay (1.1.3)
26
26
  concurrent-ruby (1.1.8)
27
27
  diff-lcs (1.4.4)
28
- ffi (1.13.1)
28
+ ffi (1.15.0)
29
29
  formatador (0.2.5)
30
30
  guard (2.16.2)
31
31
  formatador (>= 0.2.4)
@@ -41,52 +41,52 @@ GEM
41
41
  guard (~> 2.1)
42
42
  guard-compat (~> 1.1)
43
43
  rspec (>= 2.99.0, < 4.0)
44
- i18n (1.8.9)
44
+ i18n (1.8.10)
45
45
  concurrent-ruby (~> 1.0)
46
- listen (3.2.1)
46
+ listen (3.5.1)
47
47
  rb-fsevent (~> 0.10, >= 0.10.3)
48
48
  rb-inotify (~> 0.9, >= 0.9.10)
49
49
  lumberjack (1.2.8)
50
50
  method_source (1.0.0)
51
- minitest (5.14.3)
51
+ minitest (5.14.4)
52
52
  nenv (0.3.0)
53
53
  notiffany (0.1.3)
54
54
  nenv (~> 0.1)
55
55
  shellany (~> 0.0)
56
- pry (0.13.1)
56
+ pry (0.14.1)
57
57
  coderay (~> 1.1)
58
58
  method_source (~> 1.0)
59
- rake (13.0.1)
60
- rb-fsevent (0.10.4)
59
+ rake (13.0.3)
60
+ rb-fsevent (0.11.0)
61
61
  rb-inotify (0.10.1)
62
62
  ffi (~> 1.0)
63
- rspec (3.9.0)
64
- rspec-core (~> 3.9.0)
65
- rspec-expectations (~> 3.9.0)
66
- rspec-mocks (~> 3.9.0)
63
+ rspec (3.10.0)
64
+ rspec-core (~> 3.10.0)
65
+ rspec-expectations (~> 3.10.0)
66
+ rspec-mocks (~> 3.10.0)
67
67
  rspec-collection_matchers (1.2.0)
68
68
  rspec-expectations (>= 2.99.0.beta1)
69
- rspec-core (3.9.3)
70
- rspec-support (~> 3.9.3)
71
- rspec-expectations (3.9.2)
69
+ rspec-core (3.10.1)
70
+ rspec-support (~> 3.10.0)
71
+ rspec-expectations (3.10.1)
72
72
  diff-lcs (>= 1.2.0, < 2.0)
73
- rspec-support (~> 3.9.0)
73
+ rspec-support (~> 3.10.0)
74
74
  rspec-its (1.3.0)
75
75
  rspec-core (>= 3.0.0)
76
76
  rspec-expectations (>= 3.0.0)
77
- rspec-mocks (3.9.1)
77
+ rspec-mocks (3.10.2)
78
78
  diff-lcs (>= 1.2.0, < 2.0)
79
- rspec-support (~> 3.9.0)
80
- rspec-support (3.9.3)
79
+ rspec-support (~> 3.10.0)
80
+ rspec-support (3.10.2)
81
81
  shellany (0.0.1)
82
- thor (1.0.1)
82
+ thor (1.1.0)
83
83
  tzinfo (2.0.4)
84
84
  concurrent-ruby (~> 1.0)
85
85
  value_semantics (3.6.0)
86
86
  zeitwerk (2.4.2)
87
87
 
88
88
  PLATFORMS
89
- ruby
89
+ x86_64-linux
90
90
 
91
91
  DEPENDENCIES
92
92
  bundler
@@ -101,4 +101,4 @@ DEPENDENCIES
101
101
  value_semantics
102
102
 
103
103
  BUNDLED WITH
104
- 1.17.3
104
+ 2.2.3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 972.3.1
1
+ 972.4
data/bin/console CHANGED
@@ -10,8 +10,6 @@
10
10
  require 'bundler/setup'
11
11
  require 'yaml'
12
12
 
13
- require 'logger'
14
-
15
13
  require 'ib-api'
16
14
 
17
15
  class Array
@@ -47,7 +45,6 @@ read_yml = -> (key) do
47
45
  puts "Namespace is IB ! "
48
46
  puts
49
47
  puts '-'* 45
50
- include LogDev
51
48
  include IB
52
49
  require 'irb'
53
50
  client_id = ARGV[1] || read_yml[:client_id]
@@ -62,16 +59,15 @@ read_yml = -> (key) do
62
59
  end
63
60
 
64
61
  ARGV.clear
65
- logger = default_logger # Logger.new STDOUT
66
62
 
67
63
  ## The Block takes instructions which are executed after initializing all instance-variables
68
64
  ## and prior to the connection-process
69
65
  ## Here we just subscribe to some events
70
66
  C = Connection.new client_id: client_id, port: port do |c| # future use__ , optional_capacities: "+PACEAPI" do |c|
71
67
 
72
- c.subscribe( :ContractData, :BondContractData) { |msg| logger.info { msg.contract.to_human } }
73
- c.subscribe( :Alert, :ContractDataEnd, :ManagedAccounts, :OrderStatus ) {| m| logger.info { m.to_human } }
74
- c.subscribe( :PortfolioValue, :AccountValue, :OrderStatus, :OpenOrderEnd, :ExecutionData ) {| m| logger.info { m.to_human }}
68
+ c.subscribe( :ContractData, :BondContractData) { |msg| c.logger.info { msg.contract.to_human } }
69
+ c.subscribe( :Alert, :ContractDataEnd, :ManagedAccounts, :OrderStatus ) {| m| c.logger.info { m.to_human } }
70
+ c.subscribe( :PortfolioValue, :AccountValue, :OrderStatus, :OpenOrderEnd, :ExecutionData ) {| m| c.logger.info { m.to_human }}
75
71
  # c.subscribe :ManagedAccounts do |msg|
76
72
  # puts "------------------------------- Managed Accounts ----------------------------------"
77
73
  # puts "Detected Accounts: #{msg.accounts.account.join(' -- ')} "
@@ -79,8 +75,8 @@ read_yml = -> (key) do
79
75
  # end
80
76
 
81
77
  c.subscribe( :OpenOrder){ |msg| "Open Order detected and stored: C.received[:OpenOrders] " }
82
- c.logger.level = Logger::INFO
83
78
  end
79
+ C.logger.level = Logger::INFO
84
80
  unless C.received[:OpenOrder].blank?
85
81
  puts "------------------------------- OpenOrders ----------------------------------"
86
82
  puts C.received[:OpenOrder].to_human.join "\n"
data/lib/ib/connection.rb CHANGED
@@ -1,14 +1,10 @@
1
1
  require 'thread'
2
2
  #require 'active_support'
3
3
  require 'ib/socket'
4
- require 'ib/logger'
4
+ require 'logger'
5
+ require 'logging'
5
6
  require 'ib/messages'
6
7
 
7
- module TechnicalAnalysis
8
- module Signals
9
- end
10
- end
11
-
12
8
  module IB
13
9
  # Encapsulates API connection to TWS or Gateway
14
10
  class Connection
@@ -23,10 +19,9 @@ module IB
23
19
  ## public data-queue: received, received?, wait_for, clear_received
24
20
  ## misc: reader_running?
25
21
 
26
- include LogDev # provides default_logger
22
+ include Support::Logging # provides default_logger
27
23
 
28
24
  mattr_accessor :current
29
- mattr_accessor :logger ## borrowed from active_support
30
25
  # Please note, we are realizing only the most current TWS protocol versions,
31
26
  # thus improving performance at the expense of backwards compatibility.
32
27
  # Older protocol versions support can be found in older gem versions.
@@ -45,7 +40,7 @@ module IB
45
40
  connect: true, # Connect at initialization
46
41
  received: true, # Keep all received messages in a @received Hash
47
42
  # redis: false, # future plans
48
- logger: default_logger,
43
+ logger: nil,
49
44
  client_id: rand( 1001 .. 9999 ) ,
50
45
  client_version: IB::Messages::CLIENT_VERSION, # lib/ib/server_versions.rb
51
46
  optional_capacities: "", # TWS-Version 974: "+PACEAPI"
@@ -54,17 +49,13 @@ module IB
54
49
  # V 974 release motes
55
50
  # API messages sent at a higher rate than 50/second can now be paced by TWS at the 50/second rate instead of potentially causing a disconnection. This is now done automatically by the RTD Server API and can be done with other API technologies by invoking SetConnectOptions("+PACEAPI") prior to eConnect.
56
51
 
57
-
52
+ self.class.configure_logger logger
58
53
  # convert parameters into instance-variables and assign them
59
- method(__method__).parameters.each do |type, k|
60
- next unless type == :key
61
- case k
62
- when :logger
63
- self.logger = logger
64
- else
54
+ method(__method__).parameters.each do |type, k|
55
+ next unless type == :key ## available: key , keyrest
56
+ next if k.to_s == 'logger'
65
57
  v = eval(k.to_s)
66
58
  instance_variable_set("@#{k}", v) unless v.nil?
67
- end
68
59
  end
69
60
 
70
61
  # A couple of locks to avoid race conditions in JRuby
@@ -84,9 +75,9 @@ module IB
84
75
  yield self if block_given?
85
76
 
86
77
  self.subscribe(:NextValidId) do |msg|
87
- logger.progname = "Connection#connect"
78
+ self.logger.progname = "Connection#connect"
88
79
  self.next_local_id = msg.local_id
89
- logger.info { "Got next valid order id: #{next_local_id}." }
80
+ self.logger.info { "Got next valid order id: #{next_local_id}." }
90
81
  end
91
82
 
92
83
  # Ensure the transmission of NextValidId.
data/lib/ib/logger.rb CHANGED
@@ -18,7 +18,7 @@ module LogDev
18
18
  end
19
19
 
20
20
  # Add universally accessible log method/accessor into Object
21
- def log *args
21
+ def logger *args
22
22
  default_logger.tap do |logger|
23
23
  logger.fatal *args unless args.empty?
24
24
  end
data/lib/logging.rb ADDED
@@ -0,0 +1,45 @@
1
+ #module Kernel
2
+ # private
3
+ # def this_method_name
4
+ # caller[0] =~ /`([^']*)'/ and $1
5
+ # end
6
+ # see also __method__ and __callee__
7
+ #end
8
+
9
+
10
+
11
+ module Support
12
+ module Logging
13
+ def self.included(base)
14
+ base.extend ClassMethods
15
+ base.send :define_method, :logger do
16
+ base.logger
17
+ end
18
+ end
19
+
20
+ module ClassMethods
21
+ def logger
22
+ @logger
23
+ end
24
+
25
+ def logger=(logger)
26
+ @logger = logger
27
+ end
28
+
29
+ def configure_logger(log=nil)
30
+ if log
31
+ @logger = log
32
+ else
33
+ @logger = Logger.new(STDOUT)
34
+ @logger.level = Logger::INFO
35
+ @logger.formatter = proc do |severity, datetime, progname, msg|
36
+ # "#{datetime.strftime("%d.%m.(%X)")}#{"%5s" % severity}->#{msg}\n"
37
+ "#{"%5s" % severity}::#{msg}\n"
38
+ end
39
+ @logger.debug "------------------------------ start logging ----------------------------"
40
+ end # branch
41
+ end # def
42
+ end # module ClassMethods
43
+ end # module Logging
44
+ end # module Support
45
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ib-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 972.3.1
4
+ version: '972.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hartmut Bischoff
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-08 00:00:00.000000000 Z
11
+ date: 2021-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -142,6 +142,7 @@ files:
142
142
  - lib/ib/socket.rb
143
143
  - lib/ib/support.rb
144
144
  - lib/ib/version.rb
145
+ - lib/logging.rb
145
146
  - lib/models/ib/account.rb
146
147
  - lib/models/ib/account_value.rb
147
148
  - lib/models/ib/bag.rb