Beispiel #1
0
def get_open_stock_positions(info=None):
    """Returns a list of stocks that are currently held.

    :param info: Will filter the results to get a specific value.
    :type info: Optional[str]
    :returns: [list] Returns a list of dictionaries of key/value pairs for each ticker. If info parameter is provided, \
    a list of strings is returned where the strings are the value of the key that matches info.
    :Dictionary Keys: * url
                      * instrument
                      * account
                      * account_number
                      * average_buy_price
                      * pending_average_buy_price
                      * quantity
                      * intraday_average_buy_price
                      * intraday_quantity
                      * shares_held_for_buys
                      * shares_held_for_sells
                      * shares_held_for_stock_grants
                      * shares_held_for_options_collateral
                      * shares_held_for_options_events
                      * shares_pending_from_options_events
                      * updated_at
                      * created_at

    """
    url = urls.positions()
    payload = {'nonzero': 'true'}
    data = helper.request_get(url, 'pagination', payload)

    return(helper.filter(data, info))
Beispiel #2
0
def get_all_positions(info=None):
    """Returns a list containing every position ever traded.

    :param info: Will data_filter the results to get a specific value.
    :type info: Optional[str]
    :returns: Returns a list of dictionaries of key/value pairs for each ticker. If info parameter is provided, \
    a list of strings is returned where the strings are the value of the key that matches info.

    """
    url = urls.positions()
    data = helper.request_get(url, 'pagination')

    return helper.data_filter(data, info)
Beispiel #3
0
def get_current_positions(info=None):
    """Returns a list of stocks/options that are currently held.

    :param info: Will data_filter the results to get a specific value.
    :type info: Optional[str]
    :returns: Returns a list of dictionaries of key/value pairs for each ticker. If info parameter is provided, \
    a list of strings is returned where the strings are the value of the key that matches info.

    """
    url = urls.positions()
    payload = {'nonzero': 'true'}
    data = helper.request_get(url, 'pagination', payload)

    return helper.data_filter(data, info)