snaptrade 3.0.29 → 3.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +202 -2
  3. data/lib/snaptrade/api/account_information_api.rb +6 -2
  4. data/lib/snaptrade/api/experimental_endpoints_api.rb +406 -0
  5. data/lib/snaptrade/models/account_position.rb +1 -1
  6. data/lib/snaptrade/models/account_value_history_response.rb +1 -1
  7. data/lib/snaptrade/models/all_user_accounts_response.rb +225 -0
  8. data/lib/snaptrade/models/{account_type.rb → cash_or_margin.rb} +3 -3
  9. data/lib/snaptrade/models/connection_account.rb +1 -1
  10. data/lib/snaptrade/models/institution.rb +1 -1
  11. data/lib/snaptrade/models/investment_account.rb +8 -8
  12. data/lib/snaptrade/models/position.rb +1 -1
  13. data/lib/snaptrade/models/release_stage.rb +2 -1
  14. data/lib/snaptrade/models/simple_trade_form.rb +346 -0
  15. data/lib/snaptrade/models/simple_trade_form_order_type.rb +39 -0
  16. data/lib/snaptrade/models/simple_trade_form_price_effect.rb +38 -0
  17. data/lib/snaptrade/models/simple_trade_form_time_in_force.rb +40 -0
  18. data/lib/snaptrade/models/simple_trade_form_trading_session.rb +37 -0
  19. data/lib/snaptrade/models/simple_trade_instrument.rb +255 -0
  20. data/lib/snaptrade/models/simple_trade_instrument_kind.rb +39 -0
  21. data/lib/snaptrade/models/simple_trade_leg.rb +246 -0
  22. data/lib/snaptrade/models/simple_trade_leg_action.rb +41 -0
  23. data/lib/snaptrade/models/simple_trade_response.rb +222 -0
  24. data/lib/snaptrade/version.rb +1 -1
  25. data/lib/snaptrade.rb +12 -1
  26. data/spec/api/account_information_api_spec.rb +1 -1
  27. data/spec/api/experimental_endpoints_api_spec.rb +42 -0
  28. data/spec/models/all_user_accounts_response_spec.rb +29 -0
  29. data/spec/models/{account_type_spec.rb → cash_or_margin_spec.rb} +6 -6
  30. data/spec/models/investment_account_spec.rb +1 -1
  31. data/spec/models/simple_trade_form_order_type_spec.rb +23 -0
  32. data/spec/models/simple_trade_form_price_effect_spec.rb +23 -0
  33. data/spec/models/simple_trade_form_spec.rb +83 -0
  34. data/spec/models/simple_trade_form_time_in_force_spec.rb +23 -0
  35. data/spec/models/simple_trade_form_trading_session_spec.rb +23 -0
  36. data/spec/models/simple_trade_instrument_kind_spec.rb +23 -0
  37. data/spec/models/simple_trade_instrument_spec.rb +35 -0
  38. data/spec/models/simple_trade_leg_action_spec.rb +23 -0
  39. data/spec/models/simple_trade_leg_spec.rb +41 -0
  40. data/spec/models/simple_trade_response_spec.rb +29 -0
  41. metadata +264 -231
@@ -239,6 +239,129 @@ module SnapTrade
239
239
  end
240
240
 
241
241
 
