firstrun: First Run Credential Setup

View source: R/FirstRun.R

firstrunR Documentation

First Run Credential Setup

Description

This function helps edit the .Renviron file to work with AlpacaforR. It's for first time users and only needs to be run once.

Usage

firstrun(
  paper_api = NULL,
  live_api = NULL,
  polygon_api = NULL,
  pro = FALSE,
  live = FALSE,
  scope = c("user", "project")
)

Arguments

paper_api

(named character) of length two: key and secret for the Alpaca paper API.

live_api

(named character) of length two: key and secret for the Alpaca live API.

polygon_api

(named character) of length one: key

pro

(logical) of length one: Set as TRUE to use the https://alpaca.markets/docs/api-documentation/api-v2/market-data/alpaca-data-api-v2/#subscription-plans otherwise the Basic plan will be used. Default FALSE

live

(logical): the default option for whether to use the live account TRUE or paper account FALSE. This option can be overridden for functions that accept the live argument, or can be changed at a later time. Default FALSE

scope

(character) specify at which level of scope the changes to .Renviron should apply.

Value

Sets environment variables for this session and edits the .Renviron file in R's home directory path.expand("~") and adds the specified key/secret combinations for future sessions. If an .Renviron file does not exist, it will be created.

Examples

## Not run: 
firstrun(
paper_api = c(key = "mypaperkey", secret = "mypapersecret"),
live_api = c(key = "mylivekey", secret = "mylivesecret"),
polygon_api = c(key = "polygonkey"),
live = FALSE,
pro = FALSE
)

## End(Not run)

jagg19/AlpacaforR documentation built on July 3, 2023, 12:14 p.m.