Class: SnapTrade::ExperimentalEndpointsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ExperimentalEndpointsApi

Returns a new instance of ExperimentalEndpointsApi.



16
17
18
# File 'lib/snaptrade/api/experimental_endpoints_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/experimental_endpoints_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

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

List historical account total value

An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and only available for certain brokerages with a maximum lookback of 1 year.

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



28
29
30
31
# File 'lib/snaptrade/api/experimental_endpoints_api.rb', line 28

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

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

List historical account total value

An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and only available for certain brokerages with a maximum lookback of 1 year.

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



41
42
43
# File 'lib/snaptrade/api/experimental_endpoints_api.rb', line 41

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

#get_all_account_positions(user_id:, user_secret:, account_id:, page: SENTINEL, page_size: SENTINEL, extra: {}) ⇒ Object

List all account positions

Returns a paginated list of all positions in the specified account.

The ‘results` list can contain multiple instrument types in the same response page, including stocks, ETFs, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position’s ‘instrument`.

Stock positions may also include ‘cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account.

If the connection has become disabled, it can no longer access the latest data from the brokerage, 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.

Parameters:

  • user_id (String)
  • user_secret (String)
  • account_id (String)
  • page (Integer) (defaults to: SENTINEL)

    The page number to return. Defaults to 1.

  • page_size (Integer) (defaults to: SENTINEL)

    The number of positions to return per page. Defaults to 100 with a maximum of 1000.

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

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



139
140
141
142
143
144
# File 'lib/snaptrade/api/experimental_endpoints_api.rb', line 139

def (user_id:, user_secret:, account_id:, page: SENTINEL, page_size: SENTINEL, extra: {})
  extra[:page] = page if page != SENTINEL
  extra[:page_size] = page_size if page_size != SENTINEL
  data, _status_code, _headers = (user_id, user_secret, , extra)
  data
end

#get_all_account_positions_with_http_info(user_id:, user_secret:, account_id:, page: SENTINEL, page_size: SENTINEL, extra: {}) ⇒ Object

List all account positions

Returns a paginated list of all positions in the specified account.

The ‘results` list can contain multiple instrument types in the same response page, including stocks, ETFs, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position’s ‘instrument`.

Stock positions may also include ‘cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account.

If the connection has become disabled, it can no longer access the latest data from the brokerage, 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.

Parameters:

  • user_id (String)
  • user_secret (String)
  • account_id (String)
  • page (Integer) (defaults to: SENTINEL)

    The page number to return. Defaults to 1.

  • page_size (Integer) (defaults to: SENTINEL)

    The number of positions to return per page. Defaults to 100 with a maximum of 1000.

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

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



162
163
164
165
166
# File 'lib/snaptrade/api/experimental_endpoints_api.rb', line 162

def (user_id:, user_secret:, account_id:, page: SENTINEL, page_size: SENTINEL, extra: {})
  extra[:page] = page if page != SENTINEL
  extra[:page_size] = page_size if page_size != SENTINEL
  (user_id, user_secret, , extra)
end

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

Get account order detail (V2)

Returns the detail of a single order using the brokerage order ID provided as a path parameter.

The V2 order response format includes all legs of the order in the ‘legs` list field. If the order is single legged, `legs` will be a list of one leg.

This endpoint is always realtime and does not rely on cached data.

This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.

Parameters:

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

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



280
281
282
283
# File 'lib/snaptrade/api/experimental_endpoints_api.rb', line 280

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

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

Get account order detail (V2)

Returns the detail of a single order using the brokerage order ID provided as a path parameter.

The V2 order response format includes all legs of the order in the ‘legs` list field. If the order is single legged, `legs` will be a list of one leg.

This endpoint is always realtime and does not rely on cached data.

This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.

Parameters:

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

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



301
302
303
# File 'lib/snaptrade/api/experimental_endpoints_api.rb', line 301

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

#get_user_account_orders_v2(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {}) ⇒ Object

List account orders v2

Returns a list of recent orders in the specified account.

