Description Usage Arguments Format Details Examples
create a R6 object of future_acount.
1 2 3 4 5 6 7 8 9 10 11 12 | p <- future_acount$new(con, fee = 0.005, acount_only = F)
p$set_connection(con)
p$show_connection()
p$order_buy(date, stock, num = NULL, amount = NULL)
p$order_sell(date, stock, num = NULL)
p$order_to(date, stock, weight, amount = 'all')
p$acount_update(date)
p$show_stock()
p$show_acount_f()
p$show_trade_history()
p$show_total_acount()
p$show_holder_history(date)
|
con |
connection for data |
fee |
float, the fee you sold stock |
acount_f |
int, initial acount value, default 1m |
date |
date, the date you alter you stock acount |
stock |
vector, the stock you buy or sell |
num |
vector, the stock vol you buy or sell |
amount |
vector, the stock amount you buy |
acount_only |
logic, if save the trade_history and other details |
stock_acount$new(con, fee, acount_only)
to create new object, this fee is charged when sell stock;
set_connection(con)
to set the connection;
show_connection(con)
to return the connection;
order_buy(date, stock, num, amount)
to buy the stock list, one of num and amount is needed. if it have both, the num will be used. amount is preferd because adjust price is easily wrong. if lenght amount is one, it will be rep for every stock.
order_sell(date, stock, num)
to sell the stock with fix number
order_to(date, stock, weight, amount = 'all')
buy the stock to the target. for unknown amount , it use weight instead
acount_update(date)
to update the acount by close price, date can be a vector, so that can update several days for once
show_stock()
to show the stock hold now
show_acount_f()
to show the stock free money
show_trade_history()
to show trade_history
show_total_acount()
to show total acount history
show_holder_history(date)
to show holder stock in history, date can be vector
An R6Class
generator object
1 2 3 4 5 6 7 8 9 | ## Not run:
my_acount <- stock_acount$new(con = con)
my_acount$order_buy(as.Date('2015-01-04'), stock = '600000.SH',num = 1000)
my_acount$acount_update(as.Date('2015-01-04'))
my_acount$order_sell(as.Date('2015-01-05'), stock = '600000.SH', num = 500)
my_acount$acount_update(as.Date('2015-01-05'))
my_acount$show_acount_f()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.