snaptrade 2.0.119 → 2.0.120

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.
@@ -19,7 +19,7 @@ module SnapTrade
19
19
 
20
20
  # Cancel order
21
21
  #
22
- # Cancels an order in the specified account.
22
+ # Cancels an order in the specified account. Accepts order IDs for all asset types.
23
23
  #
24
24
  # @param user_id [String]
25
25
  # @param user_secret [String]
@@ -37,7 +37,7 @@ module SnapTrade
37
37
 
38
38
  # Cancel order
39
39
  #
40
- # Cancels an order in the specified account.
40
+ # Cancels an order in the specified account. Accepts order IDs for all asset types.
41
41
  #
42
42
  # @param user_id [String]
43
43
  # @param user_secret [String]
@@ -53,7 +53,7 @@ module SnapTrade
53
53
  end
54
54
 
55
55
  # Cancel order
56
- # Cancels an order in the specified account.
56
+ # Cancels an order in the specified account. Accepts order IDs for all asset types.
57
57
  # @param user_id [String]
58
58
  # @param user_secret [String]
59
59
  # @param account_id [String]
@@ -66,7 +66,7 @@ module SnapTrade
66
66
  end
67
67
 
68
68
  # Cancel order
69
- # Cancels an order in the specified account.
69
+ # Cancels an order in the specified account. Accepts order IDs for all asset types.
70
70
  # @param user_id [String]
71
71
  # @param user_secret [String]
72
72
  # @param account_id [String]
@@ -143,6 +143,7 @@ module SnapTrade
143
143
 
144
144
  # Cancel equity order
145
145
  #
146
+ # **This endpoint is deprecated. Please switch to [the new cancel order endpoint](/reference/Trading/Trading_cancelOrder) **
146
147
  # Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
147
148
  #
148
149
  # @param user_id [String]
@@ -161,6 +162,7 @@ module SnapTrade
161
162
 
162
163
  # Cancel equity order
163
164
  #
165
+ # **This endpoint is deprecated. Please switch to [the new cancel order endpoint](/reference/Trading/Trading_cancelOrder) **
164
166
  # Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
165
167
  #
166
168
  # @param user_id [String]
@@ -177,7 +179,7 @@ module SnapTrade
177
179
  end
178
180
 
179
181
  # Cancel equity order
180
- # Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
182
+ # **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.
181
183
  # @param user_id [String]
182
184
  # @param user_secret [String]
183
185
  # @param account_id [String]
@@ -190,7 +192,7 @@ module SnapTrade
190
192
  end
191
193
 
192
194
  # Cancel equity order
193
- # Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
195
+ # **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.
194
196
  # @param user_id [String]
195
197
  # @param user_secret [String]
196
198
  # @param account_id [String]
@@ -805,6 +807,164 @@ module SnapTrade
805
807
  end
806
808
 
807
809
 
810
+ # Place crypto order
811
+ #
812
+ # Places an order in the specified account.
813
+ # This endpoint does not compute the impact to the account balance from the order before submitting the order.
814
+ #
815
+ # @param instrument [CryptoTradingInstrument]
816
+ # @param side [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
817
+ # @param type [CryptoOrderFormType] The type of order to place.
818
+ # @param time_in_force [CryptoOrderFormTimeInForce] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date.
819
+ # @param amount [Float] The amount of the base currency to buy or sell.
820
+ # @param user_id [String]
821
+ # @param user_secret [String]
822
+ # @param account_id [String]
823
+ # @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
824
+ # @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.
825
+ # @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.
826
+ # @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
827
+ # @param body [CryptoOrderForm]
828
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
829
+ def place_crypto_order(instrument:, side:, type:, time_in_force:, amount:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, post_only: SENTINEL, expiration_date: SENTINEL, extra: {})
830
+ _body = {}
831
+ _body[:instrument] = instrument if instrument != SENTINEL
832
+ _body[:side] = side if side != SENTINEL
833
+ _body[:type] = type if type != SENTINEL
834
+ _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
835
+ _body[:amount] = amount if amount != SENTINEL
836
+ _body[:limit_price] = limit_price if limit_price != SENTINEL
837
+ _body[:stop_price] = stop_price if stop_price != SENTINEL
838
+ _body[:post_only] = post_only if post_only != SENTINEL
839
+ _body[:expiration_date] = expiration_date if expiration_date != SENTINEL
840
+ crypto_order_form = _body
841
+ data, _status_code, _headers = place_crypto_order_with_http_info_impl(user_id, user_secret, account_id, crypto_order_form, extra)
842
+ data
843
+ end
844
+
845
+ # Place crypto order
846
+ #
847
+ # Places an order in the specified account.
848
+ # This endpoint does not compute the impact to the account balance from the order before submitting the order.
849
+ #
850
+ # @param instrument [CryptoTradingInstrument]
851
+ # @param side [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
852
+ # @param type [CryptoOrderFormType] The type of order to place.
853
+ # @param time_in_force [CryptoOrderFormTimeInForce] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date.
854
+ # @param amount [Float] The amount of the base currency to buy or sell.
855
+ # @param user_id [String]
856
+ # @param user_secret [String]
857
+ # @param account_id [String]
858
+ # @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
859
+ # @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.
860
+ # @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.
861
+ # @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
862
+ # @param body [CryptoOrderForm]
863
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
864
+ def place_crypto_order_with_http_info(instrument:, side:, type:, time_in_force:, amount:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, post_only: SENTINEL, expiration_date: SENTINEL, extra: {})
865
+ _body = {}
866
+ _body[:instrument] = instrument if instrument != SENTINEL
867
+ _body[:side] = side if side != SENTINEL
868
+ _body[:type] = type if type != SENTINEL
869
+ _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
870
+ _body[:amount] = amount if amount != SENTINEL
871
+ _body[:limit_price] = limit_price if limit_price != SENTINEL
872
+ _body[:stop_price] = stop_price if stop_price != SENTINEL
873
+ _body[:post_only] = post_only if post_only != SENTINEL
874
+ _body[:expiration_date] = expiration_date if expiration_date != SENTINEL
875
+ crypto_order_form = _body
876
+ place_crypto_order_with_http_info_impl(user_id, user_secret, account_id, crypto_order_form, extra)
877
+ end
878
+
879
+ # Place crypto order
880
+ # 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.
881
+ # @param user_id [String]
882
+ # @param user_secret [String]
883
+ # @param account_id [String]
884
+ # @param crypto_order_form [CryptoOrderForm]
885
+ # @param [Hash] opts the optional parameters
886
+ # @return [OrderUpdatedResponse]
887
+ private def place_crypto_order_impl(user_id, user_secret, account_id, crypto_order_form, opts = {})
888
+ data, _status_code, _headers = place_crypto_order_with_http_info(user_id, user_secret, account_id, crypto_order_form, opts)
889
+ data
890
+ end
891
+
892
+ # Place crypto order
893
+ # 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.
894
+ # @param user_id [String]
895
+ # @param user_secret [String]
896
+ # @param account_id [String]
897
+ # @param crypto_order_form [CryptoOrderForm]
898
+ # @param [Hash] opts the optional parameters
899
+ # @return [Array<(OrderUpdatedResponse, Integer, Hash)>] OrderUpdatedResponse data, response status code and response headers
900
+ private def place_crypto_order_with_http_info_impl(user_id, user_secret, account_id, crypto_order_form, opts = {})
901
+ if @api_client.config.debugging
902
+ @api_client.config.logger.debug 'Calling API: TradingApi.place_crypto_order ...'
903
+ end
904
+ # verify the required parameter 'user_id' is set
905
+ if @api_client.config.client_side_validation && user_id.nil?
906
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_crypto_order"
907
+ end
908
+ # verify the required parameter 'user_secret' is set
909
+ if @api_client.config.client_side_validation && user_secret.nil?
910
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_crypto_order"
911
+ end
912
+ # verify the required parameter 'account_id' is set
913
+ if @api_client.config.client_side_validation && account_id.nil?
914
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.place_crypto_order"
915
+ end
916
+ # verify the required parameter 'crypto_order_form' is set
917
+ if @api_client.config.client_side_validation && crypto_order_form.nil?
918
+ fail ArgumentError, "Missing the required parameter 'crypto_order_form' when calling TradingApi.place_crypto_order"
919
+ end
920
+ # resource path
921
+ local_var_path = '/accounts/{accountId}/trading/crypto'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
922
+
923
+ # query parameters
924
+ query_params = opts[:query_params] || {}
925
+ query_params[:'userId'] = user_id
926
+ query_params[:'userSecret'] = user_secret
927
+
928
+ # header parameters
929
+ header_params = opts[:header_params] || {}
930
+ # HTTP header 'Accept' (if needed)
931
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
932
+ # HTTP header 'Content-Type'
933
+ content_type = @api_client.select_header_content_type(['application/json'])
934
+ if !content_type.nil?
935
+ header_params['Content-Type'] = content_type
936
+ end
937
+
938
+ # form parameters
939
+ form_params = opts[:form_params] || {}
940
+
941
+ # http body (model)
942
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(crypto_order_form)
943
+
944
+ # return_type
945
+ return_type = opts[:debug_return_type] || 'OrderUpdatedResponse'
946
+
947
+ # auth_names
948
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
949
+
950
+ new_options = opts.merge(
951
+ :operation => :"TradingApi.place_crypto_order",
952
+ :header_params => header_params,
953
+ :query_params => query_params,
954
+ :form_params => form_params,
955
+ :body => post_body,
956
+ :auth_names => auth_names,
957
+ :return_type => return_type
958
+ )
959
+
960
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
961
+ if @api_client.config.debugging
962
+ @api_client.config.logger.debug "API called: TradingApi#place_crypto_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
963
+ end
964
+ return data, status_code, headers, response
965
+ end
966
+
967
+
808
968
  # Place equity order
809
969
  #
810
970
  # 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.
@@ -1233,172 +1393,14 @@ module SnapTrade
1233
1393
  end
1234
1394
 
1235
1395
 
1236
- # Place crypto order
1237
- #
1238
- # Places an order in the specified account.
1239
- # This endpoint does not compute the impact to the account balance from the order before submitting the order.
1240
- #
1241
- # @param instrument [TradingInstrument]
1242
- # @param side [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
1243
- # @param type [SimpleOrderFormType] The type of order to place.
1244
- # @param time_in_force [SimpleOrderFormTimeInForce] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date.
1245
- # @param amount [Float] The amount of the base currency to buy or sell.
1246
- # @param user_id [String]
1247
- # @param user_secret [String]
1248
- # @param account_id [String]
1249
- # @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
1250
- # @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.
1251
- # @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.
1252
- # @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
1253
- # @param body [SimpleOrderForm]
1254
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
1255
- def place_simple_order(instrument:, side:, type:, time_in_force:, amount:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, post_only: SENTINEL, expiration_date: SENTINEL, extra: {})
1256
- _body = {}
1257
- _body[:instrument] = instrument if instrument != SENTINEL
1258
- _body[:side] = side if side != SENTINEL
1259
- _body[:type] = type if type != SENTINEL
1260
- _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
1261
- _body[:amount] = amount if amount != SENTINEL
1262
- _body[:limit_price] = limit_price if limit_price != SENTINEL
1263
- _body[:stop_price] = stop_price if stop_price != SENTINEL
1264
- _body[:post_only] = post_only if post_only != SENTINEL
1265
- _body[:expiration_date] = expiration_date if expiration_date != SENTINEL
1266
- simple_order_form = _body
1267
- data, _status_code, _headers = place_simple_order_with_http_info_impl(user_id, user_secret, account_id, simple_order_form, extra)
1268
- data
1269
- end
1270
-
1271
- # Place crypto order
1272
- #
1273
- # Places an order in the specified account.
1274
- # This endpoint does not compute the impact to the account balance from the order before submitting the order.
1275
- #
1276
- # @param instrument [TradingInstrument]
1277
- # @param side [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
1278
- # @param type [SimpleOrderFormType] The type of order to place.
1279
- # @param time_in_force [SimpleOrderFormTimeInForce] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date.
1280
- # @param amount [Float] The amount of the base currency to buy or sell.
1281
- # @param user_id [String]
1282
- # @param user_secret [String]
1283
- # @param account_id [String]
1284
- # @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
1285
- # @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.
1286
- # @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.
1287
- # @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
1288
- # @param body [SimpleOrderForm]
1289
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
1290
- def place_simple_order_with_http_info(instrument:, side:, type:, time_in_force:, amount:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, post_only: SENTINEL, expiration_date: SENTINEL, extra: {})
1291
- _body = {}
1292
- _body[:instrument] = instrument if instrument != SENTINEL
1293
- _body[:side] = side if side != SENTINEL
1294
- _body[:type] = type if type != SENTINEL
1295
- _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
1296
- _body[:amount] = amount if amount != SENTINEL
1297
- _body[:limit_price] = limit_price if limit_price != SENTINEL
1298
- _body[:stop_price] = stop_price if stop_price != SENTINEL
1299
- _body[:post_only] = post_only if post_only != SENTINEL
1300
- _body[:expiration_date] = expiration_date if expiration_date != SENTINEL
1301
- simple_order_form = _body
1302
- place_simple_order_with_http_info_impl(user_id, user_secret, account_id, simple_order_form, extra)
1303
- end
1304
-
1305
- # Place crypto order
1306
- # 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.
1307
- # @param user_id [String]
1308
- # @param user_secret [String]
1309
- # @param account_id [String]
1310
- # @param simple_order_form [SimpleOrderForm]
1311
- # @param [Hash] opts the optional parameters
1312
- # @return [OrderUpdatedResponse]
1313
- private def place_simple_order_impl(user_id, user_secret, account_id, simple_order_form, opts = {})
1314
- data, _status_code, _headers = place_simple_order_with_http_info(user_id, user_secret, account_id, simple_order_form, opts)
1315
- data
1316
- end
1317
-
1318
- # Place crypto order
1319
- # 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.
1320
- # @param user_id [String]
1321
- # @param user_secret [String]
1322
- # @param account_id [String]
1323
- # @param simple_order_form [SimpleOrderForm]
1324
- # @param [Hash] opts the optional parameters
1325
- # @return [Array<(OrderUpdatedResponse, Integer, Hash)>] OrderUpdatedResponse data, response status code and response headers
1326
- private def place_simple_order_with_http_info_impl(user_id, user_secret, account_id, simple_order_form, opts = {})
1327
- if @api_client.config.debugging
1328
- @api_client.config.logger.debug 'Calling API: TradingApi.place_simple_order ...'
1329
- end
1330
- # verify the required parameter 'user_id' is set
1331
- if @api_client.config.client_side_validation && user_id.nil?
1332
- fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_simple_order"
1333
- end
1334
- # verify the required parameter 'user_secret' is set
1335
- if @api_client.config.client_side_validation && user_secret.nil?
1336
- fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_simple_order"
1337
- end
1338
- # verify the required parameter 'account_id' is set
1339
- if @api_client.config.client_side_validation && account_id.nil?
1340
- fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.place_simple_order"
1341
- end
1342
- # verify the required parameter 'simple_order_form' is set
1343
- if @api_client.config.client_side_validation && simple_order_form.nil?
1344
- fail ArgumentError, "Missing the required parameter 'simple_order_form' when calling TradingApi.place_simple_order"
1345
- end
1346
- # resource path
1347
- local_var_path = '/accounts/{accountId}/trading/simple'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
1348
-
1349
- # query parameters
1350
- query_params = opts[:query_params] || {}
1351
- query_params[:'userId'] = user_id
1352
- query_params[:'userSecret'] = user_secret
1353
-
1354
- # header parameters
1355
- header_params = opts[:header_params] || {}
1356
- # HTTP header 'Accept' (if needed)
1357
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1358
- # HTTP header 'Content-Type'
1359
- content_type = @api_client.select_header_content_type(['application/json'])
1360
- if !content_type.nil?
1361
- header_params['Content-Type'] = content_type
1362
- end
1363
-
1364
- # form parameters
1365
- form_params = opts[:form_params] || {}
1366
-
1367
- # http body (model)
1368
- post_body = opts[:debug_body] || @api_client.object_to_http_body(simple_order_form)
1369
-
1370
- # return_type
1371
- return_type = opts[:debug_return_type] || 'OrderUpdatedResponse'
1372
-
1373
- # auth_names
1374
- auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
1375
-
1376
- new_options = opts.merge(
1377
- :operation => :"TradingApi.place_simple_order",
1378
- :header_params => header_params,
1379
- :query_params => query_params,
1380
- :form_params => form_params,
1381
- :body => post_body,
1382
- :auth_names => auth_names,
1383
- :return_type => return_type
1384
- )
1385
-
1386
- data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
1387
- if @api_client.config.debugging
1388
- @api_client.config.logger.debug "API called: TradingApi#place_simple_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1389
- end
1390
- return data, status_code, headers, response
1391
- end
1392
-
1393
-
1394
1396
  # Preview crypto order