The V2 order response format will include all legs of each order in the ‘legs` list field. If the order is single legged, `legs` will be a list of one leg.

If the connection has become disabled, it can no longer access the latest data from the brokerage, 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.

Parameters:

  • user_id (String)
  • user_secret (String)
  • account_id (String)
  • state (String) (defaults to: SENTINEL)

    defaults value is set to "all"

  • days (Integer) (defaults to: SENTINEL)

    Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in.

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

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



403
404
405
406
407
408
# File 'lib/snaptrade/api/experimental_endpoints_api.rb', line 403

def (user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
  extra[:state] = state if state != SENTINEL
  extra[:days] = days if days != SENTINEL
  data, _status_code, _headers = (user_id, user_secret, , extra)
  data
end

#get_user_account_orders_v2_with_http_info(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {}) ⇒ Object

List account orders v2

Returns a list of recent orders in the specified account.

The V2 order response format will include all legs of each order in the ‘legs` list field. If the order is single legged, `legs` will be a list of one leg.

If the connection has become disabled, it can no longer access the latest data from the brokerage, 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.

Parameters:

  • user_id (String)
  • user_secret (String)
  • account_id (String)
  • state (String) (defaults to: SENTINEL)

    defaults value is set to "all"

  • days (Integer) (defaults to: SENTINEL)

    Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in.

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

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



424
425
426
427
428
# File 'lib/snaptrade/api/experimental_endpoints_api.rb', line 424

def (user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
  extra[:state] = state if state != SENTINEL
  extra[:days] = days if days != SENTINEL
  (user_id, user_secret, , extra)
end

#get_user_account_recent_orders_v2(user_id:, user_secret:, account_id:, only_executed: SENTINEL, extra: {}) ⇒ Object

List account recent orders (V2, last 24 hours only)

A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders. Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days. By default only returns executed orders, but that can be changed by setting only_executed to false. **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](dashboard.snaptrade.com/settings/billing)**

Parameters:

  • user_id (String)
  • user_secret (String)
  • account_id (String)
  • only_executed (Boolean) (defaults to: SENTINEL)

    Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well

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

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



535
536
537
538
539
# File 'lib/snaptrade/api/experimental_endpoints_api.rb', line 535

def (user_id:, user_secret:, account_id:, only_executed: SENTINEL, extra: {})
  extra[:only_executed] = only_executed if only_executed != SENTINEL
  data, _status_code, _headers = (user_id, user_secret, , extra)
  data
end

#get_user_account_recent_orders_v2_with_http_info(user_id:, user_secret:, account_id:, only_executed: SENTINEL, extra: {}) ⇒ Object

List account recent orders (V2, last 24 hours only)

A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders. Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days. By default only returns executed orders, but that can be changed by setting only_executed to false. **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](dashboard.snaptrade.com/settings/billing)**

Parameters:

  • user_id (String)
  • user_secret (String)
  • account_id (String)
  • only_executed (Boolean) (defaults to: SENTINEL)

    Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well

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

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



554
555
556
557
# File 'lib/snaptrade/api/experimental_endpoints_api.rb', line 554

def (user_id:, user_secret:, account_id:, only_executed: SENTINEL, extra: {})
  extra[:only_executed] = only_executed if only_executed != SENTINEL
  (user_id, user_secret, , extra)
end

#sync_brokerage_authorization_transactions(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object

Sync transactions for a connection

Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day’s transactions have been synced. For more information on sync behaviour, see: docs.snaptrade.com/docs/syncing

Parameters:

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

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



648
649
650
651
# File 'lib/snaptrade/api/experimental_endpoints_api.rb', line 648

def sync_brokerage_authorization_transactions(authorization_id:, user_id:, user_secret:, extra: {})
  data, _status_code, _headers = sync_brokerage_authorization_transactions_with_http_info_impl(authorization_id, user_id, user_secret, extra)
  data
end

#sync_brokerage_authorization_transactions_with_http_info(authorization_id:, user_id:, user_secret:, extra: {}) ⇒ Object

Sync transactions for a connection

Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day’s transactions have been synced. For more information on sync behaviour, see: docs.snaptrade.com/docs/syncing

Parameters:

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

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



661
662
663
# File 'lib/snaptrade/api/experimental_endpoints_api.rb', line 661

def sync_brokerage_authorization_transactions_with_http_info(authorization_id:, user_id:, user_secret:, extra: {})
  sync_brokerage_authorization_transactions_with_http_info_impl(authorization_id, user_id, user_secret, extra)
end