Ejemplo n.º 1
0
    def test_buy_touch_contract(self):
        current_spot = tu.find_latest_tick(self.symbol)
        abs_barrier = tu.abs_higher_barrier(current_spot, 23.50, 2)

        proposal = tu.proposal_touch_no_touch(symbol=self.symbol,
                                              contract_type="ONETOUCH",
                                              duration=self.duration,
                                              duration_unit=self.duration_unit,
                                              barrier=abs_barrier)
        expected_longcode = 'Win payout if {0} touches {1} through {2} after contract start time.' \
            .format(self.symbol_name, abs_barrier, self.contract_duration)

        self.assert_longcode(proposal, expected_longcode)
Ejemplo n.º 2
0
    def test_buy_no_touch_contract(self):
        current_spot = tu.find_latest_tick(self.symbol)
        barrier = tu.abs_higher_barrier(current_spot, 0.5, 3)

        proposal = tu.proposal_touch_no_touch(symbol=self.symbol,
                                              contract_type="NOTOUCH",
                                              duration=self.duration,
                                              duration_unit=self.duration_unit,
                                              barrier=barrier)

        expected_longcode = 'Win payout if {0} does not touch {1} through close on {2}.' \
                            .format(self.symbol_name, barrier, self.end_date)

        self.assert_longcode(proposal, expected_longcode)
Ejemplo n.º 3
0
    def test_buy_higher_contract(self):
        current_spot = tu.find_latest_tick(self.symbol)
        current_spot_formatted = "{:.3f}".format(current_spot)

        # use current_spot as absolute barrier
        proposal = tu.proposal_higher_lower(symbol=self.symbol,
                                            contract_type="CALL",
                                            duration=self.duration,
                                            duration_unit=self.duration_unit,
                                            barrier=current_spot)

        expected_longcode = 'Win payout if {0} is strictly higher than {1} at close on {2}.' \
                            .format(self.symbol_name, current_spot_formatted, self.end_date)

        self.assert_longcode(proposal, expected_longcode)
Ejemplo n.º 4
0
    def test_buy_lower_contract(self):
        current_spot = tu.find_latest_tick(self.symbol)
        current_spot_formatted = "{:.2f}".format(current_spot)

        # use current_spot as absolute barrier
        proposal = tu.proposal_higher_lower(symbol=self.symbol,
                                            contract_type="PUT",
                                            duration=self.duration,
                                            duration_unit=self.duration_unit,
                                            barrier=current_spot)
        expected_longcode = 'Win payout if {0} is strictly lower than {1} ' \
                            'at {2} after contract start time.' \
            .format(self.symbol_name, current_spot_formatted, self.contract_duration)

        self.assert_longcode(proposal, expected_longcode)
Ejemplo n.º 5
0
    def test_buy_goes_outside_contract(self):
        current_spot = tu.find_latest_tick(self.symbol)
        barrier = tu.abs_higher_barrier(current_spot, 23.4, 3)
        barrier2 = tu.abs_lower_barrier2(current_spot, 25.3, 3)

        proposal = tu.proposal_in_out(symbol=self.symbol,
                                      contract_type="UPORDOWN",
                                      duration=self.duration,
                                      duration_unit=self.duration_unit,
                                      barrier=barrier,
                                      barrier2=barrier2)

        expected_longcode = 'Win payout if {0} goes outside {1} to {2} through close on {3}.' \
                            .format(self.symbol_name, barrier2, barrier, self.end_date)

        self.assert_longcode(proposal, expected_longcode)
Ejemplo n.º 6
0
    def test_buy_stay_between_contract(self):
        current_spot = tu.find_latest_tick(self.symbol)
        barrier = tu.abs_higher_barrier(current_spot, 0.5, 3)
        barrier2 = tu.abs_lower_barrier2(current_spot, 0.5, 3)

        proposal = tu.proposal_in_out(symbol=self.symbol,
                                      contract_type="RANGE",
                                      duration=self.duration,
                                      duration_unit=self.duration_unit,
                                      barrier=barrier,
                                      barrier2=barrier2)

        expected_longcode = 'Win payout if {0} stays between {1} to {2} through close on {3}.' \
                            .format(self.symbol_name, barrier2, barrier, self.end_date)

        self.assert_longcode(proposal, expected_longcode)
Ejemplo n.º 7
0
    def test_buy_end_out_contract(self):
        current_spot = tu.find_latest_tick(self.symbol)
        barrier = tu.abs_higher_barrier(current_spot, 0.5, 3)
        barrier2 = tu.abs_lower_barrier2(current_spot, 0.5, 3)

        proposal = tu.proposal_in_out(symbol=self.symbol,
                                      contract_type="EXPIRYMISS",
                                      duration=self.duration,
                                      duration_unit=self.duration_unit,
                                      barrier=barrier,
                                      barrier2=barrier2)

        expected_longcode = 'Win payout if {0} ends outside {1} to {2} at close on {3}.' \
                            .format(self.symbol_name, barrier2, barrier, self.end_date)

        self.assert_longcode(proposal, expected_longcode)