242
+ # Get account details
243
+ #
244
+ # Experimental and subject to change without notice.
245
+ #
246
+ # Returns the specified account for the authenticated user, using the `kind`-discriminated account shape. Use the `kind` discriminator to determine the shape of the account, which can be an investment, deposit, or line of credit account.
247
+ #
248
+ # On Pay as you Go / Real-time, this endpoint refreshes the account's opening date and total net value (`net_value`) live from the institution on each call, along with funding date for `investment` accounts.
249
+ #
250
+ # On Pay as you Go / Daily, this endpoint returns Daily data. Daily data is cached and refreshed once a day. Exact refresh timing may vary by institution. To force a refresh, use the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization).
251
+ #
252
+ # Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see whether your plan includes real-time data.
253
+ #
254
+ # If the connection has become disabled, it can no longer access the latest data from the institution, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
255
+ #
256
+ # @param user_id [String]
257
+ # @param user_secret [String]
258
+ # @param account_id [String]
259
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
260
+ def get_account_details(user_id:, user_secret:, account_id:, extra: {})
261
+ data, _status_code, _headers = get_account_details_with_http_info_impl(user_id, user_secret, account_id, extra)
262
+ data
263
+ end
264
+
265
+ # Get account details
266
+ #
267
+ # Experimental and subject to change without notice.
268
+ #
269
+ # Returns the specified account for the authenticated user, using the `kind`-discriminated account shape. Use the `kind` discriminator to determine the shape of the account, which can be an investment, deposit, or line of credit account.
270
+ #
271
+ # On Pay as you Go / Real-time, this endpoint refreshes the account's opening date and total net value (`net_value`) live from the institution on each call, along with funding date for `investment` accounts.
272
+ #
273
+ # On Pay as you Go / Daily, this endpoint returns Daily data. Daily data is cached and refreshed once a day. Exact refresh timing may vary by institution. To force a refresh, use the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization).
274
+ #
275
+ # Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see whether your plan includes real-time data.
276
+ #
277
+ # If the connection has become disabled, it can no longer access the latest data from the institution, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
278
+ #
279
+ # @param user_id [String]
280
+ # @param user_secret [String]
281
+ # @param account_id [String]
282
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
283
+ def get_account_details_with_http_info(user_id:, user_secret:, account_id:, extra: {})
284
+ get_account_details_with_http_info_impl(user_id, user_secret, account_id, extra)
285
+ end
286
+
287
+ # Get account details
288
+ # Experimental and subject to change without notice. Returns the specified account for the authenticated user, using the `kind`-discriminated account shape. Use the `kind` discriminator to determine the shape of the account, which can be an investment, deposit, or line of credit account. On Pay as you Go / Real-time, this endpoint refreshes the account's opening date and total net value (`net_value`) live from the institution on each call, along with funding date for `investment` accounts. On Pay as you Go / Daily, this endpoint returns Daily data. Daily data is cached and refreshed once a day. Exact refresh timing may vary by institution. To force a refresh, use the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see whether your plan includes real-time data. If the connection has become disabled, it can no longer access the latest data from the institution, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
289
+ # @param user_id [String]
290
+ # @param user_secret [String]
291
+ # @param account_id [String]
292
+ # @param [Hash] opts the optional parameters
293
+ # @return [ConnectionAccount]
294
+ private def get_account_details_impl(user_id, user_secret, account_id, opts = {})
295
+ data, _status_code, _headers = get_account_details_with_http_info(user_id, user_secret, account_id, opts)
296
+ data
297
+ end
298
+
299
+ # Get account details
300
+ # Experimental and subject to change without notice. Returns the specified account for the authenticated user, using the `kind`-discriminated account shape. Use the `kind` discriminator to determine the shape of the account, which can be an investment, deposit, or line of credit account. On Pay as you Go / Real-time, this endpoint refreshes the account's opening date and total net value (`net_value`) live from the institution on each call, along with funding date for `investment` accounts. On Pay as you Go / Daily, this endpoint returns Daily data. Daily data is cached and refreshed once a day. Exact refresh timing may vary by institution. To force a refresh, use the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see whether your plan includes real-time data. If the connection has become disabled, it can no longer access the latest data from the institution, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
301
+ # @param user_id [String]
302
+ # @param user_secret [String]
303
+ # @param account_id [String]
304
+ # @param [Hash] opts the optional parameters
305
+ # @return [Array<(ConnectionAccount, Integer, Hash)>] ConnectionAccount data, response status code and response headers
306
+ private def get_account_details_with_http_info_impl(user_id, user_secret, account_id, opts = {})
307
+ if @api_client.config.debugging
308
+ @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.get_account_details ...'
309
+ end
310
+ # verify the required parameter 'user_id' is set
311
+ if @api_client.config.client_side_validation && user_id.nil?
312
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.get_account_details"
313
+ end
314
+ # verify the required parameter 'user_secret' is set
315
+ if @api_client.config.client_side_validation && user_secret.nil?
316
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.get_account_details"
317
+ end
318
+ # verify the required parameter 'account_id' is set
319
+ if @api_client.config.client_side_validation && account_id.nil?
320
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_account_details"
321
+ end
322
+ # resource path
323
+ local_var_path = '/accounts/{accountId}/details'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
324
+
325
+ # query parameters
326
+ query_params = opts[:query_params] || {}
327
+ query_params[:'userId'] = user_id
328
+ query_params[:'userSecret'] = user_secret
329
+
330
+ # header parameters
331
+ header_params = opts[:header_params] || {}
332
+ # HTTP header 'Accept' (if needed)
333
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
334
+
335
+ # form parameters
336
+ form_params = opts[:form_params] || {}
337
+
338
+ # http body (model)
339
+ post_body = opts[:debug_body]
340
+
341
+ # return_type
342
+ return_type = opts[:debug_return_type] || 'ConnectionAccount'
343
+
344
+ # auth_names
345
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
346
+
347
+ new_options = opts.merge(
348
+ :operation => :"ExperimentalEndpointsApi.get_account_details",
349
+ :header_params => header_params,
350
+ :query_params => query_params,
351
+ :form_params => form_params,
352
+ :body => post_body,
353
+ :auth_names => auth_names,
354
+ :return_type => return_type
355
+ )
356
+
357
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
358
+ if @api_client.config.debugging
359
+ @api_client.config.logger.debug "API called: ExperimentalEndpointsApi#get_account_details\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
360
+ end
361
+ return data, status_code, headers, response
362
+ end
363
+
364
+
242
365
  # Get account order detail (V2)
