t-tech-investments 0.1.0 → 0.1.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.cursor/rules/git-flow.mdc +49 -5
  3. data/.cursor/rules/sdk-architecture.mdc +30 -0
  4. data/.cursor/rules/sdk-code-standards.mdc +22 -0
  5. data/.cursor/rules/sdk-patterns.mdc +22 -0
  6. data/.cursor/rules/sdk-testing.mdc +19 -0
  7. data/CHANGELOG.md +4 -0
  8. data/README.md +195 -4
  9. data/Rakefile +4 -0
  10. data/contracts.lock +6 -0
  11. data/lib/t/tech/investments/client.rb +70 -0
  12. data/lib/t/tech/investments/coercers.rb +171 -0
  13. data/lib/t/tech/investments/configuration.rb +74 -0
  14. data/lib/t/tech/investments/errors.rb +24 -0
  15. data/lib/t/tech/investments/proto/common_pb.rb +42 -0
  16. data/lib/t/tech/investments/proto/google/api/field_behavior_pb.rb +19 -0
  17. data/lib/t/tech/investments/proto/instruments_pb.rb +157 -0
  18. data/lib/t/tech/investments/proto/instruments_services_pb.rb +115 -0
  19. data/lib/t/tech/investments/proto/marketdata_pb.rb +99 -0
  20. data/lib/t/tech/investments/proto/marketdata_services_pb.rb +68 -0
  21. data/lib/t/tech/investments/proto/operations_pb.rb +78 -0
  22. data/lib/t/tech/investments/proto/operations_services_pb.rb +67 -0
  23. data/lib/t/tech/investments/proto/orders_pb.rb +64 -0
  24. data/lib/t/tech/investments/proto/orders_services_pb.rb +69 -0
  25. data/lib/t/tech/investments/proto/sandbox_pb.rb +37 -0
  26. data/lib/t/tech/investments/proto/sandbox_services_pb.rb +75 -0
  27. data/lib/t/tech/investments/proto/signals_pb.rb +37 -0
  28. data/lib/t/tech/investments/proto/signals_services_pb.rb +36 -0
  29. data/lib/t/tech/investments/proto/stoporders_pb.rb +45 -0
  30. data/lib/t/tech/investments/proto/stoporders_services_pb.rb +38 -0
  31. data/lib/t/tech/investments/proto/users_pb.rb +47 -0
  32. data/lib/t/tech/investments/proto/users_services_pb.rb +51 -0
  33. data/lib/t/tech/investments/proto_loader.rb +49 -0
  34. data/lib/t/tech/investments/services/market_data_facade.rb +35 -0
  35. data/lib/t/tech/investments/services/market_data_stream_session.rb +148 -0
  36. data/lib/t/tech/investments/services/registry.rb +38 -0
  37. data/lib/t/tech/investments/services/unary_adapter.rb +64 -0
  38. data/lib/t/tech/investments/services.rb +6 -0
  39. data/lib/t/tech/investments/transport.rb +137 -0
  40. data/lib/t/tech/investments/version.rb +1 -1
  41. data/lib/t/tech/investments.rb +30 -1
  42. data/script/regenerate_proto +119 -0
  43. data/sig/t/tech/investments.rbs +114 -1
  44. metadata +67 -4
@@ -2,7 +2,120 @@ module T
2
2
  module Tech
3
3
  module Investments
4
4
  VERSION: String
5
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
5
+
6
+ class Error < StandardError; end
7
+
8
+ def self.configuration: () -> Configuration
9
+ def self.configuration=: (Configuration) -> Configuration
10
+ def self.configure: () { (Configuration) -> void } -> Configuration
11
+ def self.client: (?Hash[Symbol, untyped] overrides) -> Client
6
12
  end
7
13
  end
8
14
  end
15
+
16
+ module T::Tech::Investments::Errors
17
+ class Base < T::Tech::Investments::Error; end
18
+
19
+ class ConfigurationError < Base; end
20
+
21
+ class GrpcError < Base
22
+ attr_reader code: Integer?
23
+ attr_reader details: String?
24
+ attr_reader tracking_id: String?
25
+
26
+ def initialize: (String message, ?code: Integer, ?details: String, ?tracking_id: String) -> void
27
+ end
28
+ end
29
+
30
+ module T::Tech::Investments
31
+ class Configuration
32
+ attr_accessor token: String?
33
+ attr_accessor endpoint: String?
34
+ attr_accessor timeout: Integer?
35
+ attr_accessor app_name: String?
36
+ attr_accessor logger: Logger?
37
+ attr_accessor ssl_ca_certs: String?
38
+
39
+ def self.from_env: () -> Configuration
40
+ def initialize: () -> void
41
+ def merge: (Hash[Symbol, untyped] overrides) -> Configuration
42
+ def validate!: () -> self
43
+ def snapshot: () -> Configuration::Snapshot
44
+
45
+ class Snapshot
46
+ attr_reader token: String
47
+ attr_reader endpoint: String
48
+ attr_reader timeout: Integer
49
+ attr_reader app_name: String?
50
+ attr_reader logger: Logger?
51
+ attr_reader ssl_ca_certs: String?
52
+
53
+ def validate!: () -> self
54
+ end
55
+ end
56
+
57
+ module Coercers
58
+ def self.to_request: (Class message_class, Hash[Symbol, untyped] | Hash[String, untyped]? hash) -> untyped
59
+ def self.to_hash: (untyped message, ?ruby_friendly: bool) -> Hash[Symbol, untyped]
60
+ end
61
+
62
+ class Transport
63
+ attr_reader config: Configuration::Snapshot
64
+
65
+ def initialize: (Configuration::Snapshot config_snapshot) -> void
66
+ def stub: (Class stub_class) -> untyped
67
+ def unary: (untyped stub_instance, Symbol method_name, untyped request, ?timeout: Integer) -> untyped
68
+ def bidi_stream: (untyped stub_instance, Symbol method_name, Enumerator[untyped] request_enum, ?timeout: Integer) -> Enumerator[untyped]
69
+ def close: () -> void
70
+ end
71
+
72
+ module ProtoLoader
73
+ def self.load!: () -> void
74
+ end
75
+
76
+ module Services
77
+ class UnaryAdapter
78
+ attr_reader service_class: Class
79
+ attr_reader transport: Transport
80
+ attr_reader stub: untyped
81
+ def initialize: (Class service_class, Transport transport) -> void
82
+ end
83
+
84
+ module Registry
85
+ def self.service_class: (Symbol name) -> Class
86
+ def self.service_names: () -> Array[Symbol]
87
+ end
88
+
89
+ class MarketDataStreamSession
90
+ def initialize: (Transport transport, ?timeout: Integer) -> void
91
+ def subscribe_candles: (**untyped kwargs) -> void
92
+ def subscribe_order_book: (**untyped kwargs) -> void
93
+ def subscribe_trades: (**untyped kwargs) -> void
94
+ def subscribe_info: (**untyped kwargs) -> void
95
+ def subscribe_last_price: (**untyped kwargs) -> void
96
+ def get_my_subscriptions: () -> void
97
+ def each_event: () { (Hash[Symbol, untyped]) -> void } -> void
98
+ def each_event: () -> Enumerator[Hash[Symbol, untyped]]
99
+ end
100
+
101
+ class MarketDataFacade
102
+ def initialize: (UnaryAdapter unary_adapter, Transport transport) -> void
103
+ def stream: (?timeout: Integer) { (MarketDataStreamSession) -> void } -> void
104
+ end
105
+ end
106
+
107
+ class Client
108
+ attr_reader config: Configuration::Snapshot
109
+
110
+ def initialize: (Configuration::Snapshot config_snapshot) -> void
111
+ def transport: () -> Transport
112
+ def users: () -> Services::UnaryAdapter
113
+ def instruments: () -> Services::UnaryAdapter
114
+ def market_data: () -> Services::MarketDataFacade
115
+ def operations: () -> Services::UnaryAdapter
116
+ def orders: () -> Services::UnaryAdapter
117
+ def sandbox: () -> Services::UnaryAdapter
118
+ def stop_orders: () -> Services::UnaryAdapter
119
+ def signals: () -> Services::UnaryAdapter
120
+ end
121
+ end
metadata CHANGED
@@ -1,16 +1,44 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: t-tech-investments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pushkin Ivan
8
8
  bindir: exe
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
- dependencies: []
12
- description: Ruby wrapper over T-Bank Invest gRPC API (invest-contracts). Provides
13
- a typed client for brokerage accounts, instruments, orders, and market data streams.
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: google-protobuf
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '3.25'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '3.25'
26
+ - !ruby/object:Gem::Dependency
27
+ name: grpc
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '1.60'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.60'
40
+ description: Ruby wrapper over T-Bank Invest gRPC API (invest-contracts). Typed client
41
+ for accounts, instruments, orders, and market data streams.
14
42
  email:
15
43
  - naveroot@gmail.com
16
44
  executables: []
@@ -18,13 +46,48 @@ extensions: []
18
46
  extra_rdoc_files: []
19
47
  files:
20
48
  - ".cursor/rules/git-flow.mdc"
49
+ - ".cursor/rules/sdk-architecture.mdc"
50
+ - ".cursor/rules/sdk-code-standards.mdc"
51
+ - ".cursor/rules/sdk-patterns.mdc"
52
+ - ".cursor/rules/sdk-testing.mdc"
21
53
  - CHANGELOG.md
22
54
  - CODE_OF_CONDUCT.md
23
55
  - LICENSE.txt
24
56
  - README.md
25
57
  - Rakefile
58
+ - contracts.lock
26
59
  - lib/t/tech/investments.rb
60
+ - lib/t/tech/investments/client.rb
61
+ - lib/t/tech/investments/coercers.rb
62
+ - lib/t/tech/investments/configuration.rb
63
+ - lib/t/tech/investments/errors.rb
64
+ - lib/t/tech/investments/proto/common_pb.rb
65
+ - lib/t/tech/investments/proto/google/api/field_behavior_pb.rb
66
+ - lib/t/tech/investments/proto/instruments_pb.rb
67
+ - lib/t/tech/investments/proto/instruments_services_pb.rb
68
+ - lib/t/tech/investments/proto/marketdata_pb.rb
69
+ - lib/t/tech/investments/proto/marketdata_services_pb.rb
70
+ - lib/t/tech/investments/proto/operations_pb.rb
71
+ - lib/t/tech/investments/proto/operations_services_pb.rb
72
+ - lib/t/tech/investments/proto/orders_pb.rb
73
+ - lib/t/tech/investments/proto/orders_services_pb.rb
74
+ - lib/t/tech/investments/proto/sandbox_pb.rb
75
+ - lib/t/tech/investments/proto/sandbox_services_pb.rb
76
+ - lib/t/tech/investments/proto/signals_pb.rb
77
+ - lib/t/tech/investments/proto/signals_services_pb.rb
78
+ - lib/t/tech/investments/proto/stoporders_pb.rb
79
+ - lib/t/tech/investments/proto/stoporders_services_pb.rb
80
+ - lib/t/tech/investments/proto/users_pb.rb
81
+ - lib/t/tech/investments/proto/users_services_pb.rb
82
+ - lib/t/tech/investments/proto_loader.rb
83
+ - lib/t/tech/investments/services.rb
84
+ - lib/t/tech/investments/services/market_data_facade.rb
85
+ - lib/t/tech/investments/services/market_data_stream_session.rb
86
+ - lib/t/tech/investments/services/registry.rb
87
+ - lib/t/tech/investments/services/unary_adapter.rb
88
+ - lib/t/tech/investments/transport.rb
27
89
  - lib/t/tech/investments/version.rb
90
+ - script/regenerate_proto
28
91
  - sig/t/tech/investments.rbs
29
92
  homepage: https://github.com/naveroot/t-tech-investments
30
93
  licenses: