req_family_codes: Request Family Codes

View source: R/req_family_codes.R

req_family_codesR Documentation

Request Family Codes

Description

Retrieve the family codes for all accounts accessible by the current user.

Usage

req_family_codes(channel = NULL)

Arguments

channel

One of the following:

  • Not Specified (Default): Opens a new connection to IB, uses it to issue the request and retrieve the response, and closes connection behind itself upon completion.

  • The Name of a Sock: Character vector, length 1. The name of an open, connected socket in the sock_drawer; e.g., "master", "tws", or "sock_123"

  • Numeric Client ID: Numeric, length 1. The client ID for which open orders are to be retrieved; e.g., 0, 874, 123. If a client ID is passed, and no socket in the sock_drawer is connected on that ID, then a new socket will be opened on that ID, and closed upon function exit.

  • A sockconn Connection: An open connection object of class "sockconn", connected to the IB API; e.g., sock_drawer$tws

Value

A named character vector containing all of the family codes for the accounts that are visible to the user. The value of each element is a family code, and the name of each element is the account ID to which that code applies.

Family Codes

Every account at Interactive Brokers is associated with one family code in order to cluster accounts into groups according to management. By default, the family code for an account equals that account's ID suffixed with the letter "A"; for example, a an individual account having an ID = "U1234567" would have a Family Code of "U1234567A".

If, however, Account U1234567 were managed by a Financial Advisor running an account under ID = "U7654321", then the Family Code of account U1234567 would be "U7654321A".

See Also

Other quick fetch: req_current_time(), req_managed_accts()

Examples

# Fetch family codes
family_codes <- req_family_codes()
# Print family codes
family_codes

JakeVestal/InteractiveTradeR documentation built on June 5, 2024, 2:21 p.m.