snaptrade 2.0.119 → 2.0.121

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,37 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: api@snaptrade.com
8
+ =end
9
+
10
+ require 'date'
11
+ require 'time'
12
+
13
+ module SnapTrade
14
+ class CryptoTradingInstrumentType
15
+ CRYPTOCURRENCY = "CRYPTOCURRENCY".freeze
16
+ CRYPTOCURRENCY_PAIR = "CRYPTOCURRENCY_PAIR".freeze
17
+
18
+ def self.all_vars
19
+ @all_vars ||= [CRYPTOCURRENCY, CRYPTOCURRENCY_PAIR].freeze
20
+ end
21
+
22
+ # Builds the enum from string
23
+ # @param [String] The enum value in the form of the string
24
+ # @return [String] The enum value
25
+ def self.build_from_hash(value)
26
+ new.build_from_hash(value)
27
+ end
28
+
29
+ # Builds the enum from string
30
+ # @param [String] The enum value in the form of the string
31
+ # @return [String] The enum value
32
+ def build_from_hash(value)
33
+ return value if CryptoTradingInstrumentType.all_vars.include?(value)
34
+ raise "Invalid ENUM value #{value} for class #CryptoTradingInstrumentType"
35
+ end
36
+ end
37
+ end
@@ -22,7 +22,7 @@ module SnapTrade
22
22
  # The universal symbol ID of the security to trade. Must be 'null' if `symbol` is provided, otherwise must be provided.
23
23
  attr_accessor :universal_symbol_id
24
24
 
25
- # The security's trading ticker symbol. This currently supports stock symbols and Options symbols in the 21 character OCC format. For example `AAPL 131124C00240000` represents a call option on AAPL expiring on 2024-11-13 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format). If 'symbol' is provided, then 'universal_symbol_id' must be 'null'.
25
+ # The security's trading ticker symbol. If 'symbol' is provided, then 'universal_symbol_id' must be 'null'.
26
26
  attr_accessor :symbol
27
27
 
28
28
  # The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
@@ -11,8 +11,11 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module SnapTrade
14
- # Inputs for placing an order with the brokerage.
14
+ # Inputs for replacing an order with the brokerage.
15
15
  class ManualTradeReplaceForm
16
+ # Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
17
+ attr_accessor :brokerage_order_id
18
+
16
19
  # The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
17
20
  attr_accessor :action
18
21
 
@@ -36,6 +39,7 @@ module SnapTrade
36
39
  # Attribute mapping from ruby-style variable name to JSON key.
37
40
  def self.attribute_map
