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

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

Get the options chain for a symbol

Returns the option chain for the specified symbol in the specified account.

Parameters:

  • user_id (String)
  • user_secret (String)
  • account_id (String)

    The ID of the account to get the options chain from.

  • symbol (String)

    Universal symbol ID if symbol

  • extra (Hash) (defaults to: {})

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



29
30
31
32
# File 'lib/snaptrade/api/options_api.rb', line 29

def get_options_chain(user_id:, user_secret:, account_id:, symbol:, extra: {})
  data, _status_code, _headers = get_options_chain_with_http_info_impl(user_id, user_secret, , symbol, extra)
  data
end

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

Get the options chain for a symbol

Returns the option chain for the specified symbol in the specified account.

Parameters:

  • user_id (String)
  • user_secret (String)
  • account_id (String)

    The ID of the account to get the options chain from.

  • symbol (String)

    Universal symbol ID if symbol

  • extra (Hash) (defaults to: {})

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



43
44
45
# File 'lib/snaptrade/api/options_api.rb', line 43

def get_options_chain_with_http_info(user_id:, user_secret:, account_id:, symbol:, extra: {})
  get_options_chain_with_http_info_impl(user_id, user_secret, , symbol, extra)
end

#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://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?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



144
145
146
147
# File 'lib/snaptrade/api/options_api.rb', line 144

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://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?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



161
162
163
# File 'lib/snaptrade/api/options_api.rb', line 161

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