1395
1397
  #
1396
1398
  # Previews an order using the specified account.
1397
1399
  #
1398
- # @param instrument [TradingInstrument]
1400
+ # @param instrument [CryptoTradingInstrument]
1399
1401
  # @param side [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
1400
- # @param type [SimpleOrderFormType] The type of order to place.
1401
- # @param time_in_force [SimpleOrderFormTimeInForce] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date.
1402
+ # @param type [CryptoOrderFormType] The type of order to place.
1403
+ # @param time_in_force [CryptoOrderFormTimeInForce] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date.
1402
1404
  # @param amount [Float] The amount of the base currency to buy or sell.
1403
1405
  # @param user_id [String]
1404
1406
  # @param user_secret [String]
@@ -1407,9 +1409,9 @@ module SnapTrade
1407
1409
  # @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.
1408
1410
  # @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.
1409
1411
  # @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
1410
- # @param body [SimpleOrderForm]
1412
+ # @param body [CryptoOrderForm]
1411
1413
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
1412
- def preview_simple_order(instrument:, side:, type:, time_in_force:, amount:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, post_only: SENTINEL, expiration_date: SENTINEL, extra: {})
1414
+ def preview_crypto_order(instrument:, side:, type:, time_in_force:, amount:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, post_only: SENTINEL, expiration_date: SENTINEL, extra: {})
1413
1415
  _body = {}
1414
1416
  _body[:instrument] = instrument if instrument != SENTINEL
1415
1417
  _body[:side] = side if side != SENTINEL
@@ -1420,8 +1422,8 @@ module SnapTrade
1420
1422
  _body[:stop_price] = stop_price if stop_price != SENTINEL
1421
1423
  _body[:post_only] = post_only if post_only != SENTINEL
1422
1424
  _body[:expiration_date] = expiration_date if expiration_date != SENTINEL
1423
- simple_order_form = _body
1424
- data, _status_code, _headers = preview_simple_order_with_http_info_impl(user_id, user_secret, account_id, simple_order_form, extra)
1425
+ crypto_order_form = _body
1426
+ data, _status_code, _headers = preview_crypto_order_with_http_info_impl(user_id, user_secret, account_id, crypto_order_form, extra)
1425
1427
  data
1426
1428
  end
1427
1429
 
@@ -1429,10 +1431,10 @@ module SnapTrade
1429
1431
  #
1430
1432
  # Previews an order using the specified account.
1431
1433
  #
1432
- # @param instrument [TradingInstrument]
1434
+ # @param instrument [CryptoTradingInstrument]
1433
1435
  # @param side [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
1434
- # @param type [SimpleOrderFormType] The type of order to place.
1435
- # @param time_in_force [SimpleOrderFormTimeInForce] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date.
1436
+ # @param type [CryptoOrderFormType] The type of order to place.
1437
+ # @param time_in_force [CryptoOrderFormTimeInForce] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date.
1436
1438
  # @param amount [Float] The amount of the base currency to buy or sell.
1437
1439
  # @param user_id [String]
1438
1440
  # @param user_secret [String]
@@ -1441,9 +1443,9 @@ module SnapTrade
1441
1443
  # @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.
1442
1444
  # @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.
1443
1445
  # @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
1444
- # @param body [SimpleOrderForm]
1446
+ # @param body [CryptoOrderForm]
1445
1447
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
1446
- def preview_simple_order_with_http_info(instrument:, side:, type:, time_in_force:, amount:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, post_only: SENTINEL, expiration_date: SENTINEL, extra: {})
1448
+ def preview_crypto_order_with_http_info(instrument:, side:, type:, time_in_force:, amount:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, post_only: SENTINEL, expiration_date: SENTINEL, extra: {})
1447
1449
  _body = {}
1448
1450
  _body[:instrument] = instrument if instrument != SENTINEL
1449
1451
  _body[:side] = side if side != SENTINEL
@@ -1454,8 +1456,8 @@ module SnapTrade
1454
1456
  _body[:stop_price] = stop_price if stop_price != SENTINEL
1455
1457
  _body[:post_only] = post_only if post_only != SENTINEL
1456
1458
  _body[:expiration_date] = expiration_date if expiration_date != SENTINEL
1457
- simple_order_form = _body
1458
- preview_simple_order_with_http_info_impl(user_id, user_secret, account_id, simple_order_form, extra)
1459
+ crypto_order_form = _body
1460
+ preview_crypto_order_with_http_info_impl(user_id, user_secret, account_id, crypto_order_form, extra)
1459
1461
  end
1460
1462
 
1461
1463
  # Preview crypto order
@@ -1463,11 +1465,11 @@ module SnapTrade
1463
1465
  # @param user_id [String]
1464
1466
  # @param user_secret [String]
1465
1467
  # @param account_id [String]
1466
- # @param simple_order_form [SimpleOrderForm]
1468
+ # @param crypto_order_form [CryptoOrderForm]
1467
1469
  # @param [Hash] opts the optional parameters
1468
- # @return [SimpleOrderPreview]
1469
- private def preview_simple_order_impl(user_id, user_secret, account_id, simple_order_form, opts = {})
1470
- data, _status_code, _headers = preview_simple_order_with_http_info(user_id, user_secret, account_id, simple_order_form, opts)
1470
+ # @return [CryptoOrderPreview]
1471
+ private def preview_crypto_order_impl(user_id, user_secret, account_id, crypto_order_form, opts = {})
1472
+ data, _status_code, _headers = preview_crypto_order_with_http_info(user_id, user_secret, account_id, crypto_order_form, opts)
1471
1473
  data
1472
1474
  end
1473
1475
 
@@ -1476,31 +1478,31 @@ module SnapTrade
1476
1478
  # @param user_id [String]
1477
1479
  # @param user_secret [String]
1478
1480
  # @param account_id [String]
1479
- # @param simple_order_form [SimpleOrderForm]
1481
+ # @param crypto_order_form [CryptoOrderForm]
1480
1482
  # @param [Hash] opts the optional parameters
1481
- # @return [Array<(SimpleOrderPreview, Integer, Hash)>] SimpleOrderPreview data, response status code and response headers
1482
- private def preview_simple_order_with_http_info_impl(user_id, user_secret, account_id, simple_order_form, opts = {})
1483
+ # @return [Array<(CryptoOrderPreview, Integer, Hash)>] CryptoOrderPreview data, response status code and response headers
1484
+ private def preview_crypto_order_with_http_info_impl(user_id, user_secret, account_id, crypto_order_form, opts = {})
1483
1485
  if @api_client.config.debugging
1484
- @api_client.config.logger.debug 'Calling API: TradingApi.preview_simple_order ...'
1486
+ @api_client.config.logger.debug 'Calling API: TradingApi.preview_crypto_order ...'
1485
1487
  end
1486
1488
  # verify the required parameter 'user_id' is set
1487
1489
  if @api_client.config.client_side_validation && user_id.nil?
1488
- fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.preview_simple_order"
1490
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.preview_crypto_order"
1489
1491
  end
1490
1492
  # verify the required parameter 'user_secret' is set
1491
1493
  if @api_client.config.client_side_validation && user_secret.nil?
1492
- fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.preview_simple_order"
1494
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.preview_crypto_order"
1493
1495
  end
1494
1496
  # verify the required parameter 'account_id' is set
1495
1497
  if @api_client.config.client_side_validation && account_id.nil?
1496
- fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.preview_simple_order"
1498
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.preview_crypto_order"
1497
1499
  end
1498
- # verify the required parameter 'simple_order_form' is set
1499
- if @api_client.config.client_side_validation && simple_order_form.nil?
1500
- fail ArgumentError, "Missing the required parameter 'simple_order_form' when calling TradingApi.preview_simple_order"
1500
+ # verify the required parameter 'crypto_order_form' is set
1501
+ if @api_client.config.client_side_validation && crypto_order_form.nil?
1502
+ fail ArgumentError, "Missing the required parameter 'crypto_order_form' when calling TradingApi.preview_crypto_order"
1501
1503
  end
1502
1504
  # resource path
1503
- local_var_path = '/accounts/{accountId}/trading/simple/preview'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
1505
+ local_var_path = '/accounts/{accountId}/trading/crypto/preview'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
1504
1506
 
1505
1507
  # query parameters
1506
1508
  query_params = opts[:query_params] || {}
@@ -1521,16 +1523,16 @@ module SnapTrade
1521
1523
  form_params = opts[:form_params] || {}
1522
1524
 
1523
1525
  # http body (model)
1524
- post_body = opts[:debug_body] || @api_client.object_to_http_body(simple_order_form)
1526
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(crypto_order_form)
1525
1527
 
1526
1528
  # return_type
1527
- return_type = opts[:debug_return_type] || 'SimpleOrderPreview'
1529
+ return_type = opts[:debug_return_type] || 'CryptoOrderPreview'
1528
1530
 
1529
1531
  # auth_names
1530
1532
  auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
1531
1533
 