243
366
  #
244
367
  # Returns the detail of a single order using the brokerage order ID provided as a path parameter.
@@ -619,6 +742,113 @@ module SnapTrade
619
742
  end
620
743
 
621
744
 
745
+ # List all user accounts
746
+ #
747
+ # Experimental and subject to change without notice.
748
+ #
749
+ # Returns all accounts across all connections known to SnapTrade for the authenticated user.
750
+ #
751
+ # The `results` list can contain multiple account kinds in the same response, including investment, deposit, and line of credit accounts. Use the `kind` discriminator to determine the shape for each account.
752
+ #
753
+ # This endpoint returns Daily data regardless of the customer's plan. Daily data is cached and refreshed once a day, which makes this endpoint fast and well-suited to listing accounts across all of a user's connections in a single call. Exact refresh timing may vary by institution. To get real-time data on Pay as you Go / Real-time, use the [list accounts for a connection endpoint](/reference/Connections/Connections_listConnectionAccounts). Customers on Pay as you Go / Daily can force a refresh with the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization).
754
+ #
755
+ # @param user_id [String]
756
+ # @param user_secret [String]
757
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
758
+ def list_all_user_accounts(user_id:, user_secret:, extra: {})
759
+ data, _status_code, _headers = list_all_user_accounts_with_http_info_impl(user_id, user_secret, extra)
760
+ data
761
+ end
762
+
763
+ # List all user accounts
764
+ #
765
+ # Experimental and subject to change without notice.
766
+ #
767
+ # Returns all accounts across all connections known to SnapTrade for the authenticated user.
768
+ #
769
+ # The `results` list can contain multiple account kinds in the same response, including investment, deposit, and line of credit accounts. Use the `kind` discriminator to determine the shape for each account.
770
+ #
771
+ # This endpoint returns Daily data regardless of the customer's plan. Daily data is cached and refreshed once a day, which makes this endpoint fast and well-suited to listing accounts across all of a user's connections in a single call. Exact refresh timing may vary by institution. To get real-time data on Pay as you Go / Real-time, use the [list accounts for a connection endpoint](/reference/Connections/Connections_listConnectionAccounts). Customers on Pay as you Go / Daily can force a refresh with the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization).
772
+ #
773
+ # @param user_id [String]
774
+ # @param user_secret [String]
775
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
776
+ def list_all_user_accounts_with_http_info(user_id:, user_secret:, extra: {})
777
+ list_all_user_accounts_with_http_info_impl(user_id, user_secret, extra)
778
+ end
779
+
780
+ # List all user accounts
781
+ # Experimental and subject to change without notice. Returns all accounts across all connections known to SnapTrade for the authenticated user. The `results` list can contain multiple account kinds in the same response, including investment, deposit, and line of credit accounts. Use the `kind` discriminator to determine the shape for each account. This endpoint returns Daily data regardless of the customer's plan. Daily data is cached and refreshed once a day, which makes this endpoint fast and well-suited to listing accounts across all of a user's connections in a single call. Exact refresh timing may vary by institution. To get real-time data on Pay as you Go / Real-time, use the [list accounts for a connection endpoint](/reference/Connections/Connections_listConnectionAccounts). Customers on Pay as you Go / Daily can force a refresh with the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization).
782
+ # @param user_id [String]
783
+ # @param user_secret [String]
784
+ # @param [Hash] opts the optional parameters
785
+ # @return [AllUserAccountsResponse]
786
+ private def list_all_user_accounts_impl(user_id, user_secret, opts = {})
787
+ data, _status_code, _headers = list_all_user_accounts_with_http_info(user_id, user_secret, opts)
788
+ data
789
+ end
790
+
791
+ # List all user accounts
792
+ # Experimental and subject to change without notice. Returns all accounts across all connections known to SnapTrade for the authenticated user. The &#x60;results&#x60; list can contain multiple account kinds in the same response, including investment, deposit, and line of credit accounts. Use the &#x60;kind&#x60; discriminator to determine the shape for each account. This endpoint returns Daily data regardless of the customer&#39;s plan. Daily data is cached and refreshed once a day, which makes this endpoint fast and well-suited to listing accounts across all of a user&#39;s connections in a single call. Exact refresh timing may vary by institution. To get real-time data on Pay as you Go / Real-time, use the [list accounts for a connection endpoint](/reference/Connections/Connections_listConnectionAccounts). Customers on Pay as you Go / Daily can force a refresh with the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization).
793
+ # @param user_id [String]
794
+ # @param user_secret [String]
795
+ # @param [Hash] opts the optional parameters
796
+ # @return [Array<(AllUserAccountsResponse, Integer, Hash)>] AllUserAccountsResponse data, response status code and response headers
797
+ private def list_all_user_accounts_with_http_info_impl(user_id, user_secret, opts = {})
798
+ if @api_client.config.debugging
799
+ @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.list_all_user_accounts ...'
800
+ end
801
+ # verify the required parameter 'user_id' is set
802
+ if @api_client.config.client_side_validation && user_id.nil?
803
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.list_all_user_accounts"
804
+ end
805
+ # verify the required parameter 'user_secret' is set
806
+ if @api_client.config.client_side_validation && user_secret.nil?
807
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.list_all_user_accounts"
808
+ end
809
+ # resource path
810
+ local_var_path = '/accounts/all'
811
+
812
+ # query parameters
813
+ query_params = opts[:query_params] || {}
814
+ query_params[:'userId'] = user_id
815
+ query_params[:'userSecret'] = user_secret
816
+
817
+ # header parameters
818
+ header_params = opts[:header_params] || {}
819
+ # HTTP header 'Accept' (if needed)
820
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
821
+
822
+ # form parameters
823
+ form_params = opts[:form_params] || {}
824
+
825
+ # http body (model)
826
+ post_body = opts[:debug_body]
827
+
828
+ # return_type
829
+ return_type = opts[:debug_return_type] || 'AllUserAccountsResponse'
830
+
831
+ # auth_names
832
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
833
+
834
+ new_options = opts.merge(
835
+ :operation => :"ExperimentalEndpointsApi.list_all_user_accounts",
836
+ :header_params => header_params,
837
+ :query_params => query_params,
838
+ :form_params => form_params,
839
+ :body => post_body,
840
+ :auth_names => auth_names,
841
+ :return_type => return_type
842
+ )
843
+
844
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
845
+ if @api_client.config.debugging
846
+ @api_client.config.logger.debug "API called: ExperimentalEndpointsApi#list_all_user_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
847
+ end
848
+ return data, status_code, headers, response
849
+ end
850
+
851
+
622
852
  # List active Trade Detection subscriptions
