Exemplo n.º 1
0
def stock_orders(client, options={}):
    '''
    options:
        - only_filled. Only return filled orders. Default = False.
    '''
    orders = StockOrder.all(client)
    only_filled = util.get_key(options, "only_filled", True)
    if only_filled:
        orders = list(filter(lambda x: x["state"] == "filled", orders))
    return orders
Exemplo n.º 2
0
def stock_orders(account, options={}):
    '''
    options:
        - only_filled. Only return filled orders. Default = False.
    '''
    client = _init_client(account["username"], account["password"])
    orders = StockOrder.all(client)
    only_filled = util.get_key(options, "only_filled", True)
    if only_filled:
        orders = list(filter(lambda x: x["state"] == "filled", orders))
    return orders
Exemplo n.º 3
0
def option_orders(client, options={}):
    '''
    options:
        - only_filled. Default = True
    '''
    x = OptionOrder.all(client)
    only_filled = util.get_key(options, "only_filled", True)
    if only_filled:
        x = list(filter(lambda j: j["state"] == "filled", x))
    x = OptionOrder.humanize_numbers(x)
    return x
Exemplo n.º 4
0
def option_orders(account, options={}):
    '''
    options:
        - only_filled:
    '''
    client = _init_client(account["username"], account["password"])
    x = OptionOrder.all(client)
    only_filled = util.get_key(options, "only_filled", True)
    if only_filled:
        x = list(filter(lambda j: j["state"] == "filled", x))
    x = OptionOrder.humanize_numbers(x)
    return x
Exemplo n.º 5
0
def option_positions(client, options={}):
    '''
    options:
        - only_open. Default = True
    '''
    x = OptionPosition.all(client)
    only_open = util.get_key(options, "only_open", True)
    if only_open:
        x = list(filter(lambda p: float(p["quantity"]) > 0.0, x))
        x = OptionPosition.mergein_marketdata_list(client, x)
        x = OptionPosition.mergein_instrumentdata_list(client, x)
        x = OptionPosition.humanize_numbers(x)
    return x