示例#1
0
def test_enter_position_max_lot_size():
    mock_account_value_list = []
    mock_lot_size = 0.5
    mock_account_value = 1000
    mock_max_lot_size = 100
    mock_close = 10
    mock_comission = 0.01

    in_trade, new_aux, new_account_value, fee = enter_position(
        mock_account_value_list,
        mock_lot_size,
        mock_account_value,
        mock_max_lot_size,
        mock_close,
        mock_comission,
    )

    assert in_trade is True
    assert new_aux == 9.999
    assert fee == 0.001
    assert new_account_value == 900
示例#2
0
def test_enter_position_lot_size():
    mock_account_value_list = [1000, 0, 1100]
    mock_account_value = 1100
    mock_lot_size = 0.5
    mock_max_lot_size = 0
    mock_close = 10
    mock_comission = 0

    in_trade, new_aux, new_account_value, fee = enter_position(
        mock_account_value_list,
        mock_lot_size,
        mock_account_value,
        mock_max_lot_size,
        mock_close,
        mock_comission,
    )

    assert in_trade is True
    assert new_aux == 55.0
    assert fee == 0.0
    assert new_account_value == 550.0