Example #1
0
def test_state_order_count():
    set_up()

    assert store.orders.count(exchanges.SANDBOX, 'BTCUSD') == 0
    store.orders.add_order(fake_order())
    assert store.orders.count(exchanges.SANDBOX, 'BTCUSD') == 1
    store.orders.add_order(fake_order())
    assert store.orders.count(exchanges.SANDBOX, 'BTCUSD') == 2
Example #2
0
def test_state_order_get_orders():
    set_up()

    o1 = fake_order({'exchange': exchanges.SANDBOX, 'symbol': 'ETHUSD'})
    o2 = fake_order({'exchange': exchanges.SANDBOX, 'symbol': 'ETHUSD'})
    store.orders.add_order(o1)
    store.orders.add_order(o2)
    assert store.orders.get_orders(exchanges.SANDBOX, 'ETHUSD') == [o1, o2]
Example #3
0
def test_add_new_order():
    set_up()

    o1 = fake_order({'exchange': exchanges.SANDBOX, 'symbol': 'ETHUSD'})
    o2 = fake_order({'exchange': exchanges.SANDBOX, 'symbol': 'ETHUSD'})
    store.orders.add_order(o1)
    store.orders.add_order(o2)
    assert store.orders.storage['Sandbox-ETHUSD'] == [o1, o2]
Example #4
0
def test_state_order_get_order_by_id():
    set_up()

    o0 = fake_order({'exchange': exchanges.SANDBOX, 'symbol': 'ETH-USD'})
    o1 = fake_order({'exchange': exchanges.SANDBOX, 'symbol': 'ETH-USD'})
    o2 = fake_order({'exchange': exchanges.SANDBOX, 'symbol': 'ETH-USD'})

    store.orders.get_order_by_id(exchanges.SANDBOX, 'ETH-USD', o2.id)

    # return None if does not exist
    assert store.orders.get_order_by_id(exchanges.SANDBOX, 'ETH-USD',
                                        o0.id) == None

    store.orders.add_order(o1)
    store.orders.add_order(o2)
    assert store.orders.get_order_by_id(exchanges.SANDBOX, 'ETH-USD',
                                        o2.id) == o2