Skip to content

Commit

Permalink
export_completed_stock_orders, get_all_stock_orders now take optional…
Browse files Browse the repository at this point in the history
… account_number arg
  • Loading branch information
mattf1n committed Jul 14, 2024
1 parent 2e12794 commit 3b7fa9f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions robin_stocks/robinhood/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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([
Expand Down
4 changes: 2 additions & 2 deletions robin_stocks/robinhood/orders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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))

Expand Down

0 comments on commit 3b7fa9f

Please sign in to comment.