def test_is_able_to_close_via_reduce_postion_too(): set_up() p = Position(exchanges.SANDBOX, 'BTC-USD', { 'entry_price': 50, 'current_price': 50, 'qty': 2, }) p._reduce(2, 50) assert p.qty == 0
def test_reduce_a_short_position(): set_up() p = Position(exchanges.SANDBOX, 'BTC-USD', { 'entry_price': 50, 'current_price': 50, 'qty': -2, }) p._reduce(1, 50) assert p.qty == -1
def test_is_able_to_close_via_reduce_postion_too(): set_up() p = Position(exchanges.SANDBOX, 'BTCUSD', { 'entry_price': 50, 'current_price': 50, 'qty': 2, }) e = selectors.get_exchange('Sandbox') p._reduce(2, 50) assert p.qty == 0 assert e.balance == 1100
def test_reduce_a_short_position(): set_up() p = Position(exchanges.SANDBOX, 'BTCUSD', { 'entry_price': 50, 'current_price': 50, 'qty': -2, }) e = selectors.get_exchange('Sandbox') p._reduce(1, 50) assert p.qty == -1 assert e.balance == 1050