38
41
  {
42
+ :'brokerage_order_id' => :'brokerage_order_id',
39
43
  :'action' => :'action',
40
44
  :'order_type' => :'order_type',
41
45
  :'time_in_force' => :'time_in_force',
@@ -54,6 +58,7 @@ module SnapTrade
54
58
  # Attribute type mapping.
55
59
  def self.openapi_types
56
60
  {
61
+ :'brokerage_order_id' => :'String',
57
62
  :'action' => :'ActionStrict',
58
63
  :'order_type' => :'OrderTypeStrict',
59
64
  :'time_in_force' => :'TimeInForceStrict',
@@ -88,6 +93,10 @@ module SnapTrade
88
93
  h[k.to_sym] = v
89
94
  }
90
95
 
96
+ if attributes.key?(:'brokerage_order_id')
97
+ self.brokerage_order_id = attributes[:'brokerage_order_id']
98
+ end
99
+
91
100
  if attributes.key?(:'action')
92
101
  self.action = attributes[:'action']
93
102
  end
@@ -121,6 +130,10 @@ module SnapTrade
121
130
  # @return Array for valid properties with the reasons
122
131
  def list_invalid_properties
123
132
  invalid_properties = Array.new
133
+ if @brokerage_order_id.nil?
134
+ invalid_properties.push('invalid value for "brokerage_order_id", brokerage_order_id cannot be nil.')
135
+ end
136
+
124
137
  if @action.nil?
125
138
  invalid_properties.push('invalid value for "action", action cannot be nil.')
126
139
  end
@@ -139,6 +152,7 @@ module SnapTrade
139
152
  # Check to see if the all the properties in the model are valid
140
153
  # @return true if the model is valid
141
154
  def valid?
155
+ return false if @brokerage_order_id.nil?
142
156
  return false if @action.nil?
143
157
  return false if @order_type.nil?
144
158
  return false if @time_in_force.nil?
@@ -150,6 +164,7 @@ module SnapTrade
150
164
  def ==(o)
151
165
  return true if self.equal?(o)
152
166
  self.class == o.class &&
167
+ brokerage_order_id == o.brokerage_order_id &&
153
168
  action == o.action &&
154
169
  order_type == o.order_type &&
155
170
  time_in_force == o.time_in_force &&
@@ -168,7 +183,7 @@ module SnapTrade
168
183
  # Calculates hash code according to all attributes.
169
184
  # @return [Integer] Hash code
170
185
  def hash
171
- [action, order_type, time_in_force, price, symbol, stop, units].hash
186
+ [brokerage_order_id, action, order_type, time_in_force, price, symbol, stop, units].hash
172
187
  end
173
188
 
174
189
  # Builds the object from hash
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '2.0.119'
11
+ VERSION = '2.0.121'
12
12
  end
data/lib/snaptrade.rb CHANGED
@@ -55,6 +55,13 @@ require 'snaptrade/models/child_brokerage_order_ids'
55
55
  require 'snaptrade/models/connection_portal_version'
56
56
  require 'snaptrade/models/connection_type'
57
57
  require 'snaptrade/models/connections_session_events200_response_inner'
58
+ require 'snaptrade/models/crypto_order_form'
59
+ require 'snaptrade/models/crypto_order_form_time_in_force'
60
+ require 'snaptrade/models/crypto_order_form_type'
61
+ require 'snaptrade/models/crypto_order_preview'
62
+ require 'snaptrade/models/crypto_order_preview_estimated_fee'
63
+ require 'snaptrade/models/crypto_trading_instrument'
64
+ require 'snaptrade/models/crypto_trading_instrument_type'
58
65
  require 'snaptrade/models/cryptocurrency_pair'
59
66
  require 'snaptrade/models/cryptocurrency_pair_quote'
60
67
  require 'snaptrade/models/currency'
@@ -130,8 +137,6 @@ require 'snaptrade/models/session_event_type'
130
137
  require 'snaptrade/models/simple_order_form'
131
138
  require 'snaptrade/models/simple_order_form_time_in_force'
132
139
  require 'snaptrade/models/simple_order_form_type'
133
- require 'snaptrade/models/simple_order_preview'
134
- require 'snaptrade/models/simple_order_preview_estimated_fee'
135
140
  require 'snaptrade/models/snap_trade_holdings_account'
136
141
  require 'snaptrade/models/snap_trade_holdings_total_value'
137
142
  require 'snaptrade/models/snap_trade_login_user_request_body'
@@ -29,7 +29,7 @@ describe 'TradingApi' do
29
29
 
30
30
  # unit tests for cancel_order
31
31
  # Cancel order
32
- # Cancels an order in the specified account.
32
+ # Cancels an order in the specified account. Accepts order IDs for all asset types.
33
33
  # @param user_id
34
34
  # @param user_secret
35
35
  # @param account_id
@@ -44,7 +44,7 @@ describe 'TradingApi' do
44
44
 
45
45
  # unit tests for cancel_user_account_order
46
46
  # Cancel equity order
47
- # Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
47
+ # **This endpoint is deprecated. Please switch to [the new cancel order endpoint](/reference/Trading/Trading_cancelOrder) ** Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
48
48
  # @param user_id
49
49
  # @param user_secret
50
50
  # @param account_id
@@ -117,6 +117,21 @@ describe 'TradingApi' do
117
117
  end
118
118
  end
119
119
 
120
+ # unit tests for place_crypto_order
121
+ # Place crypto order
122
+ # Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order.
123
+ # @param user_id
124
+ # @param user_secret
125
+ # @param account_id
126
+ # @param crypto_order_form
127
+ # @param [Hash] opts the optional parameters
128
+ # @return [OrderUpdatedResponse]
129
+ describe 'place_crypto_order test' do
130
+ it 'should work' do
131
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
132
+ end
133
+ end
134
+
120
135
  # unit tests for place_force_order
121
136
  # Place equity order
122
137
  # Places a brokerage order in the specified account. The order could be rejected by the brokerage if it is invalid or if the account does not have sufficient funds. This endpoint does not compute the impact to the account balance from the order and any potential commissions before submitting the order to the brokerage. If that is desired, you can use the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
@@ -161,31 +176,16 @@ describe 'TradingApi' do
161
176
  end
162
177
  end
163
178
 
164
- # unit tests for place_simple_order
165
- # Place crypto order
166
- # Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order.
167
- # @param user_id
168
- # @param user_secret
169
- # @param account_id
170
- # @param simple_order_form
171
- # @param [Hash] opts the optional parameters
172
- # @return [OrderUpdatedResponse]
173
- describe 'place_simple_order test' do
174
- it 'should work' do
175
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
176
- end
177
- end
178
-
179
- # unit tests for preview_simple_order
179
+ # unit tests for preview_crypto_order
180
180
  # Preview crypto order
181
181
  # Previews an order using the specified account.
182
182
  # @param user_id
183
183
  # @param user_secret
184
184
  # @param account_id
185
- # @param simple_order_form
185
+ # @param crypto_order_form
186
186
  # @param [Hash] opts the optional parameters
187
- # @return [SimpleOrderPreview]
188
- describe 'preview_simple_order test' do
187
+ # @return [CryptoOrderPreview]
188
+ describe 'preview_crypto_order test' do
189
189
  it 'should work' do
190
190
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
191
191
  end
@@ -195,7 +195,6 @@ describe 'TradingApi' do
195
195
  # Replace equity order
196
196
  # Replaces an existing pending order with a new one. The way this works is brokerage dependent, but usually involves cancelling the existing order and placing a new one. The order's brokerage_order_id may or may not change, be sure to use the one returned in the response going forward. Only supported on some brokerages
197
197
  # @param account_id The ID of the account to execute the trade on.
198
- # @param brokerage_order_id The Brokerage Order ID of the order to replace.
199
198
  # @param user_id
200
199
  # @param user_secret
201
200
  # @param manual_trade_replace_form
@@ -0,0 +1,77 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: api@snaptrade.com
8
+ =end
9
+
10
+ require 'spec_helper'
11
+ require 'json'
12
+ require 'date'
13
+
14
+ # Unit tests for SnapTrade::CryptoOrderForm
15
+ describe SnapTrade::CryptoOrderForm do
16
+ let(:instance) { SnapTrade::CryptoOrderForm.new }
17
+
18
+ describe 'test an instance of CryptoOrderForm' do
19
+ it 'should create an instance of CryptoOrderForm' do
20
+ expect(instance).to be_instance_of(SnapTrade::CryptoOrderForm)
21
+ end
22
+ end
23
+ describe 'test attribute "instrument"' do
24
+ it 'should work' do
25
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
26
+ end
27
+ end
28
+
29
+ describe 'test attribute "side"' do
30
+ it 'should work' do
31
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
32
+ end
33
+ end
34
+
35
+ describe 'test attribute "type"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "time_in_force"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ describe 'test attribute "amount"' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
53
+ describe 'test attribute "limit_price"' do
54
+ it 'should work' do
55
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
+ end
57
+ end
58
+
59
+ describe 'test attribute "stop_price"' do
60
+ it 'should work' do
61
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
62
+ end
63
+ end
64
+
65
+ describe 'test attribute "post_only"' do
66
+ it 'should work' do
67
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
68
+ end
69
+ end
70
+
71
+ describe 'test attribute "expiration_date"' do
72
+ it 'should work' do
73
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
74
+ end
75
+ end
76
+
77
+ end
@@ -0,0 +1,23 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: api@snaptrade.com
8
+ =end
9
+
10
+ require 'spec_helper'
11
+ require 'json'
12
+ require 'date'
13
+
14
+ # Unit tests for SnapTrade::CryptoOrderFormTimeInForce
15
+ describe SnapTrade::CryptoOrderFormTimeInForce do
16
+ let(:instance) { SnapTrade::CryptoOrderFormTimeInForce.new }
17
+
18
+ describe 'test an instance of CryptoOrderFormTimeInForce' do
19
+ it 'should create an instance of CryptoOrderFormTimeInForce' do
20
+ expect(instance).to be_instance_of(SnapTrade::CryptoOrderFormTimeInForce)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: api@snaptrade.com
8
+ =end
9
+
10
+ require 'spec_helper'
11
+ require 'json'
12
+ require 'date'
13
+
14
+ # Unit tests for SnapTrade::CryptoOrderFormType
15
+ describe SnapTrade::CryptoOrderFormType do
16
+ let(:instance) { SnapTrade::CryptoOrderFormType.new }
17
+
18
+ describe 'test an instance of CryptoOrderFormType' do
19
+ it 'should create an instance of CryptoOrderFormType' do
20
+ expect(instance).to be_instance_of(SnapTrade::CryptoOrderFormType)
21
+ end
22
+ end
23
+ end
@@ -11,13 +11,13 @@ require 'spec_helper'
11
11
  require 'json'
12
12
  require 'date'
13
13
 
14
- # Unit tests for SnapTrade::SimpleOrderPreviewEstimatedFee
15
- describe SnapTrade::SimpleOrderPreviewEstimatedFee do
16
- let(:instance) { SnapTrade::SimpleOrderPreviewEstimatedFee.new }
14
+ # Unit tests for SnapTrade::CryptoOrderPreviewEstimatedFee
15
+ describe SnapTrade::CryptoOrderPreviewEstimatedFee do
16
+ let(:instance) { SnapTrade::CryptoOrderPreviewEstimatedFee.new }
17
17
 
18
- describe 'test an instance of SimpleOrderPreviewEstimatedFee' do
19
- it 'should create an instance of SimpleOrderPreviewEstimatedFee' do
20
- expect(instance).to be_instance_of(SnapTrade::SimpleOrderPreviewEstimatedFee)
18
+ describe 'test an instance of CryptoOrderPreviewEstimatedFee' do
19
+ it 'should create an instance of CryptoOrderPreviewEstimatedFee' do
20
+ expect(instance).to be_instance_of(SnapTrade::CryptoOrderPreviewEstimatedFee)
21
21
  end
22
22
  end
23
23
  describe 'test attribute "currency"' do
@@ -11,13 +11,13 @@ require 'spec_helper'
11
11
  require 'json'
12
12
  require 'date'
13
13
 
14
- # Unit tests for SnapTrade::SimpleOrderPreview
15
- describe SnapTrade::SimpleOrderPreview do
16
- let(:instance) { SnapTrade::SimpleOrderPreview.new }
14
+ # Unit tests for SnapTrade::CryptoOrderPreview
15
+ describe SnapTrade::CryptoOrderPreview do
16
+ let(:instance) { SnapTrade::CryptoOrderPreview.new }
17
17
 
18
- describe 'test an instance of SimpleOrderPreview' do
19
- it 'should create an instance of SimpleOrderPreview' do
20
- expect(instance).to be_instance_of(SnapTrade::SimpleOrderPreview)
18
+ describe 'test an instance of CryptoOrderPreview' do
19
+ it 'should create an instance of CryptoOrderPreview' do
20
+ expect(instance).to be_instance_of(SnapTrade::CryptoOrderPreview)
21
21
  end
22
22
  end
23
23
  describe 'test attribute "estimated_fee"' do
@@ -0,0 +1,35 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: api@snaptrade.com
8
+ =end
9
+
10
+ require 'spec_helper'
11
+ require 'json'
12
+ require 'date'
13
+
14
+ # Unit tests for SnapTrade::CryptoTradingInstrument
15
+ describe SnapTrade::CryptoTradingInstrument do
16
+ let(:instance) { SnapTrade::CryptoTradingInstrument.new }
17
+
18
+ describe 'test an instance of CryptoTradingInstrument' do
19
+ it 'should create an instance of CryptoTradingInstrument' do
20
+ expect(instance).to be_instance_of(SnapTrade::CryptoTradingInstrument)
21
+ end
22
+ end
23
+ describe 'test attribute "symbol"' do
24
+ it 'should work' do
25
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
26
+ end
27
+ end
28
+
29
+ describe 'test attribute "type"' do
30
+ it 'should work' do
31
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
32
+ end
33
+ end
34
+
35
+ end
@@ -0,0 +1,23 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: api@snaptrade.com
8
+ =end
9
+
10
+ require 'spec_helper'
11
+ require 'json'
12
+ require 'date'
13
+
14
+ # Unit tests for SnapTrade::CryptoTradingInstrumentType
15
+ describe SnapTrade::CryptoTradingInstrumentType do
16
+ let(:instance) { SnapTrade::CryptoTradingInstrumentType.new }
17
+
18
+ describe 'test an instance of CryptoTradingInstrumentType' do
19
+ it 'should create an instance of CryptoTradingInstrumentType' do
20
+ expect(instance).to be_instance_of(SnapTrade::CryptoTradingInstrumentType)
21
+ end
22
+ end
23
+ end
@@ -20,6 +20,12 @@ describe SnapTrade::ManualTradeReplaceForm do
20
20
  expect(instance).to be_instance_of(SnapTrade::ManualTradeReplaceForm)
21
21
  end
22
22
  end
23
+ describe 'test attribute "brokerage_order_id"' do
24
+ it 'should work' do
25
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
26
+ end
27
+ end
28
+
23
29
  describe 'test attribute "action"' do
24
30
  it 'should work' do
25
31
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers