From 61bc03e230e062d8b359e7a486c79a57a699117c Mon Sep 17 00:00:00 2001 From: Felix Martin Date: Mon, 12 Oct 2020 20:07:05 -0400 Subject: [PATCH] Change marketsim to support orders dataframe as input --- marketsim/marketsim.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/marketsim/marketsim.py b/marketsim/marketsim.py index 50d2c41..aac6468 100644 --- a/marketsim/marketsim.py +++ b/marketsim/marketsim.py @@ -92,7 +92,11 @@ def handle_order(date, order, holding, prices, commission, impact): def compute_portvals(orders_file, start_val=1000000, commission=9.95, impact=0.005): - orders = read_orders(orders_file) + if isinstance(orders_file, pd.DataFrame): + orders = orders_file + else: + orders = read_orders(orders_file) + start_date, end_date, symbols = get_order_book_info(orders) # Tickers in the orderbook over the date_range in the order book.