1532
1534
  new_options = opts.merge(
1533
- :operation => :"TradingApi.preview_simple_order",
1535
+ :operation => :"TradingApi.preview_crypto_order",
1534
1536
  :header_params => header_params,
1535
1537
  :query_params => query_params,
1536
1538
  :form_params => form_params,
@@ -1541,7 +1543,7 @@ module SnapTrade
1541
1543
 
1542
1544
  data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
1543
1545
  if @api_client.config.debugging
1544
- @api_client.config.logger.debug "API called: TradingApi#preview_simple_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1546
+ @api_client.config.logger.debug "API called: TradingApi#preview_crypto_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1545
1547
  end
1546
1548
  return data, status_code, headers, response
1547
1549
  end
@@ -1553,11 +1555,11 @@ module SnapTrade
1553
1555
  # 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
1554
1556
  # returned in the response going forward. Only supported on some brokerages
1555
1557
  #
1558
+ # @param brokerage_order_id [String] Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
1556
1559
  # @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
1557
1560
  # @param order_type [OrderTypeStrict] 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.
1558
1561
  # @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
1559
1562
  # @param account_id [String] The ID of the account to execute the trade on.
1560
- # @param brokerage_order_id [String] The Brokerage Order ID of the order to replace.
1561
1563
  # @param user_id [String]
1562
1564
  # @param user_secret [String]
1563
1565
  # @param price [Float] The limit price for `Limit` and `StopLimit` orders.
@@ -1566,8 +1568,9 @@ module SnapTrade
1566
1568
  # @param units [Float]
1567
1569
  # @param body [ManualTradeReplaceForm]
1568
1570
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
1569
- def replace_order(action:, order_type:, time_in_force:, account_id:, brokerage_order_id:, user_id:, user_secret:, price: SENTINEL, symbol: SENTINEL, stop: SENTINEL, units: SENTINEL, extra: {})
1571
+ def replace_order(brokerage_order_id:, action:, order_type:, time_in_force:, account_id:, user_id:, user_secret:, price: SENTINEL, symbol: SENTINEL, stop: SENTINEL, units: SENTINEL, extra: {})
1570
1572
  _body = {}
1573
+ _body[:brokerage_order_id] = brokerage_order_id if brokerage_order_id != SENTINEL
1571
1574
  _body[:action] = action if action != SENTINEL
1572
1575
  _body[:order_type] = order_type if order_type != SENTINEL
1573
1576
  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
@@ -1576,7 +1579,7 @@ module SnapTrade
1576
1579
  _body[:stop] = stop if stop != SENTINEL
1577
1580
  _body[:units] = units if units != SENTINEL
1578
1581
  manual_trade_replace_form = _body
1579
- data, _status_code, _headers = replace_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, manual_trade_replace_form, extra)
1582
+ data, _status_code, _headers = replace_order_with_http_info_impl(account_id, user_id, user_secret, manual_trade_replace_form, extra)
1580
1583
  data
1581
1584
  end
1582
1585
 
@@ -1586,11 +1589,11 @@ module SnapTrade
1586
1589
  # 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
1587
1590
  # returned in the response going forward. Only supported on some brokerages
1588
1591
  #
1592
+ # @param brokerage_order_id [String] Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
1589
1593
  # @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
1590
1594
  # @param order_type [OrderTypeStrict] 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.
1591
1595
  # @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
1592
1596
  # @param account_id [String] The ID of the account to execute the trade on.
1593
- # @param brokerage_order_id [String] The Brokerage Order ID of the order to replace.
1594
1597
  # @param user_id [String]
1595
1598
  # @param user_secret [String]
1596
1599
  # @param price [Float] The limit price for `Limit` and `StopLimit` orders.
@@ -1599,8 +1602,9 @@ module SnapTrade
1599
1602
  # @param units [Float]
1600
1603
  # @param body [ManualTradeReplaceForm]
1601
1604
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
1602
- def replace_order_with_http_info(action:, order_type:, time_in_force:, account_id:, brokerage_order_id:, user_id:, user_secret:, price: SENTINEL, symbol: SENTINEL, stop: SENTINEL, units: SENTINEL, extra: {})
1605
+ def replace_order_with_http_info(brokerage_order_id:, action:, order_type:, time_in_force:, account_id:, user_id:, user_secret:, price: SENTINEL, symbol: SENTINEL, stop: SENTINEL, units: SENTINEL, extra: {})
1603
1606
  _body = {}
