Exemplo n.º 1
0
    def test_nominal(self):
        epic = EpicFactory(ref="MY_EPIC_REF")
        strategy = StrategyFactory(ref="MY_STRATEGY")
        trade = TradeFactory(
            ref="MY_TRADE",
            epic=epic,
            direction=TradeDirection.BUY,
            open_datetime=arrow.get("2020-01-01 12:34:56"),
            quantity=5,
            status=TransactionStatus.REFUSED,
            strategy=strategy,
        )

        assert trade.asdict() == {
            "closed_quantities": 0,
            "direction": TradeDirection.BUY,
            "epic": "MY_EPIC_REF",
            "open_date": "2020-01-01 12:34:56",
            "open_quantity": 5,
            "open_value": 101,
            "ref": "MY_TRADE",
            "result": -10,
            "status": TransactionStatus.REFUSED,
            "strategy": "MY_STRATEGY",
        }
Exemplo n.º 2
0
 def test_no_strategy(self):
     trade = TradeFactory(strategy=None)
     assert trade.asdict()["strategy"] == "undefined" ""