Exemple #1
0
def test_get_strategy_inputs(trader: Trader):
    """
    Test trader get strategy inputs functionality.
    :param trader: Trader object.
    """
    dummy_strategy = Strategy(name="dummy", parent=None)

    def temp():
        return 3, 4, 5

    dummy_strategy.get_params = temp
    assert dummy_strategy.get_params() == (3, 4, 5)

    trader.strategies = {'dummy': dummy_strategy}
    assert trader.get_strategy_inputs('dummy') == '3, 4, 5'
Exemple #2
0
def test_get_strategies_info_string(trader: Trader):
    """
    Test trader get strategies info string functionality.
    :param trader: Trader object.
    """
    dummy_strategy = Strategy(name="dummy", parent=None)
    dummy_strategy2 = Strategy(name='dummy2', parent=None)

    def temp():
        return 3, 4, 5

    def temp2():
        return 5, 6, 7, 8, 9, 10

    dummy_strategy.get_params = temp
    dummy_strategy2.get_params = temp2
    expected_string = 'Strategies:\n\tDummy: 3, 4, 5\n\tDummy2: 5, 6, 7, 8, 9, 10'

    trader.strategies = {'dummy': dummy_strategy, 'dummy2': dummy_strategy2}
    assert trader.get_strategies_info_string() == expected_string