1607
+ _body[:brokerage_order_id] = brokerage_order_id if brokerage_order_id != SENTINEL
1604
1608
  _body[:action] = action if action != SENTINEL
1605
1609
  _body[:order_type] = order_type if order_type != SENTINEL
1606
1610
  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
@@ -1609,33 +1613,31 @@ module SnapTrade
1609
1613
  _body[:stop] = stop if stop != SENTINEL
1610
1614
  _body[:units] = units if units != SENTINEL
1611
1615
  manual_trade_replace_form = _body
1612
- replace_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, manual_trade_replace_form, extra)
1616
+ replace_order_with_http_info_impl(account_id, user_id, user_secret, manual_trade_replace_form, extra)
1613
1617
  end
1614
1618
 
1615
1619
  # Replace equity order
1616
1620
  # 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
1617
1621
  # @param account_id [String] The ID of the account to execute the trade on.
1618
- # @param brokerage_order_id [String] The Brokerage Order ID of the order to replace.
1619
1622
  # @param user_id [String]
1620
1623
  # @param user_secret [String]
1621
1624
  # @param manual_trade_replace_form [ManualTradeReplaceForm]
1622
1625
  # @param [Hash] opts the optional parameters
1623
1626
  # @return [AccountOrderRecord]
1624
- private def replace_order_impl(account_id, brokerage_order_id, user_id, user_secret, manual_trade_replace_form, opts = {})
1625
- data, _status_code, _headers = replace_order_with_http_info(account_id, brokerage_order_id, user_id, user_secret, manual_trade_replace_form, opts)
1627
+ private def replace_order_impl(account_id, user_id, user_secret, manual_trade_replace_form, opts = {})
1628
+ data, _status_code, _headers = replace_order_with_http_info(account_id, user_id, user_secret, manual_trade_replace_form, opts)
1626
1629
  data
1627
1630
  end
1628
1631
 
1629
1632
  # Replace equity order
1630
1633
  # 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&#39;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
1631
1634
  # @param account_id [String] The ID of the account to execute the trade on.
1632
- # @param brokerage_order_id [String] The Brokerage Order ID of the order to replace.
1633
1635
  # @param user_id [String]
1634
1636
  # @param user_secret [String]
1635
1637
  # @param manual_trade_replace_form [ManualTradeReplaceForm]
1636
1638
  # @param [Hash] opts the optional parameters
1637
1639
  # @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
1638
- private def replace_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, manual_trade_replace_form, opts = {})
1640
+ private def replace_order_with_http_info_impl(account_id, user_id, user_secret, manual_trade_replace_form, opts = {})
1639
1641
  if @api_client.config.debugging
1640
1642
  @api_client.config.logger.debug 'Calling API: TradingApi.replace_order ...'
1641
1643
  end
@@ -1643,10 +1645,6 @@ module SnapTrade
1643
1645
  if @api_client.config.client_side_validation && account_id.nil?
1644
1646
  fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.replace_order"
1645
1647
  end
1646
- # verify the required parameter 'brokerage_order_id' is set
1647
- if @api_client.config.client_side_validation && brokerage_order_id.nil?
1648
- fail ArgumentError, "Missing the required parameter 'brokerage_order_id' when calling TradingApi.replace_order"
1649
- end
1650
1648
  # verify the required parameter 'user_id' is set
1651
1649
  if @api_client.config.client_side_validation && user_id.nil?
1652
1650
  fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.replace_order"
@@ -1660,7 +1658,7 @@ module SnapTrade
1660
1658
  fail ArgumentError, "Missing the required parameter 'manual_trade_replace_form' when calling TradingApi.replace_order"
1661
1659
  end
1662
1660
  # resource path
1663
- local_var_path = '/accounts/{accountId}/trading/simple/{brokerageOrderId}/replace'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'brokerageOrderId' + '}', CGI.escape(brokerage_order_id.to_s))
1661
+ local_var_path = '/accounts/{accountId}/trading/replace'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
1664
1662
 
1665
1663
  # query parameters
1666
1664
  query_params = opts[:query_params] || {}
@@ -1699,7 +1697,7 @@ module SnapTrade
1699
1697
  :return_type => return_type
1700
1698
  )
1701
1699
 
1702
- data, status_code, headers, response = @api_client.call_api(:PATCH, local_var_path, new_options)
1700
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
1703
1701
  if @api_client.config.debugging
1704
1702
  @api_client.config.logger.debug "API called: TradingApi#replace_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1705
1703
  end