Skip to content

Commit

Permalink
Add get_aggregate_open_positions
Browse files Browse the repository at this point in the history
  • Loading branch information
nbr23 committed Jun 17, 2023
1 parent bb38fcc commit 232c2f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions robin_stocks/robinhood/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
find_options_by_expiration_and_strike,
find_options_by_specific_profitability,
find_options_by_strike, find_tradable_options,
get_aggregate_open_positions,
get_aggregate_positions, get_all_option_positions,
get_chains, get_market_options,
get_open_option_positions, get_option_historicals,
Expand Down
15 changes: 15 additions & 0 deletions robin_stocks/robinhood/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ def get_aggregate_positions(info=None):
data = request_get(url, 'pagination')
return(filter_data(data, info))

@login_required
def get_aggregate_open_positions(info=None):
"""Collapses all open option positions for a stock into a single dictionary.
:param info: Will filter the results to get a specific value.
:type info: Optional[str]
:returns: Returns a list of dictionaries of key/value pairs for each order. If info parameter is provided, \
a list of strings is returned where the strings are the value of the key that matches info.
"""
url = aggregate_url()
payload = {'nonzero': 'True'}
data = request_get(url, 'pagination', payload)
return(filter_data(data, info))


@login_required
def get_market_options(info=None):
Expand Down

0 comments on commit 232c2f2

Please sign in to comment.