From 3b7fa9fb429ee9f230f763095afacd82b04902e6 Mon Sep 17 00:00:00 2001 From: Matthew Finlayson Date: Sat, 13 Jul 2024 22:10:59 -0400 Subject: [PATCH] export_completed_stock_orders, get_all_stock_orders now take optional account_number arg --- robin_stocks/robinhood/export.py | 4 ++-- robin_stocks/robinhood/orders.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/robin_stocks/robinhood/export.py b/robin_stocks/robinhood/export.py index a80a51c4..33bd0507 100644 --- a/robin_stocks/robinhood/export.py +++ b/robin_stocks/robinhood/export.py @@ -41,7 +41,7 @@ def create_absolute_csv(dir_path, file_name, order_type): @login_required -def export_completed_stock_orders(dir_path, file_name=None): +def export_completed_stock_orders(dir_path, file_name=None, account_number=None): """Write all completed orders to a csv file :param dir_path: Absolute or relative path to the directory the file will be written. @@ -51,7 +51,7 @@ def export_completed_stock_orders(dir_path, file_name=None): """ file_path = create_absolute_csv(dir_path, file_name, 'stock') - all_orders = get_all_stock_orders() + all_orders = get_all_stock_orders(account_number=account_number) with open(file_path, 'w', newline='') as f: csv_writer = writer(f) csv_writer.writerow([ diff --git a/robin_stocks/robinhood/orders.py b/robin_stocks/robinhood/orders.py index 0a37b476..e3081fc6 100644 --- a/robin_stocks/robinhood/orders.py +++ b/robin_stocks/robinhood/orders.py @@ -8,7 +8,7 @@ from robin_stocks.robinhood.urls import * @login_required -def get_all_stock_orders(info=None): +def get_all_stock_orders(info=None, account_number=None): """Returns a list of all the orders that have been processed for the account. :param info: Will filter the results to get a specific value. @@ -17,7 +17,7 @@ def get_all_stock_orders(info=None): a list of strings is returned where the strings are the value of the key that matches info. """ - url = orders_url() + url = orders_url(account_number=account_number) data = request_get(url, 'pagination') return(filter_data(data, info))