snaptrade 3.0.64 → 3.0.66
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/README.md +190 -146
- data/lib/snaptrade/api/account_information_api.rb +16 -16
- data/lib/snaptrade/api/experimental_endpoints_api.rb +0 -184
- data/lib/snaptrade/api/trading_api.rb +202 -6
- data/lib/snaptrade/models/account_universal_activity.rb +1 -1
- data/lib/snaptrade/models/activity.rb +4 -4
- data/lib/snaptrade/models/mleg_trade_form.rb +11 -1
- data/lib/snaptrade/models/simple_trade_form.rb +1 -1
- data/lib/snaptrade/models/trading_place_mleg_order409_response.rb +234 -0
- data/lib/snaptrade/models/universal_activity.rb +1 -1
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +1 -0
- data/spec/api/account_information_api_spec.rb +4 -4
- data/spec/api/experimental_endpoints_api_spec.rb +0 -15
- data/spec/api/trading_api_spec.rb +16 -1
- data/spec/models/mleg_trade_form_spec.rb +6 -0
- data/spec/models/trading_place_mleg_order409_response_spec.rb +41 -0
- metadata +289 -286
|
@@ -692,190 +692,6 @@ module SnapTrade
|
|
|
692
692
|
end
|
|
693
693
|
return data, status_code, headers, response
|
|
694
694
|
end
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
# Place a simple order (beta)
|
|
698
|
-
#
|
|
699
|
-
# **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.
|
|
700
|
-
#
|
|
701
|
-
# Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade, Webull US, and TradeStation (live and SIM); future options are supported on tastytrade and TradeStation (live and SIM). 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).
|
|
702
|
-
#
|
|
703
|
-
# 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.
|
|
704
|
-
#
|
|
705
|
-
# Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments.
|
|
706
|
-
#
|
|
707
|
-
# TradeStation and TradeStation SIM support single-leg futures and futures-option orders in Futures accounts, with positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day, gtc, ioc, or fok duration, subject to the contract and route's supported combinations. Futures use buy/sell; futures options use the open/close option actions. Multi-leg futures-family strategies are not supported. Prices are forwarded without rounding; TradeStation determines contract availability, permissions, margin requirements, and valid price increments.
|
|
708
|
-
#
|
|
709
|
-
# All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. For TradeStation, use a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as `ESZ26 C6000`, preserving the space and any session alias. The optional @ prefix is supported for dated futures contracts and is forwarded unchanged. Slash-prefixed aliases and root-only continuous symbols such as @ES are not accepted. A futures symbol does not need to be present in SnapTrade's local instrument catalog to submit an order.
|
|
710
|
-
#
|
|
711
|
-
# A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
712
|
-
#
|
|
713
|
-
# @param order_type [SimpleTradeFormOrderType]
|
|
714
|
-
# @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. Webull US futures only support day and gtc. TradeStation futures and futures options accept day, gtc, ioc, and fok, subject to the contract and route's supported combinations.
|
|
715
|
-
# @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.
|
|
716
|
-
# @param account_id [String] The ID of the account to execute the trade on.
|
|
717
|
-
# @param user_id [String]
|
|
718
|
-
# @param user_secret [String]
|
|
719
|
-
# @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.
|
|
720
|
-
# @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.
|
|
721
|
-
# @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.
|
|
722
|
-
# @param client_order_id [String] Optional canonical UUID, forwarded where the existing execution path supports it and for tastytrade, Webull US, and TradeStation futures-family orders. Requires the existing client-order-ID enablement; when disabled the value is ignored. Brokerage behavior on duplicates varies. SnapTrade does not enforce uniqueness, except for requests authenticated with an OAuth access token, where a client_order_id the user has already used returns 409. Tastytrade uses this as external-identifier for correlation and does not deduplicate submissions. For Webull US futures, SnapTrade converts the supplied UUID (or its generated order UUID) to lowercase 32-character hexadecimal without hyphens. The original supplied UUID remains in SnapTrade's trade audit; the converted value is returned as brokerage_order_id for subsequent order reads. For TradeStation live and SIM, SnapTrade encodes the supplied UUID (or its generated order UUID) as 22-character URL-safe base64 without padding and sends it as OrderConfirmID for brokerage duplicate prevention; the response contains TradeStation's separate order ID.
|
|
723
|
-
# @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.
|
|
724
|
-
# @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.
|
|
725
|
-
# @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.
|
|
726
|
-
# @param body [SimpleTradeForm]
|
|
727
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
728
|
-
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: {})
|
|
729
|
-
_body = {}
|
|
730
|
-
_body[:order_type] = order_type if order_type != SENTINEL
|
|
731
|
-
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
|
732
|
-
_body[:legs] = legs if legs != SENTINEL
|
|
733
|
-
_body[:limit_price] = limit_price if limit_price != SENTINEL
|
|
734
|
-
_body[:stop_price] = stop_price if stop_price != SENTINEL
|
|
735
|
-
_body[:price_effect] = price_effect if price_effect != SENTINEL
|
|
736
|
-
_body[:client_order_id] = client_order_id if client_order_id != SENTINEL
|
|
737
|
-
_body[:expiry_date] = expiry_date if expiry_date != SENTINEL
|
|
738
|
-
_body[:notional_value] = notional_value if notional_value != SENTINEL
|
|
739
|
-
_body[:trading_session] = trading_session if trading_session != SENTINEL
|
|
740
|
-
simple_trade_form = _body
|
|
741
|
-
data, _status_code, _headers = place_simple_order_with_http_info_impl(account_id, user_id, user_secret, simple_trade_form, extra)
|
|
742
|
-
data
|
|
743
|
-
end
|
|
744
|
-
|
|
745
|
-
# Place a simple order (beta)
|
|
746
|
-
#
|
|
747
|
-
# **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.
|
|
748
|
-
#
|
|
749
|
-
# Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade, Webull US, and TradeStation (live and SIM); future options are supported on tastytrade and TradeStation (live and SIM). 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).
|
|
750
|
-
#
|
|
751
|
-
# 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.
|
|
752
|
-
#
|
|
753
|
-
# Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments.
|
|
754
|
-
#
|
|
755
|
-
# TradeStation and TradeStation SIM support single-leg futures and futures-option orders in Futures accounts, with positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day, gtc, ioc, or fok duration, subject to the contract and route's supported combinations. Futures use buy/sell; futures options use the open/close option actions. Multi-leg futures-family strategies are not supported. Prices are forwarded without rounding; TradeStation determines contract availability, permissions, margin requirements, and valid price increments.
|
|
756
|
-
#
|
|
757
|
-
# All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. For TradeStation, use a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as `ESZ26 C6000`, preserving the space and any session alias. The optional @ prefix is supported for dated futures contracts and is forwarded unchanged. Slash-prefixed aliases and root-only continuous symbols such as @ES are not accepted. A futures symbol does not need to be present in SnapTrade's local instrument catalog to submit an order.
|
|
758
|
-
#
|
|
759
|
-
# A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
760
|
-
#
|
|
761
|
-
# @param order_type [SimpleTradeFormOrderType]
|
|
762
|
-
# @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. Webull US futures only support day and gtc. TradeStation futures and futures options accept day, gtc, ioc, and fok, subject to the contract and route's supported combinations.
|
|
763
|
-
# @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.
|
|
764
|
-
# @param account_id [String] The ID of the account to execute the trade on.
|
|
765
|
-
# @param user_id [String]
|
|
766
|
-
# @param user_secret [String]
|
|
767
|
-
# @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.
|
|
768
|
-
# @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.
|
|
769
|
-
# @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.
|
|
770
|
-
# @param client_order_id [String] Optional canonical UUID, forwarded where the existing execution path supports it and for tastytrade, Webull US, and TradeStation futures-family orders. Requires the existing client-order-ID enablement; when disabled the value is ignored. Brokerage behavior on duplicates varies. SnapTrade does not enforce uniqueness, except for requests authenticated with an OAuth access token, where a client_order_id the user has already used returns 409. Tastytrade uses this as external-identifier for correlation and does not deduplicate submissions. For Webull US futures, SnapTrade converts the supplied UUID (or its generated order UUID) to lowercase 32-character hexadecimal without hyphens. The original supplied UUID remains in SnapTrade's trade audit; the converted value is returned as brokerage_order_id for subsequent order reads. For TradeStation live and SIM, SnapTrade encodes the supplied UUID (or its generated order UUID) as 22-character URL-safe base64 without padding and sends it as OrderConfirmID for brokerage duplicate prevention; the response contains TradeStation's separate order ID.
|
|
771
|
-
# @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.
|
|
772
|
-
# @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.
|
|
773
|
-
# @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.
|
|
774
|
-
# @param body [SimpleTradeForm]
|
|
775
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
776
|
-
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: {})
|
|
777
|
-
_body = {}
|
|
778
|
-
_body[:order_type] = order_type if order_type != SENTINEL
|
|
779
|
-
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
|
780
|
-
_body[:legs] = legs if legs != SENTINEL
|
|
781
|
-
_body[:limit_price] = limit_price if limit_price != SENTINEL
|
|
782
|
-
_body[:stop_price] = stop_price if stop_price != SENTINEL
|
|
783
|
-
_body[:price_effect] = price_effect if price_effect != SENTINEL
|
|
784
|
-
_body[:client_order_id] = client_order_id if client_order_id != SENTINEL
|
|
785
|
-
_body[:expiry_date] = expiry_date if expiry_date != SENTINEL
|
|
786
|
-
_body[:notional_value] = notional_value if notional_value != SENTINEL
|
|
787
|
-
_body[:trading_session] = trading_session if trading_session != SENTINEL
|
|
788
|
-
simple_trade_form = _body
|
|
789
|
-
place_simple_order_with_http_info_impl(account_id, user_id, user_secret, simple_trade_form, extra)
|
|
790
|
-
end
|
|
791
|
-
|
|
792
|
-
# Place a simple order (beta)
|
|
793
|
-
# **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 are supported on tastytrade, Webull US, and TradeStation (live and SIM); future options are supported on tastytrade and TradeStation (live and SIM). 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. Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments. TradeStation and TradeStation SIM support single-leg futures and futures-option orders in Futures accounts, with positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day, gtc, ioc, or fok duration, subject to the contract and route's supported combinations. Futures use buy/sell; futures options use the open/close option actions. Multi-leg futures-family strategies are not supported. Prices are forwarded without rounding; TradeStation determines contract availability, permissions, margin requirements, and valid price increments. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. For TradeStation, use a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as `ESZ26 C6000`, preserving the space and any session alias. The optional @ prefix is supported for dated futures contracts and is forwarded unchanged. Slash-prefixed aliases and root-only continuous symbols such as @ES are not accepted. A futures symbol does not need to be present in SnapTrade's local instrument catalog to submit an order. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
794
|
-
# @param account_id [String] The ID of the account to execute the trade on.
|
|
795
|
-
# @param user_id [String]
|
|
796
|
-
# @param user_secret [String]
|
|
797
|
-
# @param simple_trade_form [SimpleTradeForm]
|
|
798
|
-
# @param [Hash] opts the optional parameters
|
|
799
|
-
# @return [SimpleTradeResponse]
|
|
800
|
-
private def place_simple_order_impl(account_id, user_id, user_secret, simple_trade_form, opts = {})
|
|
801
|
-
data, _status_code, _headers = place_simple_order_with_http_info(account_id, user_id, user_secret, simple_trade_form, opts)
|
|
802
|
-
data
|
|
803
|
-
end
|
|
804
|
-
|
|
805
|
-
# Place a simple order (beta)
|
|
806
|
-
# **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 are supported on tastytrade, Webull US, and TradeStation (live and SIM); future options are supported on tastytrade and TradeStation (live and SIM). 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. Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments. TradeStation and TradeStation SIM support single-leg futures and futures-option orders in Futures accounts, with positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day, gtc, ioc, or fok duration, subject to the contract and route's supported combinations. Futures use buy/sell; futures options use the open/close option actions. Multi-leg futures-family strategies are not supported. Prices are forwarded without rounding; TradeStation determines contract availability, permissions, margin requirements, and valid price increments. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. For TradeStation, use a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as `ESZ26 C6000`, preserving the space and any session alias. The optional @ prefix is supported for dated futures contracts and is forwarded unchanged. Slash-prefixed aliases and root-only continuous symbols such as @ES are not accepted. A futures symbol does not need to be present in SnapTrade's local instrument catalog to submit an order. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
807
|
-
# @param account_id [String] The ID of the account to execute the trade on.
|
|
808
|
-
# @param user_id [String]
|
|
809
|
-
# @param user_secret [String]
|
|
810
|
-
# @param simple_trade_form [SimpleTradeForm]
|
|
811
|
-
# @param [Hash] opts the optional parameters
|
|
812
|
-
# @return [Array<(SimpleTradeResponse, Integer, Hash)>] SimpleTradeResponse data, response status code and response headers
|
|
813
|
-
private def place_simple_order_with_http_info_impl(account_id, user_id, user_secret, simple_trade_form, opts = {})
|
|
814
|
-
if @api_client.config.debugging
|
|
815
|
-
@api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.place_simple_order ...'
|
|
816
|
-
end
|
|
817
|
-
# verify the required parameter 'account_id' is set
|
|
818
|
-
if @api_client.config.client_side_validation && account_id.nil?
|
|
819
|
-
fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.place_simple_order"
|
|
820
|
-
end
|
|
821
|
-
# verify the required parameter 'user_id' is set
|
|
822
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
|
823
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.place_simple_order"
|
|
824
|
-
end
|
|
825
|
-
# verify the required parameter 'user_secret' is set
|
|
826
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
|
827
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.place_simple_order"
|
|
828
|
-
end
|
|
829
|
-
# verify the required parameter 'simple_trade_form' is set
|
|
830
|
-
if @api_client.config.client_side_validation && simple_trade_form.nil?
|
|
831
|
-
fail ArgumentError, "Missing the required parameter 'simple_trade_form' when calling ExperimentalEndpointsApi.place_simple_order"
|
|
832
|
-
end
|
|
833
|
-
# resource path
|
|
834
|
-
local_var_path = '/accounts/{accountId}/trading/simple'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
|
835
|
-
|
|
836
|
-
# query parameters
|
|
837
|
-
query_params = opts[:query_params] || {}
|
|
838
|
-
query_params[:'userId'] = user_id
|
|
839
|
-
query_params[:'userSecret'] = user_secret
|
|
840
|
-
|
|
841
|
-
# header parameters
|
|
842
|
-
header_params = opts[:header_params] || {}
|
|
843
|
-
# HTTP header 'Accept' (if needed)
|
|
844
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
845
|
-
# HTTP header 'Content-Type'
|
|
846
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
|
847
|
-
if !content_type.nil?
|
|
848
|
-
header_params['Content-Type'] = content_type
|
|
849
|
-
end
|
|
850
|
-
|
|
851
|
-
# form parameters
|
|
852
|
-
form_params = opts[:form_params] || {}
|
|
853
|
-
|
|
854
|
-
# http body (model)
|
|
855
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(simple_trade_form)
|
|
856
|
-
|
|
857
|
-
# return_type
|
|
858
|
-
return_type = opts[:debug_return_type] || 'SimpleTradeResponse'
|
|
859
|
-
|
|
860
|
-
# auth_names
|
|
861
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
862
|
-
|
|
863
|
-
new_options = opts.merge(
|
|
864
|
-
:operation => :"ExperimentalEndpointsApi.place_simple_order",
|
|
865
|
-
:header_params => header_params,
|
|
866
|
-
:query_params => query_params,
|
|
867
|
-
:form_params => form_params,
|
|
868
|
-
:body => post_body,
|
|
869
|
-
:auth_names => auth_names,
|
|
870
|
-
:return_type => return_type
|
|
871
|
-
)
|
|
872
|
-
|
|
873
|
-
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
|
874
|
-
if @api_client.config.debugging
|
|
875
|
-
@api_client.config.logger.debug "API called: ExperimentalEndpointsApi#place_simple_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
876
|
-
end
|
|
877
|
-
return data, status_code, headers, response
|
|
878
|
-
end
|
|
879
695
|
end
|
|
880
696
|
|
|
881
697
|
# top-level client access to avoid having the user to insantiate their own API instances
|
|
@@ -263,13 +263,15 @@ module SnapTrade
|
|
|
263
263
|
# @param user_id [String]
|
|
264
264
|
# @param user_secret [String]
|
|
265
265
|
# @param account_id [String]
|
|
266
|
+
# @param client_order_id [String] Canonical 36-character UUID required when placing a Wealthsimple order with two or more legs. Not required for an impact preview or single-leg request. Reuse it when retrying the same attempt. SnapTrade retains the ID after success or failure; reuse by the same user across accounts or placement endpoints returns 409 without submitting again. A 409 does not establish whether the original attempt was accepted; reconcile it before using a new ID for a genuinely new order. This protection does not depend on Wealthsimple deduplicating its external order ID.
|
|
266
267
|
# @param limit_price [Float] The limit price. Required if the order type is `LIMIT`, `STOP_LOSS_LIMIT`, unless `price_effect` is `EVEN` - a net-even order is implicitly priced at 0, so the field may be omitted and must be `0` if sent.
|
|
267
268
|
# @param stop_price [Float] The stop price. Required if the order type is `STOP_LOSS_MARKET`, `STOP_LOSS_LIMIT`.
|
|
268
269
|
# @param price_effect [MlegPriceEffectStrict]
|
|
269
270
|
# @param body [MlegTradeForm]
|
|
270
271
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
271
|
-
def get_option_impact(order_type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, price_effect: SENTINEL, extra: {})
|
|
272
|
+
def get_option_impact(order_type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, client_order_id: SENTINEL, limit_price: SENTINEL, stop_price: SENTINEL, price_effect: SENTINEL, extra: {})
|
|
272
273
|
_body = {}
|
|
274
|
+
_body[:client_order_id] = client_order_id if client_order_id != SENTINEL
|
|
273
275
|
_body[:order_type] = order_type if order_type != SENTINEL
|
|
274
276
|
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
|
275
277
|
_body[:limit_price] = limit_price if limit_price != SENTINEL
|
|
@@ -292,13 +294,15 @@ module SnapTrade
|
|
|
292
294
|
# @param user_id [String]
|
|
293
295
|
# @param user_secret [String]
|
|
294
296
|
# @param account_id [String]
|
|
297
|
+
# @param client_order_id [String] Canonical 36-character UUID required when placing a Wealthsimple order with two or more legs. Not required for an impact preview or single-leg request. Reuse it when retrying the same attempt. SnapTrade retains the ID after success or failure; reuse by the same user across accounts or placement endpoints returns 409 without submitting again. A 409 does not establish whether the original attempt was accepted; reconcile it before using a new ID for a genuinely new order. This protection does not depend on Wealthsimple deduplicating its external order ID.
|
|
295
298
|
# @param limit_price [Float] The limit price. Required if the order type is `LIMIT`, `STOP_LOSS_LIMIT`, unless `price_effect` is `EVEN` - a net-even order is implicitly priced at 0, so the field may be omitted and must be `0` if sent.
|
|
296
299
|
# @param stop_price [Float] The stop price. Required if the order type is `STOP_LOSS_MARKET`, `STOP_LOSS_LIMIT`.
|
|
297
300
|
# @param price_effect [MlegPriceEffectStrict]
|
|
298
301
|
# @param body [MlegTradeForm]
|
|
299
302
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
300
|
-
def get_option_impact_with_http_info(order_type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, price_effect: SENTINEL, extra: {})
|
|
303
|
+
def get_option_impact_with_http_info(order_type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, client_order_id: SENTINEL, limit_price: SENTINEL, stop_price: SENTINEL, price_effect: SENTINEL, extra: {})
|
|
301
304
|
_body = {}
|
|
305
|
+
_body[:client_order_id] = client_order_id if client_order_id != SENTINEL
|
|
302
306
|
_body[:order_type] = order_type if order_type != SENTINEL
|
|
303
307
|
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
|
304
308
|
_body[:limit_price] = limit_price if limit_price != SENTINEL
|
|
@@ -1304,6 +1308,8 @@ module SnapTrade
|
|
|
1304
1308
|
# Place option order
|
|
1305
1309
|
#
|
|
1306
1310
|
# Places a multi-leg option order. Only supported on certain option trading brokerages. https://support.snaptrade.com/brokerages has information on brokerage trading support
|
|
1311
|
+
#
|
|
1312
|
+
# Wealthsimple placement with two or more legs requires a canonical UUID `client_order_id`. Reuse it for retries of the same attempt. SnapTrade returns 409 for an ID already used by that user, including across accounts and after a lost placement response. Reconcile the original attempt before submitting a genuinely new order with a new ID.
|
|
1307
1313
|
#
|
|
1308
1314
|
# @param order_type [MlegOrderTypeStrict] The type of order to place.
|
|
1309
1315
|
# @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.
|
|
@@ -1311,13 +1317,15 @@ module SnapTrade
|
|
|
1311
1317
|
# @param user_id [String]
|
|
1312
1318
|
# @param user_secret [String]
|
|
1313
1319
|
# @param account_id [String]
|
|
1320
|
+
# @param client_order_id [String] Canonical 36-character UUID required when placing a Wealthsimple order with two or more legs. Not required for an impact preview or single-leg request. Reuse it when retrying the same attempt. SnapTrade retains the ID after success or failure; reuse by the same user across accounts or placement endpoints returns 409 without submitting again. A 409 does not establish whether the original attempt was accepted; reconcile it before using a new ID for a genuinely new order. This protection does not depend on Wealthsimple deduplicating its external order ID.
|
|
1314
1321
|
# @param limit_price [Float] The limit price. Required if the order type is `LIMIT`, `STOP_LOSS_LIMIT`, unless `price_effect` is `EVEN` - a net-even order is implicitly priced at 0, so the field may be omitted and must be `0` if sent.
|
|
1315
1322
|
# @param stop_price [Float] The stop price. Required if the order type is `STOP_LOSS_MARKET`, `STOP_LOSS_LIMIT`.
|
|
1316
1323
|
# @param price_effect [MlegPriceEffectStrict]
|
|
1317
1324
|
# @param body [MlegTradeForm]
|
|
1318
1325
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
1319
|
-
def place_mleg_order(order_type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, price_effect: SENTINEL, extra: {})
|
|
1326
|
+
def place_mleg_order(order_type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, client_order_id: SENTINEL, limit_price: SENTINEL, stop_price: SENTINEL, price_effect: SENTINEL, extra: {})
|
|
1320
1327
|
_body = {}
|
|
1328
|
+
_body[:client_order_id] = client_order_id if client_order_id != SENTINEL
|
|
1321
1329
|
_body[:order_type] = order_type if order_type != SENTINEL
|
|
1322
1330
|
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
|
1323
1331
|
_body[:limit_price] = limit_price if limit_price != SENTINEL
|
|
@@ -1332,6 +1340,8 @@ module SnapTrade
|
|
|
1332
1340
|
# Place option order
|
|
1333
1341
|
#
|
|
1334
1342
|
# Places a multi-leg option order. Only supported on certain option trading brokerages. https://support.snaptrade.com/brokerages has information on brokerage trading support
|
|
1343
|
+
#
|
|
1344
|
+
# Wealthsimple placement with two or more legs requires a canonical UUID `client_order_id`. Reuse it for retries of the same attempt. SnapTrade returns 409 for an ID already used by that user, including across accounts and after a lost placement response. Reconcile the original attempt before submitting a genuinely new order with a new ID.
|
|
1335
1345
|
#
|
|
1336
1346
|
# @param order_type [MlegOrderTypeStrict] The type of order to place.
|
|
1337
1347
|
# @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.
|
|
@@ -1339,13 +1349,15 @@ module SnapTrade
|
|
|
1339
1349
|
# @param user_id [String]
|
|
1340
1350
|
# @param user_secret [String]
|
|
1341
1351
|
# @param account_id [String]
|
|
1352
|
+
# @param client_order_id [String] Canonical 36-character UUID required when placing a Wealthsimple order with two or more legs. Not required for an impact preview or single-leg request. Reuse it when retrying the same attempt. SnapTrade retains the ID after success or failure; reuse by the same user across accounts or placement endpoints returns 409 without submitting again. A 409 does not establish whether the original attempt was accepted; reconcile it before using a new ID for a genuinely new order. This protection does not depend on Wealthsimple deduplicating its external order ID.
|
|
1342
1353
|
# @param limit_price [Float] The limit price. Required if the order type is `LIMIT`, `STOP_LOSS_LIMIT`, unless `price_effect` is `EVEN` - a net-even order is implicitly priced at 0, so the field may be omitted and must be `0` if sent.
|
|
1343
1354
|
# @param stop_price [Float] The stop price. Required if the order type is `STOP_LOSS_MARKET`, `STOP_LOSS_LIMIT`.
|
|
1344
1355
|
# @param price_effect [MlegPriceEffectStrict]
|
|
1345
1356
|
# @param body [MlegTradeForm]
|
|
1346
1357
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
1347
|
-
def place_mleg_order_with_http_info(order_type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, price_effect: SENTINEL, extra: {})
|
|
1358
|
+
def place_mleg_order_with_http_info(order_type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, client_order_id: SENTINEL, limit_price: SENTINEL, stop_price: SENTINEL, price_effect: SENTINEL, extra: {})
|
|
1348
1359
|
_body = {}
|
|
1360
|
+
_body[:client_order_id] = client_order_id if client_order_id != SENTINEL
|
|
1349
1361
|
_body[:order_type] = order_type if order_type != SENTINEL
|
|
1350
1362
|
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
|
1351
1363
|
_body[:limit_price] = limit_price if limit_price != SENTINEL
|
|
@@ -1357,7 +1369,7 @@ module SnapTrade
|
|
|
1357
1369
|
end
|
|
1358
1370
|
|
|
1359
1371
|
# Place option order
|
|
1360
|
-
# Places a multi-leg option order. Only supported on certain option trading brokerages. https://support.snaptrade.com/brokerages has information on brokerage trading support
|
|
1372
|
+
# Places a multi-leg option order. Only supported on certain option trading brokerages. https://support.snaptrade.com/brokerages has information on brokerage trading support Wealthsimple placement with two or more legs requires a canonical UUID `client_order_id`. Reuse it for retries of the same attempt. SnapTrade returns 409 for an ID already used by that user, including across accounts and after a lost placement response. Reconcile the original attempt before submitting a genuinely new order with a new ID.
|
|
1361
1373
|
# @param user_id [String]
|
|
1362
1374
|
# @param user_secret [String]
|
|
1363
1375
|
# @param account_id [String]
|
|
@@ -1370,7 +1382,7 @@ module SnapTrade
|
|
|
1370
1382
|
end
|
|
1371
1383
|
|
|
1372
1384
|
# Place option order
|
|
1373
|
-
# Places a multi-leg option order. Only supported on certain option trading brokerages. https://support.snaptrade.com/brokerages has information on brokerage trading support
|
|
1385
|
+
# Places a multi-leg option order. Only supported on certain option trading brokerages. https://support.snaptrade.com/brokerages has information on brokerage trading support Wealthsimple placement with two or more legs requires a canonical UUID `client_order_id`. Reuse it for retries of the same attempt. SnapTrade returns 409 for an ID already used by that user, including across accounts and after a lost placement response. Reconcile the original attempt before submitting a genuinely new order with a new ID.
|
|
1374
1386
|
# @param user_id [String]
|
|
1375
1387
|
# @param user_secret [String]
|
|
1376
1388
|
# @param account_id [String]
|
|
@@ -1569,6 +1581,190 @@ module SnapTrade
|
|
|
1569
1581
|
end
|
|
1570
1582
|
|
|
1571
1583
|
|
|
1584
|
+
# Place a simple order (beta)
|
|
1585
|
+
#
|
|
1586
|
+
# **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. Breaking changes are possible while this endpoint is in beta.
|
|
1587
|
+
#
|
|
1588
|
+
# Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade, Webull US, and TradeStation (live and SIM); future options are supported on tastytrade and TradeStation (live and SIM). 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).
|
|
1589
|
+
#
|
|
1590
|
+
# 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.
|
|
1591
|
+
#
|
|
1592
|
+
# Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments.
|
|
1593
|
+
#
|
|
1594
|
+
# TradeStation and TradeStation SIM support single-leg futures and futures-option orders in Futures accounts, with positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day, gtc, ioc, or fok duration, subject to the contract and route's supported combinations. Futures use buy/sell; futures options use the open/close option actions. Multi-leg futures-family strategies are not supported. Prices are forwarded without rounding; TradeStation determines contract availability, permissions, margin requirements, and valid price increments.
|
|
1595
|
+
#
|
|
1596
|
+
# All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. For TradeStation, use a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as `ESZ26 C6000`, preserving the space and any session alias. The optional @ prefix is supported for dated futures contracts and is forwarded unchanged. Slash-prefixed aliases and root-only continuous symbols such as @ES are not accepted. A futures symbol does not need to be present in SnapTrade's local instrument catalog to submit an order.
|
|
1597
|
+
#
|
|
1598
|
+
# A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
1599
|
+
#
|
|
1600
|
+
# @param order_type [SimpleTradeFormOrderType]
|
|
1601
|
+
# @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. Webull US futures only support day and gtc. TradeStation futures and futures options accept day, gtc, ioc, and fok, subject to the contract and route's supported combinations.
|
|
1602
|
+
# @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.
|
|
1603
|
+
# @param account_id [String] The ID of the account to execute the trade on.
|
|
1604
|
+
# @param user_id [String]
|
|
1605
|
+
# @param user_secret [String]
|
|
1606
|
+
# @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.
|
|
1607
|
+
# @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.
|
|
1608
|
+
# @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.
|
|
1609
|
+
# @param client_order_id [String] Canonical UUID. Required for Wealthsimple multi-leg placement regardless of client-order-ID enablement; reuse it when retrying the same attempt. Wealthsimple multi-leg attempts retain the ID after success or failure, and reuse by the same user across accounts or placement endpoints returns 409 without another submission. A 409 does not establish whether the original attempt was accepted; reconcile it before creating a new order with a new ID. Optional for other orders, forwarded where the existing execution path supports it and for tastytrade, Webull US, and TradeStation futures-family orders. Other orders require the existing client-order-ID enablement; when disabled the value is ignored. Brokerage behavior on duplicates varies. OAuth requests also reject a client_order_id the user has already used with 409. Tastytrade uses this as external-identifier for correlation and does not deduplicate submissions. For Webull US futures, SnapTrade converts the supplied UUID (or its generated order UUID) to lowercase 32-character hexadecimal without hyphens. The original supplied UUID remains in SnapTrade's trade audit; the converted value is returned as brokerage_order_id for subsequent order reads. For TradeStation live and SIM, SnapTrade encodes the supplied UUID (or its generated order UUID) as 22-character URL-safe base64 without padding and sends it as OrderConfirmID for brokerage duplicate prevention; the response contains TradeStation's separate order ID.
|
|
1610
|
+
# @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.
|
|
1611
|
+
# @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.
|
|
1612
|
+
# @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.
|
|
1613
|
+
# @param body [SimpleTradeForm]
|
|
1614
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
1615
|
+
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: {})
|
|
1616
|
+
_body = {}
|
|
1617
|
+
_body[:order_type] = order_type if order_type != SENTINEL
|
|
1618
|
+
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
|
1619
|
+
_body[:legs] = legs if legs != SENTINEL
|
|
1620
|
+
_body[:limit_price] = limit_price if limit_price != SENTINEL
|
|
1621
|
+
_body[:stop_price] = stop_price if stop_price != SENTINEL
|
|
1622
|
+
_body[:price_effect] = price_effect if price_effect != SENTINEL
|
|
1623
|
+
_body[:client_order_id] = client_order_id if client_order_id != SENTINEL
|
|
1624
|
+
_body[:expiry_date] = expiry_date if expiry_date != SENTINEL
|
|
1625
|
+
_body[:notional_value] = notional_value if notional_value != SENTINEL
|
|
1626
|
+
_body[:trading_session] = trading_session if trading_session != SENTINEL
|
|
1627
|
+
simple_trade_form = _body
|
|
1628
|
+
data, _status_code, _headers = place_simple_order_with_http_info_impl(account_id, user_id, user_secret, simple_trade_form, extra)
|
|
1629
|
+
data
|
|
1630
|
+
end
|
|
1631
|
+
|
|
1632
|
+
# Place a simple order (beta)
|
|
1633
|
+
#
|
|
1634
|
+
# **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. Breaking changes are possible while this endpoint is in beta.
|
|
1635
|
+
#
|
|
1636
|
+
# Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade, Webull US, and TradeStation (live and SIM); future options are supported on tastytrade and TradeStation (live and SIM). 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).
|
|
1637
|
+
#
|
|
1638
|
+
# 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.
|
|
1639
|
+
#
|
|
1640
|
+
# Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments.
|
|
1641
|
+
#
|
|
1642
|
+
# TradeStation and TradeStation SIM support single-leg futures and futures-option orders in Futures accounts, with positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day, gtc, ioc, or fok duration, subject to the contract and route's supported combinations. Futures use buy/sell; futures options use the open/close option actions. Multi-leg futures-family strategies are not supported. Prices are forwarded without rounding; TradeStation determines contract availability, permissions, margin requirements, and valid price increments.
|
|
1643
|
+
#
|
|
1644
|
+
# All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. For TradeStation, use a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as `ESZ26 C6000`, preserving the space and any session alias. The optional @ prefix is supported for dated futures contracts and is forwarded unchanged. Slash-prefixed aliases and root-only continuous symbols such as @ES are not accepted. A futures symbol does not need to be present in SnapTrade's local instrument catalog to submit an order.
|
|
1645
|
+
#
|
|
1646
|
+
# A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
1647
|
+
#
|
|
1648
|
+
# @param order_type [SimpleTradeFormOrderType]
|
|
1649
|
+
# @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. Webull US futures only support day and gtc. TradeStation futures and futures options accept day, gtc, ioc, and fok, subject to the contract and route's supported combinations.
|
|
1650
|
+
# @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.
|
|
1651
|
+
# @param account_id [String] The ID of the account to execute the trade on.
|
|
1652
|
+
# @param user_id [String]
|
|
1653
|
+
# @param user_secret [String]
|
|
1654
|
+
# @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.
|
|
1655
|
+
# @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.
|
|
1656
|
+
# @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.
|
|
1657
|
+
# @param client_order_id [String] Canonical UUID. Required for Wealthsimple multi-leg placement regardless of client-order-ID enablement; reuse it when retrying the same attempt. Wealthsimple multi-leg attempts retain the ID after success or failure, and reuse by the same user across accounts or placement endpoints returns 409 without another submission. A 409 does not establish whether the original attempt was accepted; reconcile it before creating a new order with a new ID. Optional for other orders, forwarded where the existing execution path supports it and for tastytrade, Webull US, and TradeStation futures-family orders. Other orders require the existing client-order-ID enablement; when disabled the value is ignored. Brokerage behavior on duplicates varies. OAuth requests also reject a client_order_id the user has already used with 409. Tastytrade uses this as external-identifier for correlation and does not deduplicate submissions. For Webull US futures, SnapTrade converts the supplied UUID (or its generated order UUID) to lowercase 32-character hexadecimal without hyphens. The original supplied UUID remains in SnapTrade's trade audit; the converted value is returned as brokerage_order_id for subsequent order reads. For TradeStation live and SIM, SnapTrade encodes the supplied UUID (or its generated order UUID) as 22-character URL-safe base64 without padding and sends it as OrderConfirmID for brokerage duplicate prevention; the response contains TradeStation's separate order ID.
|
|
1658
|
+
# @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.
|
|
1659
|
+
# @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.
|
|
1660
|
+
# @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.
|
|
1661
|
+
# @param body [SimpleTradeForm]
|
|
1662
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
1663
|
+
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: {})
|
|
1664
|
+
_body = {}
|
|
1665
|
+
_body[:order_type] = order_type if order_type != SENTINEL
|
|
1666
|
+
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
|
1667
|
+
_body[:legs] = legs if legs != SENTINEL
|
|
1668
|
+
_body[:limit_price] = limit_price if limit_price != SENTINEL
|
|
1669
|
+
_body[:stop_price] = stop_price if stop_price != SENTINEL
|
|
1670
|
+
_body[:price_effect] = price_effect if price_effect != SENTINEL
|
|
1671
|
+
_body[:client_order_id] = client_order_id if client_order_id != SENTINEL
|
|
1672
|
+
_body[:expiry_date] = expiry_date if expiry_date != SENTINEL
|
|
1673
|
+
_body[:notional_value] = notional_value if notional_value != SENTINEL
|
|
1674
|
+
_body[:trading_session] = trading_session if trading_session != SENTINEL
|
|
1675
|
+
simple_trade_form = _body
|
|
1676
|
+
place_simple_order_with_http_info_impl(account_id, user_id, user_secret, simple_trade_form, extra)
|
|
1677
|
+
end
|
|
1678
|
+
|
|
1679
|
+
# Place a simple order (beta)
|
|
1680
|
+
# **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. Breaking changes are possible while this endpoint is in beta. Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade, Webull US, and TradeStation (live and SIM); future options are supported on tastytrade and TradeStation (live and SIM). 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. Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments. TradeStation and TradeStation SIM support single-leg futures and futures-option orders in Futures accounts, with positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day, gtc, ioc, or fok duration, subject to the contract and route's supported combinations. Futures use buy/sell; futures options use the open/close option actions. Multi-leg futures-family strategies are not supported. Prices are forwarded without rounding; TradeStation determines contract availability, permissions, margin requirements, and valid price increments. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. For TradeStation, use a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as `ESZ26 C6000`, preserving the space and any session alias. The optional @ prefix is supported for dated futures contracts and is forwarded unchanged. Slash-prefixed aliases and root-only continuous symbols such as @ES are not accepted. A futures symbol does not need to be present in SnapTrade's local instrument catalog to submit an order. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
1681
|
+
# @param account_id [String] The ID of the account to execute the trade on.
|
|
1682
|
+
# @param user_id [String]
|
|
1683
|
+
# @param user_secret [String]
|
|
1684
|
+
# @param simple_trade_form [SimpleTradeForm]
|
|
1685
|
+
# @param [Hash] opts the optional parameters
|
|
1686
|
+
# @return [SimpleTradeResponse]
|
|
1687
|
+
private def place_simple_order_impl(account_id, user_id, user_secret, simple_trade_form, opts = {})
|
|
1688
|
+
data, _status_code, _headers = place_simple_order_with_http_info(account_id, user_id, user_secret, simple_trade_form, opts)
|
|
1689
|
+
data
|
|
1690
|
+
end
|
|
1691
|
+
|
|
1692
|
+
# Place a simple order (beta)
|
|
1693
|
+
# **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. Breaking changes are possible while this endpoint is in beta. Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade, Webull US, and TradeStation (live and SIM); future options are supported on tastytrade and TradeStation (live and SIM). 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. Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments. TradeStation and TradeStation SIM support single-leg futures and futures-option orders in Futures accounts, with positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day, gtc, ioc, or fok duration, subject to the contract and route's supported combinations. Futures use buy/sell; futures options use the open/close option actions. Multi-leg futures-family strategies are not supported. Prices are forwarded without rounding; TradeStation determines contract availability, permissions, margin requirements, and valid price increments. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. For TradeStation, use a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as `ESZ26 C6000`, preserving the space and any session alias. The optional @ prefix is supported for dated futures contracts and is forwarded unchanged. Slash-prefixed aliases and root-only continuous symbols such as @ES are not accepted. A futures symbol does not need to be present in SnapTrade's local instrument catalog to submit an order. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
1694
|
+
# @param account_id [String] The ID of the account to execute the trade on.
|
|
1695
|
+
# @param user_id [String]
|
|
1696
|
+
# @param user_secret [String]
|
|
1697
|
+
# @param simple_trade_form [SimpleTradeForm]
|
|
1698
|
+
# @param [Hash] opts the optional parameters
|
|
1699
|
+
# @return [Array<(SimpleTradeResponse, Integer, Hash)>] SimpleTradeResponse data, response status code and response headers
|
|
1700
|
+
private def place_simple_order_with_http_info_impl(account_id, user_id, user_secret, simple_trade_form, opts = {})
|
|
1701
|
+
if @api_client.config.debugging
|
|
1702
|
+
@api_client.config.logger.debug 'Calling API: TradingApi.place_simple_order ...'
|
|
1703
|
+
end
|
|
1704
|
+
# verify the required parameter 'account_id' is set
|
|
1705
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
|
1706
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.place_simple_order"
|
|
1707
|
+
end
|
|
1708
|
+
# verify the required parameter 'user_id' is set
|
|
1709
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
|
1710
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_simple_order"
|
|
1711
|
+
end
|
|
1712
|
+
# verify the required parameter 'user_secret' is set
|
|
1713
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
|
1714
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_simple_order"
|
|
1715
|
+
end
|
|
1716
|
+
# verify the required parameter 'simple_trade_form' is set
|
|
1717
|
+
if @api_client.config.client_side_validation && simple_trade_form.nil?
|
|
1718
|
+
fail ArgumentError, "Missing the required parameter 'simple_trade_form' when calling TradingApi.place_simple_order"
|
|
1719
|
+
end
|
|
1720
|
+
# resource path
|
|
1721
|
+
local_var_path = '/accounts/{accountId}/trading/simple'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
|
1722
|
+
|
|
1723
|
+
# query parameters
|
|
1724
|
+
query_params = opts[:query_params] || {}
|
|
1725
|
+
query_params[:'userId'] = user_id
|
|
1726
|
+
query_params[:'userSecret'] = user_secret
|
|
1727
|
+
|
|
1728
|
+
# header parameters
|
|
1729
|
+
header_params = opts[:header_params] || {}
|
|
1730
|
+
# HTTP header 'Accept' (if needed)
|
|
1731
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
1732
|
+
# HTTP header 'Content-Type'
|
|
1733
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
1734
|
+
if !content_type.nil?
|
|
1735
|
+
header_params['Content-Type'] = content_type
|
|
1736
|
+
end
|
|
1737
|
+
|
|
1738
|
+
# form parameters
|
|
1739
|
+
form_params = opts[:form_params] || {}
|
|
1740
|
+
|
|
1741
|
+
# http body (model)
|
|
1742
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(simple_trade_form)
|
|
1743
|
+
|
|
1744
|
+
# return_type
|
|
1745
|
+
return_type = opts[:debug_return_type] || 'SimpleTradeResponse'
|
|
1746
|
+
|
|
1747
|
+
# auth_names
|
|
1748
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
1749
|
+
|
|
1750
|
+
new_options = opts.merge(
|
|
1751
|
+
:operation => :"TradingApi.place_simple_order",
|
|
1752
|
+
:header_params => header_params,
|
|
1753
|
+
:query_params => query_params,
|
|
1754
|
+
:form_params => form_params,
|
|
1755
|
+
:body => post_body,
|
|
1756
|
+
:auth_names => auth_names,
|
|
1757
|
+
:return_type => return_type
|
|
1758
|
+
)
|
|
1759
|
+
|
|
1760
|
+
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
|
1761
|
+
if @api_client.config.debugging
|
|
1762
|
+
@api_client.config.logger.debug "API called: TradingApi#place_simple_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
1763
|
+
end
|
|
1764
|
+
return data, status_code, headers, response
|
|
1765
|
+
end
|
|
1766
|
+
|
|
1767
|
+
|
|
1572
1768
|
# Preview crypto order
|
|
1573
1769
|
#
|
|
1574
1770
|
# Previews an order using the specified account.
|
|
@@ -33,7 +33,7 @@ module SnapTrade
|
|
|
33
33
|
|
|
34
34
|
attr_accessor :currency
|
|
35
35
|
|
|
36
|
-
# A string representing the type of transaction. SnapTrade does a best effort to categorize the brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `SUBSTITUTE_DIVIDEND` - Payment in lieu of a dividend. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of asset(s) from one account to another. - `EXTERNAL_ASSET_TRANSFER_IN` - Incoming transfer of an asset from an external account to this account. - `EXTERNAL_ASSET_TRANSFER_OUT` - Outgoing transfer of an asset from this account to an external account. - `SPLIT` - A stock share split. - `ADJUSTMENT` - A one time adjustment of the account's cash balance or shares of an asset
|
|
36
|
+
# A string representing the type of transaction. SnapTrade does a best effort to categorize the brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `SUBSTITUTE_DIVIDEND` - Payment in lieu of a dividend. - `CAPITAL_GAINS_LONG` - Long-term capital-gain distribution. - `CAPITAL_GAINS_SHORT` - Short-term capital-gain distribution. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of asset(s) from one account to another. - `EXTERNAL_ASSET_TRANSFER_IN` - Incoming transfer of an asset from an external account to this account. - `EXTERNAL_ASSET_TRANSFER_OUT` - Outgoing transfer of an asset from this account to an external account. - `SPLIT` - A stock share split. - `ADJUSTMENT` - A one time adjustment of the account's cash balance or shares of an asset
|
|
37
37
|
attr_accessor :type
|
|
38
38
|
|
|
39
39
|
# If an option `BUY` or `SELL` transaction, this further specifies the type of action. The possible values are: - BUY_TO_OPEN - BUY_TO_CLOSE - SELL_TO_OPEN - SELL_TO_CLOSE
|
|
@@ -16,7 +16,7 @@ module SnapTrade
|
|
|
16
16
|
# A stable and unique transaction id when available
|
|
17
17
|
attr_accessor :transaction_id
|
|
18
18
|
|
|
19
|
-
#
|
|
19
|
+
# A string representing the type of transaction. SnapTrade does a best effort to categorize the brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `BUY_TO_OPEN` - Option bought to open a long position. - `BUY_TO_CLOSE` - Option bought to close a short position. - `SELL_TO_OPEN` - Option sold to open a short position. - `SELL_TO_CLOSE` - Option sold to close a long position. - `DIVIDEND` - Dividend payout. - `SUBSTITUTE_DIVIDEND` - Payment in lieu of a dividend. - `CAPITAL_GAINS_LONG` - Long-term capital-gain distribution. - `CAPITAL_GAINS_SHORT` - Short-term capital-gain distribution. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of asset(s) from one account to another. - `EXTERNAL_ASSET_TRANSFER_IN` - Incoming transfer of an asset from an external account to this account. - `EXTERNAL_ASSET_TRANSFER_OUT` - Outgoing transfer of an asset from this account to an external account. - `SPLIT` - A stock share split. - `ADJUSTMENT` - A one time adjustment of the account's cash balance or shares of an asset
|
|
20
20
|
attr_accessor :type
|
|
21
21
|
|
|
22
22
|
# Recorded date and time in UTC. Precision depends on what the brokerage supplies.
|
|
@@ -29,13 +29,13 @@ module SnapTrade
|
|
|
29
29
|
|
|
30
30
|
attr_accessor :priced_in
|
|
31
31
|
|
|
32
|
-
#
|
|
32
|
+
# The amount of the transaction denominated in `priced_in`. This can be positive or negative. In general, transactions that positively affect the account balance (like sell, deposits, dividends, etc) will have a positive amount, while transactions that negatively affect the account balance (like buy, withdrawals, fees, etc) will have a negative amount.
|
|
33
33
|
attr_accessor :amount
|
|
34
34
|
|
|
35
|
-
#
|
|
35
|
+
# The price of the security for the transaction. This is mostly applicable to `BUY`, `SELL`, and `DIVIDEND` transactions. For option transactions, this represents the price per share of the option contract.
|
|
36
36
|
attr_accessor :price
|
|
37
37
|
|
|
38
|
-
#
|
|
38
|
+
# The number of units of the security for the transaction. This is mostly applicable to `BUY`, `SELL`, and `DIVIDEND` transactions. In general, BUYs result in positive units while SELLs result in negative due to the shares leaving the account
|
|
39
39
|
attr_accessor :units
|
|
40
40
|
|
|
41
41
|
# Recorded fee. Some missing brokerage fees are stored as zero.
|