snaptrade 2.0.84 → 2.0.85
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 +4 -4
- data/Gemfile.lock +5 -3
- data/README.md +12 -12
- data/lib/snaptrade/api/crypto_spot_trading_api.rb +18 -18
- data/lib/snaptrade/models/cryptocurrency_pair.rb +2 -2
- data/lib/snaptrade/models/order_updated_response.rb +231 -0
- data/lib/snaptrade/models/trading_crypto_spot_place_order_request.rb +1 -1
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +1 -0
- data/spec/api/crypto_spot_trading_api_spec.rb +4 -4
- data/spec/models/order_updated_response_spec.rb +35 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96b6ec054f8953dc847538e036a96d75adbfae706c402c18d9bfd7f28ee98f14
|
4
|
+
data.tar.gz: 0a64491e8b03059f220b0ad137713ff1b73d1511e1b74c1c0981572276058520
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd299f2f0ec731b3935fb8f8e60b33dd0ca034bdb6e26926ebf43716a6a8b4971db47f19c84b74cf4adfedd33ece76c2ad844d7b742e46f89c5797f26f970d84
|
7
|
+
data.tar.gz: 022d939ff18f2b2878494097564af65cb1eb9898a49d39593e87cdf86157939b12f78fc2461fdf6a4fa861df6ada094cf71c76d29bff5bb5e8fefe6708b74c93
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
snaptrade (2.0.
|
4
|
+
snaptrade (2.0.85)
|
5
5
|
faraday (>= 1.0.1, < 3.0)
|
6
6
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
7
7
|
|
@@ -15,7 +15,7 @@ GEM
|
|
15
15
|
debug (1.8.0)
|
16
16
|
irb (>= 1.5.0)
|
17
17
|
reline (>= 0.3.1)
|
18
|
-
diff-lcs (1.6.
|
18
|
+
diff-lcs (1.6.1)
|
19
19
|
faraday (2.8.1)
|
20
20
|
base64
|
21
21
|
faraday-net_http (>= 2.0, < 3.1)
|
@@ -32,6 +32,7 @@ GEM
|
|
32
32
|
parser (3.3.7.2)
|
33
33
|
ast (~> 2.4.1)
|
34
34
|
racc
|
35
|
+
prism (1.4.0)
|
35
36
|
pry (0.14.2)
|
36
37
|
coderay (~> 1.1)
|
37
38
|
method_source (~> 1.0)
|
@@ -67,8 +68,9 @@ GEM
|
|
67
68
|
rubocop-ast (>= 1.2.0, < 2.0)
|
68
69
|
ruby-progressbar (~> 1.7)
|
69
70
|
unicode-display_width (>= 1.4.0, < 3.0)
|
70
|
-
rubocop-ast (1.
|
71
|
+
rubocop-ast (1.43.0)
|
71
72
|
parser (>= 3.3.7.2)
|
73
|
+
prism (~> 1.4)
|
72
74
|
ruby-progressbar (1.13.0)
|
73
75
|
ruby2_keywords (0.0.5)
|
74
76
|
unicode-display_width (2.6.0)
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
Connect brokerage accounts to your app for live positions and trading
|
8
8
|
|
9
|
-
[](https://rubygems.org/gems/snaptrade/versions/2.0.85)
|
10
10
|
[](https://snaptrade.com/)
|
11
11
|
|
12
12
|
</div>
|
@@ -80,7 +80,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
80
80
|
Add to Gemfile:
|
81
81
|
|
82
82
|
```ruby
|
83
|
-
gem 'snaptrade', '~> 2.0.
|
83
|
+
gem 'snaptrade', '~> 2.0.85'
|
84
84
|
```
|
85
85
|
|
86
86
|
## Getting Started<a id="getting-started"></a>
|
@@ -1073,7 +1073,7 @@ the brokerage system.
|
|
1073
1073
|
##### account_id: `String`<a id="account_id-string"></a>
|
1074
1074
|
#### 🔄 Return<a id="🔄-return"></a>
|
1075
1075
|
|
1076
|
-
[
|
1076
|
+
[OrderUpdatedResponse](./lib/snaptrade/models/order_updated_response.rb)
|
1077
1077
|
|
1078
1078
|
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
1079
1079
|
|
@@ -1096,7 +1096,7 @@ This endpoint does not compute the impact to the account balance from the order
|
|
1096
1096
|
result = snaptrade.crypto_spot_trading.crypto_spot_place_order(
|
1097
1097
|
symbol: {
|
1098
1098
|
"base" => "BTC",
|
1099
|
-
"quote" => "
|
1099
|
+
"quote" => "USD",
|
1100
1100
|
},
|
1101
1101
|
side: "BUY",
|
1102
1102
|
type: "MARKET",
|
@@ -1147,15 +1147,15 @@ The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT,
|
|
1147
1147
|
TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
|
1148
1148
|
|
1149
1149
|
##### post_only: `Boolean`<a id="post_only-boolean"></a>
|
1150
|
-
|
1151
|
-
are rejected to avoid incurring TAKER fees.
|
1150
|
+
Valid and required only for order type LIMIT. If true orders that would be
|
1151
|
+
filled immediately are rejected to avoid incurring TAKER fees.
|
1152
1152
|
|
1153
1153
|
##### expiration_date: `Time`<a id="expiration_date-time"></a>
|
1154
1154
|
The expiration date of the order. Required if the time_in_force is GTD.
|
1155
1155
|
|
1156
1156
|
#### 🔄 Return<a id="🔄-return"></a>
|
1157
1157
|
|
1158
|
-
[
|
1158
|
+
[OrderUpdatedResponse](./lib/snaptrade/models/order_updated_response.rb)
|
1159
1159
|
|
1160
1160
|
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
1161
1161
|
|
@@ -1177,7 +1177,7 @@ Previews a cryptocurrency spot order using the specified account.
|
|
1177
1177
|
result = snaptrade.crypto_spot_trading.crypto_spot_preview_order(
|
1178
1178
|
symbol: {
|
1179
1179
|
"base" => "BTC",
|
1180
|
-
"quote" => "
|
1180
|
+
"quote" => "USD",
|
1181
1181
|
},
|
1182
1182
|
side: "BUY",
|
1183
1183
|
type: "MARKET",
|
@@ -1228,8 +1228,8 @@ The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT,
|
|
1228
1228
|
TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
|
1229
1229
|
|
1230
1230
|
##### post_only: `Boolean`<a id="post_only-boolean"></a>
|
1231
|
-
|
1232
|
-
are rejected to avoid incurring TAKER fees.
|
1231
|
+
Valid and required only for order type LIMIT. If true orders that would be
|
1232
|
+
filled immediately are rejected to avoid incurring TAKER fees.
|
1233
1233
|
|
1234
1234
|
##### expiration_date: `Time`<a id="expiration_date-time"></a>
|
1235
1235
|
The expiration date of the order. Required if the time_in_force is GTD.
|
@@ -1260,7 +1260,7 @@ result = snaptrade.crypto_spot_trading.crypto_spot_quote(
|
|
1260
1260
|
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
1261
1261
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
1262
1262
|
base: "BTC",
|
1263
|
-
quote: "
|
1263
|
+
quote: "USD",
|
1264
1264
|
)
|
1265
1265
|
p result
|
1266
1266
|
```
|
@@ -1298,7 +1298,7 @@ result = snaptrade.crypto_spot_trading.crypto_spot_symbols(
|
|
1298
1298
|
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
1299
1299
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
1300
1300
|
base: "BTC",
|
1301
|
-
quote: "
|
1301
|
+
quote: "USD",
|
1302
1302
|
)
|
1303
1303
|
p result
|
1304
1304
|
```
|
@@ -59,7 +59,7 @@ module SnapTrade
|
|
59
59
|
# @param account_id [String]
|
60
60
|
# @param trading_crypto_spot_cancel_order_request [TradingCryptoSpotCancelOrderRequest]
|
61
61
|
# @param [Hash] opts the optional parameters
|
62
|
-
# @return [
|
62
|
+
# @return [OrderUpdatedResponse]
|
63
63
|
private def crypto_spot_cancel_order_impl(user_id, user_secret, account_id, trading_crypto_spot_cancel_order_request, opts = {})
|
64
64
|
data, _status_code, _headers = crypto_spot_cancel_order_with_http_info(user_id, user_secret, account_id, trading_crypto_spot_cancel_order_request, opts)
|
65
65
|
data
|
@@ -72,7 +72,7 @@ module SnapTrade
|
|
72
72
|
# @param account_id [String]
|
73
73
|
# @param trading_crypto_spot_cancel_order_request [TradingCryptoSpotCancelOrderRequest]
|
74
74
|
# @param [Hash] opts the optional parameters
|
75
|
-
# @return [Array<(
|
75
|
+
# @return [Array<(OrderUpdatedResponse, Integer, Hash)>] OrderUpdatedResponse data, response status code and response headers
|
76
76
|
private def crypto_spot_cancel_order_with_http_info_impl(user_id, user_secret, account_id, trading_crypto_spot_cancel_order_request, opts = {})
|
77
77
|
if @api_client.config.debugging
|
78
78
|
@api_client.config.logger.debug 'Calling API: CryptoSpotTradingApi.crypto_spot_cancel_order ...'
|
@@ -118,7 +118,7 @@ module SnapTrade
|
|
118
118
|
post_body = opts[:debug_body] || @api_client.object_to_http_body(trading_crypto_spot_cancel_order_request)
|
119
119
|
|
120
120
|
# return_type
|
121
|
-
return_type = opts[:debug_return_type] || '
|
121
|
+
return_type = opts[:debug_return_type] || 'OrderUpdatedResponse'
|
122
122
|
|
123
123
|
# auth_names
|
124
124
|
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
@@ -156,7 +156,7 @@ module SnapTrade
|
|
156
156
|
# @param account_id [String]
|
157
157
|
# @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
|
158
158
|
# @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
|
159
|
-
# @param post_only [Boolean]
|
159
|
+
# @param post_only [Boolean] Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
|
160
160
|
# @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
|
161
161
|
# @param body [TradingCryptoSpotPlaceOrderRequest]
|
162
162
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
@@ -191,7 +191,7 @@ module SnapTrade
|
|
191
191
|
# @param account_id [String]
|
192
192
|
# @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
|
193
193
|
# @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
|
194
|
-
# @param post_only [Boolean]
|
194
|
+
# @param post_only [Boolean] Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
|
195
195
|
# @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
|
196
196
|
# @param body [TradingCryptoSpotPlaceOrderRequest]
|
197
197
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
@@ -217,7 +217,7 @@ module SnapTrade
|
|
217
217
|
# @param account_id [String]
|
218
218
|
# @param trading_crypto_spot_place_order_request [TradingCryptoSpotPlaceOrderRequest]
|
219
219
|
# @param [Hash] opts the optional parameters
|
220
|
-
# @return [
|
220
|
+
# @return [OrderUpdatedResponse]
|
221
221
|
private def crypto_spot_place_order_impl(user_id, user_secret, account_id, trading_crypto_spot_place_order_request, opts = {})
|
222
222
|
data, _status_code, _headers = crypto_spot_place_order_with_http_info(user_id, user_secret, account_id, trading_crypto_spot_place_order_request, opts)
|
223
223
|
data
|
@@ -230,7 +230,7 @@ module SnapTrade
|
|
230
230
|
# @param account_id [String]
|
231
231
|
# @param trading_crypto_spot_place_order_request [TradingCryptoSpotPlaceOrderRequest]
|
232
232
|
# @param [Hash] opts the optional parameters
|
233
|
-
# @return [Array<(
|
233
|
+
# @return [Array<(OrderUpdatedResponse, Integer, Hash)>] OrderUpdatedResponse data, response status code and response headers
|
234
234
|
private def crypto_spot_place_order_with_http_info_impl(user_id, user_secret, account_id, trading_crypto_spot_place_order_request, opts = {})
|
235
235
|
if @api_client.config.debugging
|
236
236
|
@api_client.config.logger.debug 'Calling API: CryptoSpotTradingApi.crypto_spot_place_order ...'
|
@@ -276,7 +276,7 @@ module SnapTrade
|
|
276
276
|
post_body = opts[:debug_body] || @api_client.object_to_http_body(trading_crypto_spot_place_order_request)
|
277
277
|
|
278
278
|
# return_type
|
279
|
-
return_type = opts[:debug_return_type] || '
|
279
|
+
return_type = opts[:debug_return_type] || 'OrderUpdatedResponse'
|
280
280
|
|
281
281
|
# auth_names
|
282
282
|
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
@@ -299,7 +299,7 @@ module SnapTrade
|
|
299
299
|
end
|
300
300
|
|
301
301
|
|
302
|
-
#
|
302
|
+
# Preview a crypto spot order
|
303
303
|
#
|
304
304
|
# Previews a cryptocurrency spot order using the specified account.
|
305
305
|
#
|
@@ -313,7 +313,7 @@ module SnapTrade
|
|
313
313
|
# @param account_id [String]
|
314
314
|
# @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
|
315
315
|
# @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
|
316
|
-
# @param post_only [Boolean]
|
316
|
+
# @param post_only [Boolean] Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
|
317
317
|
# @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
|
318
318
|
# @param body [TradingCryptoSpotPlaceOrderRequest]
|
319
319
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
@@ -333,7 +333,7 @@ module SnapTrade
|
|
333
333
|
data
|
334
334
|
end
|
335
335
|
|
336
|
-
#
|
336
|
+
# Preview a crypto spot order
|
337
337
|
#
|
338
338
|
# Previews a cryptocurrency spot order using the specified account.
|
339
339
|
#
|
@@ -347,7 +347,7 @@ module SnapTrade
|
|
347
347
|
# @param account_id [String]
|
348
348
|
# @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
|
349
349
|
# @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
|
350
|
-
# @param post_only [Boolean]
|
350
|
+
# @param post_only [Boolean] Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
|
351
351
|
# @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
|
352
352
|
# @param body [TradingCryptoSpotPlaceOrderRequest]
|
353
353
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
@@ -366,7 +366,7 @@ module SnapTrade
|
|
366
366
|
crypto_spot_preview_order_with_http_info_impl(user_id, user_secret, account_id, trading_crypto_spot_place_order_request, extra)
|
367
367
|
end
|
368
368
|
|
369
|
-
#
|
369
|
+
# Preview a crypto spot order
|
370
370
|
# Previews a cryptocurrency spot order using the specified account.
|
371
371
|
# @param user_id [String]
|
372
372
|
# @param user_secret [String]
|
@@ -379,7 +379,7 @@ module SnapTrade
|
|
379
379
|
data
|
380
380
|
end
|
381
381
|
|
382
|
-
#
|
382
|
+
# Preview a crypto spot order
|
383
383
|
# Previews a cryptocurrency spot order using the specified account.
|
384
384
|
# @param user_id [String]
|
385
385
|
# @param user_secret [String]
|
@@ -455,7 +455,7 @@ module SnapTrade
|
|
455
455
|
end
|
456
456
|
|
457
457
|
|
458
|
-
# Get a
|
458
|
+
# Get a cryptocurrency spot market quote
|
459
459
|
#
|
460
460
|
# Gets a quote for the specified account.
|
461
461
|
#
|
@@ -470,7 +470,7 @@ module SnapTrade
|
|
470
470
|
data
|
471
471
|
end
|
472
472
|
|
473
|
-
# Get a
|
473
|
+
# Get a cryptocurrency spot market quote
|
474
474
|
#
|
475
475
|
# Gets a quote for the specified account.
|
476
476
|
#
|
@@ -484,7 +484,7 @@ module SnapTrade
|
|
484
484
|
crypto_spot_quote_with_http_info_impl(user_id, user_secret, account_id, base, quote, extra)
|
485
485
|
end
|
486
486
|
|
487
|
-
# Get a
|
487
|
+
# Get a cryptocurrency spot market quote
|
488
488
|
# Gets a quote for the specified account.
|
489
489
|
# @param user_id [String]
|
490
490
|
# @param user_secret [String]
|
@@ -498,7 +498,7 @@ module SnapTrade
|
|
498
498
|
data
|
499
499
|
end
|
500
500
|
|
501
|
-
# Get a
|
501
|
+
# Get a cryptocurrency spot market quote
|
502
502
|
# Gets a quote for the specified account.
|
503
503
|
# @param user_id [String]
|
504
504
|
# @param user_secret [String]
|
@@ -13,10 +13,10 @@ require 'time'
|
|
13
13
|
module SnapTrade
|
14
14
|
# A cryptocurrency symbol. This is a unique identifier for a cryptocurrency.
|
15
15
|
class CryptocurrencyPair
|
16
|
-
# The base currency (e.g., \"BTC\" in BTC/USD).
|
16
|
+
# The base currency of a pair (e.g., \"BTC\" in BTC/USD). Either fiat or cryptocurrency symbol, for fiat use ISO-4217 codes.
|
17
17
|
attr_accessor :base
|
18
18
|
|
19
|
-
# The quote currency (e.g., \"USD\" in BTC/USD).
|
19
|
+
# The quote currency of a pair (e.g., \"USD\" in BTC/USD). Either fiat or cryptocurrency symbol, for fiat use ISO-4217 codes.
|
20
20
|
attr_accessor :quote
|
21
21
|
|
22
22
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -0,0 +1,231 @@
|
|
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 OrderUpdatedResponse
|
15
|
+
# Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
16
|
+
attr_accessor :brokerage_order_id
|
17
|
+
|
18
|
+
attr_accessor :order
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'brokerage_order_id' => :'brokerage_order_id',
|
24
|
+
:'order' => :'order'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Returns all the JSON keys this model knows about
|
29
|
+
def self.acceptable_attributes
|
30
|
+
attribute_map.values
|
31
|
+
end
|
32
|
+
|
33
|
+
# Attribute type mapping.
|
34
|
+
def self.openapi_types
|
35
|
+
{
|
36
|
+
:'brokerage_order_id' => :'String',
|
37
|
+
:'order' => :'AccountOrderRecord'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# List of attributes with nullable: true
|
42
|
+
def self.openapi_nullable
|
43
|
+
Set.new([
|
44
|
+
])
|
45
|
+
end
|
46
|
+
|
47
|
+
# Initializes the object
|
48
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
49
|
+
def initialize(attributes = {})
|
50
|
+
if (!attributes.is_a?(Hash))
|
51
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::OrderUpdatedResponse` initialize method"
|
52
|
+
end
|
53
|
+
|
54
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
55
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
56
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
57
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::OrderUpdatedResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
58
|
+
end
|
59
|
+
h[k.to_sym] = v
|
60
|
+
}
|
61
|
+
|
62
|
+
if attributes.key?(:'brokerage_order_id')
|
63
|
+
self.brokerage_order_id = attributes[:'brokerage_order_id']
|
64
|
+
end
|
65
|
+
|
66
|
+
if attributes.key?(:'order')
|
67
|
+
self.order = attributes[:'order']
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
72
|
+
# @return Array for valid properties with the reasons
|
73
|
+
def list_invalid_properties
|
74
|
+
invalid_properties = Array.new
|
75
|
+
if @brokerage_order_id.nil?
|
76
|
+
invalid_properties.push('invalid value for "brokerage_order_id", brokerage_order_id cannot be nil.')
|
77
|
+
end
|
78
|
+
|
79
|
+
invalid_properties
|
80
|
+
end
|
81
|
+
|
82
|
+
# Check to see if the all the properties in the model are valid
|
83
|
+
# @return true if the model is valid
|
84
|
+
def valid?
|
85
|
+
return false if @brokerage_order_id.nil?
|
86
|
+
true
|
87
|
+
end
|
88
|
+
|
89
|
+
# Checks equality by comparing each attribute.
|
90
|
+
# @param [Object] Object to be compared
|
91
|
+
def ==(o)
|
92
|
+
return true if self.equal?(o)
|
93
|
+
self.class == o.class &&
|
94
|
+
brokerage_order_id == o.brokerage_order_id &&
|
95
|
+
order == o.order
|
96
|
+
end
|
97
|
+
|
98
|
+
# @see the `==` method
|
99
|
+
# @param [Object] Object to be compared
|
100
|
+
def eql?(o)
|
101
|
+
self == o
|
102
|
+
end
|
103
|
+
|
104
|
+
# Calculates hash code according to all attributes.
|
105
|
+
# @return [Integer] Hash code
|
106
|
+
def hash
|
107
|
+
[brokerage_order_id, order].hash
|
108
|
+
end
|
109
|
+
|
110
|
+
# Builds the object from hash
|
111
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
112
|
+
# @return [Object] Returns the model itself
|
113
|
+
def self.build_from_hash(attributes)
|
114
|
+
new.build_from_hash(attributes)
|
115
|
+
end
|
116
|
+
|
117
|
+
# Builds the object from hash
|
118
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
119
|
+
# @return [Object] Returns the model itself
|
120
|
+
def build_from_hash(attributes)
|
121
|
+
return nil unless attributes.is_a?(Hash)
|
122
|
+
attributes = attributes.transform_keys(&:to_sym)
|
123
|
+
self.class.openapi_types.each_pair do |key, type|
|
124
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
125
|
+
self.send("#{key}=", nil)
|
126
|
+
elsif type =~ /\AArray<(.*)>/i
|
127
|
+
# check to ensure the input is an array given that the attribute
|
128
|
+
# is documented as an array but the input is not
|
129
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
130
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
131
|
+
end
|
132
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
133
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
self
|
138
|
+
end
|
139
|
+
|
140
|
+
# Deserializes the data based on type
|
141
|
+
# @param string type Data type
|
142
|
+
# @param string value Value to be deserialized
|
143
|
+
# @return [Object] Deserialized data
|
144
|
+
def _deserialize(type, value)
|
145
|
+
case type.to_sym
|
146
|
+
when :Time
|
147
|
+
Time.parse(value)
|
148
|
+
when :Date
|
149
|
+
Date.parse(value)
|
150
|
+
when :String
|
151
|
+
value.to_s
|
152
|
+
when :Integer
|
153
|
+
value.to_i
|
154
|
+
when :Float
|
155
|
+
value.to_f
|
156
|
+
when :Boolean
|
157
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
158
|
+
true
|
159
|
+
else
|
160
|
+
false
|
161
|
+
end
|
162
|
+
when :Object
|
163
|
+
# generic object (usually a Hash), return directly
|
164
|
+
value
|
165
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
166
|
+
inner_type = Regexp.last_match[:inner_type]
|
167
|
+
value.map { |v| _deserialize(inner_type, v) }
|
168
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
169
|
+
k_type = Regexp.last_match[:k_type]
|
170
|
+
v_type = Regexp.last_match[:v_type]
|
171
|
+
{}.tap do |hash|
|
172
|
+
value.each do |k, v|
|
173
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
else # model
|
177
|
+
# models (e.g. Pet) or oneOf
|
178
|
+
klass = SnapTrade.const_get(type)
|
179
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
# Returns the string representation of the object
|
184
|
+
# @return [String] String presentation of the object
|
185
|
+
def to_s
|
186
|
+
to_hash.to_s
|
187
|
+
end
|
188
|
+
|
189
|
+
# to_body is an alias to to_hash (backward compatibility)
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
191
|
+
def to_body
|
192
|
+
to_hash
|
193
|
+
end
|
194
|
+
|
195
|
+
# Returns the object in the form of hash
|
196
|
+
# @return [Hash] Returns the object in the form of hash
|
197
|
+
def to_hash
|
198
|
+
hash = {}
|
199
|
+
self.class.attribute_map.each_pair do |attr, param|
|
200
|
+
value = self.send(attr)
|
201
|
+
if value.nil?
|
202
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
203
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
204
|
+
end
|
205
|
+
|
206
|
+
hash[param] = _to_hash(value)
|
207
|
+
end
|
208
|
+
hash
|
209
|
+
end
|
210
|
+
|
211
|
+
# Outputs non-array value in the form of hash
|
212
|
+
# For object, use to_hash. Otherwise, just return the value
|
213
|
+
# @param [Object] value Any valid value
|
214
|
+
# @return [Hash] Returns the value in the form of hash
|
215
|
+
def _to_hash(value)
|
216
|
+
if value.is_a?(Array)
|
217
|
+
value.compact.map { |v| _to_hash(v) }
|
218
|
+
elsif value.is_a?(Hash)
|
219
|
+
{}.tap do |hash|
|
220
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
221
|
+
end
|
222
|
+
elsif value.respond_to? :to_hash
|
223
|
+
value.to_hash
|
224
|
+
else
|
225
|
+
value
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
end
|
230
|
+
|
231
|
+
end
|
@@ -32,7 +32,7 @@ module SnapTrade
|
|
32
32
|
# The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
|
33
33
|
attr_accessor :stop_price
|
34
34
|
|
35
|
-
#
|
35
|
+
# Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
|
36
36
|
attr_accessor :post_only
|
37
37
|
|
38
38
|
# The expiration date of the order. Required if the time_in_force is GTD.
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
@@ -102,6 +102,7 @@ require 'snaptrade/models/options_position'
|
|
102
102
|
require 'snaptrade/models/options_position_currency'
|
103
103
|
require 'snaptrade/models/options_symbol'
|
104
104
|
require 'snaptrade/models/order_type_strict'
|
105
|
+
require 'snaptrade/models/order_updated_response'
|
105
106
|
require 'snaptrade/models/paginated_universal_activity'
|
106
107
|
require 'snaptrade/models/pagination_details'
|
107
108
|
require 'snaptrade/models/partner_data'
|
@@ -35,7 +35,7 @@ describe 'CryptoSpotTradingApi' do
|
|
35
35
|
# @param account_id
|
36
36
|
# @param trading_crypto_spot_cancel_order_request
|
37
37
|
# @param [Hash] opts the optional parameters
|
38
|
-
# @return [
|
38
|
+
# @return [OrderUpdatedResponse]
|
39
39
|
describe 'crypto_spot_cancel_order test' do
|
40
40
|
it 'should work' do
|
41
41
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
@@ -50,7 +50,7 @@ describe 'CryptoSpotTradingApi' do
|
|
50
50
|
# @param account_id
|
51
51
|
# @param trading_crypto_spot_place_order_request
|
52
52
|
# @param [Hash] opts the optional parameters
|
53
|
-
# @return [
|
53
|
+
# @return [OrderUpdatedResponse]
|
54
54
|
describe 'crypto_spot_place_order test' do
|
55
55
|
it 'should work' do
|
56
56
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
@@ -58,7 +58,7 @@ describe 'CryptoSpotTradingApi' do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
# unit tests for crypto_spot_preview_order
|
61
|
-
#
|
61
|
+
# Preview a crypto spot order
|
62
62
|
# Previews a cryptocurrency spot order using the specified account.
|
63
63
|
# @param user_id
|
64
64
|
# @param user_secret
|
@@ -73,7 +73,7 @@ describe 'CryptoSpotTradingApi' do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
# unit tests for crypto_spot_quote
|
76
|
-
# Get a
|
76
|
+
# Get a cryptocurrency spot market quote
|
77
77
|
# Gets a quote for the specified account.
|
78
78
|
# @param user_id
|
79
79
|
# @param user_secret
|
@@ -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::OrderUpdatedResponse
|
15
|
+
describe SnapTrade::OrderUpdatedResponse do
|
16
|
+
let(:instance) { SnapTrade::OrderUpdatedResponse.new }
|
17
|
+
|
18
|
+
describe 'test an instance of OrderUpdatedResponse' do
|
19
|
+
it 'should create an instance of OrderUpdatedResponse' do
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::OrderUpdatedResponse)
|
21
|
+
end
|
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
|
+
|
29
|
+
describe 'test attribute "order"' 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
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snaptrade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.85
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -182,6 +182,7 @@ files:
|
|
182
182
|
- lib/snaptrade/models/options_position_currency.rb
|
183
183
|
- lib/snaptrade/models/options_symbol.rb
|
184
184
|
- lib/snaptrade/models/order_type_strict.rb
|
185
|
+
- lib/snaptrade/models/order_updated_response.rb
|
185
186
|
- lib/snaptrade/models/paginated_universal_activity.rb
|
186
187
|
- lib/snaptrade/models/pagination_details.rb
|
187
188
|
- lib/snaptrade/models/partner_data.rb
|
@@ -330,6 +331,7 @@ files:
|
|
330
331
|
- spec/models/options_position_spec.rb
|
331
332
|
- spec/models/options_symbol_spec.rb
|
332
333
|
- spec/models/order_type_strict_spec.rb
|
334
|
+
- spec/models/order_updated_response_spec.rb
|
333
335
|
- spec/models/paginated_universal_activity_spec.rb
|
334
336
|
- spec/models/pagination_details_spec.rb
|
335
337
|
- spec/models/partner_data_spec.rb
|
@@ -486,6 +488,7 @@ test_files:
|
|
486
488
|
- spec/models/universal_activity_spec.rb
|
487
489
|
- spec/models/account_order_record_spec.rb
|
488
490
|
- spec/models/symbol_figi_instrument_spec.rb
|
491
|
+
- spec/models/order_updated_response_spec.rb
|
489
492
|
- spec/models/strategy_quotes_spec.rb
|
490
493
|
- spec/models/monthly_dividends_spec.rb
|
491
494
|
- spec/models/trading_crypto_spot_place_order_request_spec.rb
|