623
853
  #
624
854
  # Returns active Trade Detection subscriptions for your Client ID. Cancelled subscriptions are not returned.
@@ -694,6 +924,182 @@ module SnapTrade
694
924
  end
695
925
  return data, status_code, headers, response
696
926
  end
927
+
928
+
929
+ # Place a simple order (beta)
930
+ #
931
+ # **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase.
932
+ #
933
+ # Equity and equity-option orders use the existing brokerage trading capabilities. Futures and future options are currently supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages).
934
+ #
935
+ # An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders.
936
+ #
937
+ # All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or the exact tastytrade BrokerageInstrument ticker for futures and future options, including any spaces.
938
+ #
939
+ # A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
940
+ #
941
+ # @param order_type [SimpleTradeFormOrderType]
942
+ # @param time_in_force [SimpleTradeFormTimeInForce] Order duration, subject to brokerage and execution-path support. gtd requires expiry_date and a non-market single-leg equity/option order. Existing single-leg option routing does not support ioc. Futures and multi-leg orders do not support gtd through this endpoint.
943
+ # @param legs [Array<SimpleTradeLeg>] Legs of one brokerage order. Use equity/option legs or future/future_option legs, without mixing the two families. Brokerage strategy and leg-count limits apply.
944
+ # @param account_id [String] The ID of the account to execute the trade on.
945
+ # @param user_id [String]
946
+ # @param user_secret [String]
947
+ # @param limit_price [Float] Required for limit and stop_limit orders, except that multi-leg price_effect even implies zero. Must be omitted or null for market and stop orders. For multi-leg orders this is the net strategy price. Negative prices are accepted only for futures-family orders, subject to brokerage support.
948
+ # @param stop_price [Float] Required for stop and stop_limit orders. Must be omitted or null for market and limit orders. Must be positive for equity/option orders; futures-family trigger prices are subject to brokerage support.
949
+ # @param price_effect [SimpleTradeFormPriceEffect] Only applicable to multi-leg limit and stop_limit orders. Requirements and supported values depend on the brokerage; tastytrade requires credit or debit. even implies a zero limit_price, which may be omitted and must be zero if supplied. Single-leg price effects are derived from the action.
950
+ # @param client_order_id [String] Optional canonical UUID, forwarded where the existing execution path supports it and for tastytrade futures orders. Requires the existing client-order-ID enablement; when disabled the value is ignored. Brokerage behavior on duplicates varies; SnapTrade does not enforce uniqueness. Tastytrade uses this as external-identifier for correlation and does not deduplicate submissions.
951
+ # @param expiry_date [Time] ISO 8601 expiry timestamp, required for gtd and invalid with other durations. A missing timezone is treated as UTC. Supported only through existing single-leg Public and Sandbox execution paths.
952
+ # @param notional_value [Float] Positive order value, supported only for a single-equity market order on eligible brokerages and partners. Mutually exclusive with leg units. Omit or set units to null when supplied.
953
+ # @param trading_session [SimpleTradeFormTradingSession] extended uses existing single-leg equity/option brokerage support and requires extended-hours enablement. Futures and multi-leg orders only accept regular.
954
+ # @param body [SimpleTradeForm]
955
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
956
+ def place_simple_order(order_type:, time_in_force:, legs:, account_id:, user_id:, user_secret:, limit_price: SENTINEL, stop_price: SENTINEL, price_effect: SENTINEL, client_order_id: SENTINEL, expiry_date: SENTINEL, notional_value: SENTINEL, trading_session: 'regular', extra: {})
957
+ _body = {}
958
+ _body[:order_type] = order_type if order_type != SENTINEL
959
+ _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
960
+ _body[:legs] = legs if legs != SENTINEL
961
+ _body[:limit_price] = limit_price if limit_price != SENTINEL
962
+ _body[:stop_price] = stop_price if stop_price != SENTINEL
963
+ _body[:price_effect] = price_effect if price_effect != SENTINEL
964
+ _body[:client_order_id] = client_order_id if client_order_id != SENTINEL
965
+ _body[:expiry_date] = expiry_date if expiry_date != SENTINEL
966
+ _body[:notional_value] = notional_value if notional_value != SENTINEL
967
+ _body[:trading_session] = trading_session if trading_session != SENTINEL
968
+ simple_trade_form = _body
969
+ data, _status_code, _headers = place_simple_order_with_http_info_impl(account_id, user_id, user_secret, simple_trade_form, extra)
970
+ data
971
+ end
972
+
973
+ # Place a simple order (beta)
974
+ #
975
+ # **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase.
976
+ #
977
+ # Equity and equity-option orders use the existing brokerage trading capabilities. Futures and future options are currently supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages).
978
+ #
979
+ # An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders.
980
+ #
981
+ # All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or the exact tastytrade BrokerageInstrument ticker for futures and future options, including any spaces.
982
+ #
983
+ # A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
984
+ #
985
+ # @param order_type [SimpleTradeFormOrderType]
986
+ # @param time_in_force [SimpleTradeFormTimeInForce] Order duration, subject to brokerage and execution-path support. gtd requires expiry_date and a non-market single-leg equity/option order. Existing single-leg option routing does not support ioc. Futures and multi-leg orders do not support gtd through this endpoint.
987
+ # @param legs [Array<SimpleTradeLeg>] Legs of one brokerage order. Use equity/option legs or future/future_option legs, without mixing the two families. Brokerage strategy and leg-count limits apply.
988
+ # @param account_id [String] The ID of the account to execute the trade on.
989
+ # @param user_id [String]
990
+ # @param user_secret [String]
991
+ # @param limit_price [Float] Required for limit and stop_limit orders, except that multi-leg price_effect even implies zero. Must be omitted or null for market and stop orders. For multi-leg orders this is the net strategy price. Negative prices are accepted only for futures-family orders, subject to brokerage support.
992
+ # @param stop_price [Float] Required for stop and stop_limit orders. Must be omitted or null for market and limit orders. Must be positive for equity/option orders; futures-family trigger prices are subject to brokerage support.
993
+ # @param price_effect [SimpleTradeFormPriceEffect] Only applicable to multi-leg limit and stop_limit orders. Requirements and supported values depend on the brokerage; tastytrade requires credit or debit. even implies a zero limit_price, which may be omitted and must be zero if supplied. Single-leg price effects are derived from the action.
994
+ # @param client_order_id [String] Optional canonical UUID, forwarded where the existing execution path supports it and for tastytrade futures orders. Requires the existing client-order-ID enablement; when disabled the value is ignored. Brokerage behavior on duplicates varies; SnapTrade does not enforce uniqueness. Tastytrade uses this as external-identifier for correlation and does not deduplicate submissions.
995
+ # @param expiry_date [Time] ISO 8601 expiry timestamp, required for gtd and invalid with other durations. A missing timezone is treated as UTC. Supported only through existing single-leg Public and Sandbox execution paths.
996
+ # @param notional_value [Float] Positive order value, supported only for a single-equity market order on eligible brokerages and partners. Mutually exclusive with leg units. Omit or set units to null when supplied.
997
+ # @param trading_session [SimpleTradeFormTradingSession] extended uses existing single-leg equity/option brokerage support and requires extended-hours enablement. Futures and multi-leg orders only accept regular.
998
+ # @param body [SimpleTradeForm]
999
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
1000
+ def place_simple_order_with_http_info(order_type:, time_in_force:, legs:, account_id:, user_id:, user_secret:, limit_price: SENTINEL, stop_price: SENTINEL, price_effect: SENTINEL, client_order_id: SENTINEL, expiry_date: SENTINEL, notional_value: SENTINEL, trading_session: 'regular', extra: {})
1001
+ _body = {}
1002
+ _body[:order_type] = order_type if order_type != SENTINEL
1003
+ _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
1004
+ _body[:legs] = legs if legs != SENTINEL
1005
+ _body[:limit_price] = limit_price if limit_price != SENTINEL
1006
+ _body[:stop_price] = stop_price if stop_price != SENTINEL
1007
+ _body[:price_effect] = price_effect if price_effect != SENTINEL
1008
+ _body[:client_order_id] = client_order_id if client_order_id != SENTINEL
1009
+ _body[:expiry_date] = expiry_date if expiry_date != SENTINEL
1010
+ _body[:notional_value] = notional_value if notional_value != SENTINEL
1011
+ _body[:trading_session] = trading_session if trading_session != SENTINEL
1012
+ simple_trade_form = _body
1013
+ place_simple_order_with_http_info_impl(account_id, user_id, user_secret, simple_trade_form, extra)
1014
+ end
1015
+
1016
+ # Place a simple order (beta)
1017
+ # **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase. Equity and equity-option orders use the existing brokerage trading capabilities. Futures and future options are currently supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages). An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or the exact tastytrade BrokerageInstrument ticker for futures and future options, including any spaces. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
1018
+ # @param account_id [String] The ID of the account to execute the trade on.
1019
+ # @param user_id [String]
1020
+ # @param user_secret [String]
1021
+ # @param simple_trade_form [SimpleTradeForm]
1022
+ # @param [Hash] opts the optional parameters
1023
+ # @return [SimpleTradeResponse]
1024
+ private def place_simple_order_impl(account_id, user_id, user_secret, simple_trade_form, opts = {})
1025
+ data, _status_code, _headers = place_simple_order_with_http_info(account_id, user_id, user_secret, simple_trade_form, opts)
1026
+ data
1027
+ end
1028
+
1029
+ # Place a simple order (beta)
1030
+ # **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase. Equity and equity-option orders use the existing brokerage trading capabilities. Futures and future options are currently supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages). An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or the exact tastytrade BrokerageInstrument ticker for futures and future options, including any spaces. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
1031
+ # @param account_id [String] The ID of the account to execute the trade on.
1032
+ # @param user_id [String]
1033
+ # @param user_secret [String]
1034
+ # @param simple_trade_form [SimpleTradeForm]
1035
+ # @param [Hash] opts the optional parameters
1036
+ # @return [Array<(SimpleTradeResponse, Integer, Hash)>] SimpleTradeResponse data, response status code and response headers
1037
+ private def place_simple_order_with_http_info_impl(account_id, user_id, user_secret, simple_trade_form, opts = {})
1038
+ if @api_client.config.debugging
1039
+ @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.place_simple_order ...'
1040
+ end
1041
+ # verify the required parameter 'account_id' is set
1042
+ if @api_client.config.client_side_validation && account_id.nil?
1043
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.place_simple_order"
1044
+ end
1045
+ # verify the required parameter 'user_id' is set
1046
+ if @api_client.config.client_side_validation && user_id.nil?
1047
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.place_simple_order"
1048
+ end
1049
+ # verify the required parameter 'user_secret' is set
1050
+ if @api_client.config.client_side_validation && user_secret.nil?
1051
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.place_simple_order"
1052
+ end
1053
+ # verify the required parameter 'simple_trade_form' is set
1054
+ if @api_client.config.client_side_validation && simple_trade_form.nil?
1055
+ fail ArgumentError, "Missing the required parameter 'simple_trade_form' when calling ExperimentalEndpointsApi.place_simple_order"
1056
+ end
1057
+ # resource path
1058
+ local_var_path = '/accounts/{accountId}/trading/simple'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
1059
+
1060
+ # query parameters
1061
+ query_params = opts[:query_params] || {}
1062
+ query_params[:'userId'] = user_id
1063
+ query_params[:'userSecret'] = user_secret
1064
+
1065
+ # header parameters
1066
+ header_params = opts[:header_params] || {}
1067
+ # HTTP header 'Accept' (if needed)
1068
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1069
+ # HTTP header 'Content-Type'
1070
+ content_type = @api_client.select_header_content_type(['application/json'])
1071
+ if !content_type.nil?
1072
+ header_params['Content-Type'] = content_type
1073
+ end
1074
+
1075
+ # form parameters
1076
+ form_params = opts[:form_params] || {}
1077
+
1078
+ # http body (model)
1079
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(simple_trade_form)
1080
+
1081
+ # return_type
1082
+ return_type = opts[:debug_return_type] || 'SimpleTradeResponse'
1083
+
1084
+ # auth_names
1085
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
1086
+
1087
+ new_options = opts.merge(
1088
+ :operation => :"ExperimentalEndpointsApi.place_simple_order",
1089
+ :header_params => header_params,
1090
+ :query_params => query_params,
1091
+ :form_params => form_params,
1092
+ :body => post_body,
1093
+ :auth_names => auth_names,
1094
+ :return_type => return_type
1095
+ )
1096
+
1097
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
1098
+ if @api_client.config.debugging
1099
+ @api_client.config.logger.debug "API called: ExperimentalEndpointsApi#place_simple_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1100
+ end
1101
+ return data, status_code, headers, response
1102
+ end
697
1103
  end
