Example #1
0
    def setUp(self):
        # Duration:7d to make sure contract is sell-able and its end date is on trading day
        self.symbol = "frxEURJPY"
        self.symbol_name = tu.frx[self.symbol]
        self.duration = 7
        self.duration_unit = "d"
        self.end_date = tu.contract_end_date(self.duration)

        # Skip testing on weekend as forex market is closed
        if not tu.trading_day(self.symbol):
            self.skipTest("Skipped test due to weekend")
Example #2
0
    def assert_valid_proposal(self, symbol, contract_type, duration,
                              duration_unit):
        if not tu.trading_day(symbol):
            self.skipTest("Skipped test due to weekend")
        else:
            proposal = tu.proposal_call_put(symbol=symbol,
                                            contract_type=contract_type,
                                            duration=duration,
                                            duration_unit=duration_unit)

            tu.print_if_error(proposal)
            self.assertTrue('error' not in proposal)
Example #3
0
    def assert_invalid_parameter(self, symbol, contract_type, duration,
                                 duration_unit, error_code):
        if not tu.trading_day(symbol):
            self.skipTest("Skipped test due to weekend")
        else:
            proposal = tu.proposal_call_put(symbol=symbol,
                                            contract_type=contract_type,
                                            duration=duration,
                                            duration_unit=duration_unit)

            self.assertTrue('error' in proposal)

            if error_code != proposal["error"]["code"]:
                tu.print_if_error(proposal)
            self.assertEqual(error_code, proposal["error"]["code"])