make_buy: Make Buy Trade Execution function

Description Usage Arguments Details Value Examples

View source: R/Trades.R

Description

Function executions a buy trade

Usage

1
2
make_buy(pobj, date = Sys.Date(), symbol, quantity, price, desc = "",
  trans_cost = 0.05)

Arguments

pobj

portfolio object

date

date of transaction. Date type

symbol

symbol ticker. character type

quantity

number of shares. numeric type

price

price of shares. numeric type

desc

trade description. string type

trans_cost

transaction cost (dollars per share)

Details

subtracts trade amount from cash balance, updates portfolio internal trade history and holdings

Value

updated portfolio object

Examples

1
2
3
4
library(tidyverse)
portfolio("new_port") %>%
make_deposit(Sys.Date(), amount = 2000) %>%
make_buy(symbol = "SPY", quantity = 10, price = 100)

chrishaarstick/madstork documentation built on Jan. 3, 2022, 8:34 p.m.