698
1104
 
699
1105
  # top-level client access to avoid having the user to insantiate their own API instances
@@ -30,7 +30,7 @@ module SnapTrade
30
30
  # Present for mutual fund positions and for other instrument kinds when true. A true value means the position is also counted in cash balance or buying power.
31
31
  attr_accessor :cash_equivalent
32
32
 
33
- # List of tax lots for the given position (disabled by default, only available on paid plans, contact support if needed)
33
+ # List of tax lots for the given position. Disabled by default; enable via the Customer Dashboard Add-ons page. When enabled, this field is included only for stocks, ADRs, ETFs, mutual funds, and crypto positions. For these positions, an empty list means no tax lot data is available. Availability varies by brokerage and position. This field is omitted for all other instrument kinds or when the feature is disabled.
34
34
  attr_accessor :tax_lots
35
35
 
36
36
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -13,7 +13,7 @@ require 'time'
13
13
  module SnapTrade
14
14
  # The response to the account value history endpoint, containing a list of estimated account values at different points in time.
15
15
  class AccountValueHistoryResponse
16
- # List of estimated account values over time returned by the endpoint.
16
+ # List of estimated account values over time returned by the endpoint. The data may contain gaps and is best used for charting trends, rather than as a complete or exact record of historical account values.
17
17
  attr_accessor :history
18
18
 
19
19
  # The ISO-4217 currency code for the account values.