Class: SnapTrade::OptionsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/snaptrade/api/options_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ OptionsApi

Returns a new instance of OptionsApi.



16
17
18
# File 'lib/snaptrade/api/options_api.rb', line 16

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/snaptrade/api/options_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#list_option_holdings(user_id:, user_secret:, account_id:, extra: {}) ⇒ Object

List account option positions

Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions).

Check your API key on the [Customer Dashboard billing page](dashboard.snaptrade.com/settings/billing) to see if you have real-time data access:

- If you do, this endpoint returns real-time data.
- If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.

Parameters:

  • user_id (String)
  • user_secret (String)
  • account_id (String)
  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



32
33
34
35
# File 'lib/snaptrade/api/options_api.rb', line 32

def list_option_holdings(user_id:, user_secret:, account_id:, extra: {})
  data, _status_code, _headers = list_option_holdings_with_http_info_impl(user_id, user_secret, , extra)
  data
end

#list_option_holdings_with_http_info(user_id:, user_secret:, account_id:, extra: {}) ⇒ Object

List account option positions

Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions).

Check your API key on the [Customer Dashboard billing page](dashboard.snaptrade.com/settings/billing) to see if you have real-time data access:

- If you do, this endpoint returns real-time data.
- If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.

Parameters:

  • user_id (String)
  • user_secret (String)
  • account_id (String)
  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



49
50
51
# File 'lib/snaptrade/api/options_api.rb', line 49

def list_option_holdings_with_http_info(user_id:, user_secret:, account_id:, extra: {})
  list_option_holdings_with_http_info_impl(user_id, user_secret, , extra)
end