def __init__(self,mf_config=mf_config, mf_pred=[futures_filter]):
       
       super(TestRiskOutright, self).__init__(mf_config, mf_pred)
       register_crews(Worker.DIRECT)

       self.scen_list = [avoid_orders_that_cross_reject_new,
                         avoid_orders_that_cross_none,
                         allow_trading_flag_outright_product_limit,
                         allow_trading_flag_outright_contract_limit,
                         max_order_size_outright_product_limit,
                         max_order_size_outright_product_limit_rej,
                         max_order_size_outright_contract_limit,
                         max_order_size_outright_contract_limit_rej,
                         bind(max_position_outright_product_limit_rej, [1, 2, 3], [Side.BUY]),
                         bind(max_position_outright_product_limit_rej, [1], [Side.SELL]),
                         max_position_product_product_limit_rej,
                         bind(max_long_short_product_limit_rej, [1, 2, 3], [Side.BUY]),
                         bind(max_long_short_product_limit_rej, [1], [Side.SELL]),
                         bind(max_position_outright_contract_limit_rej, [1, 2, 3], [Side.BUY]),
                         bind(max_position_outright_contract_limit_rej, [1], [Side.SELL]),
                         price_reasonability_outright_product_limit,
                         price_reasonability_outright_product_limit_rej,
                         price_reasonability_outright_contract_limit,
                         price_reasonability_outright_contract_limit_rej,
                         price_reasonability_outright_apply_into_mkt_product_limit,
                         price_reasonability_outright_apply_into_mkt_product_limit_rej,
                         price_reasonability_outright_apply_into_mkt_contract_limit,
                         price_reasonability_outright_apply_into_mkt_contract_limit_rej,
                         user_account_permission_off_no_account,
                         user_account_permission_on_no_account_rej,
                         user_account_permission_off_with_account,
                         user_account_permission_on_with_account,
                         user_account_permission_on_with_account_rej,
                         user_account_permission_alter_order_os_restart_rej]
Beispiel #2
0
           'chg_into_udel', 'held_chg', 'held_chg_rej', 'held_rep', 'held_rep_rej', 'rep_for_itrig', 'rep_into_ifill',
           'resting_chg', 'resting_chg_rej', 'resting_rep', 'resting_rep_arej', 'resting_rep_drej',
           'resting_rep_rej', 'post_trig_chg', 'post_trig_rep', 'stop_chg', 'stop_rep',
           'oco_chg', 'oco_rep', 'ob_scope_chg', 'ob_scope_rep', 'lsm_chg', 'lsm_rep', 'chg_for_itrig', 'rep_for_itrig']

#########################
#CONTROLLED NAMES
#########################
ECA.VALID_PRIMARY.register('NewAccount')
ECA.VALID_NON_PRIMARY.register('xyx')
ECA.NUMERIC.register('1234134')
ECA.INVALID.register('BADTXT')

resting_chg = [#bind(TickRel, 2),
               #bind(TickRel, -1),
               bind(SetOrderAttrs, {'chg_qty':1}),
               bind(SetOrderAttrs, {'chg_qty':-1})]

resting_rep = [bind(TickRel, 2),
               bind(TickRel, -1),
               bind(SetOrderAttrs, {'chg_qty':1}),
               bind(SetOrderAttrs, {'chg_qty':-1}),
               bind(SetOrderAttrs, {'exchange_clearing_account':ECA.VALID_PRIMARY}),
               bind(SetCustomer, Customer.PROXY_DIRECT_SHARE)]

chg_for_itrig = []

chg_into_del = [bind(SetOrderAttrs, {'chg_qty': cppclient.TT_INVALID_QTY}),
                bind(SetOrderAttrs, {'chg_qty':-999})]

chg_into_udel = [bind(SetOrderAttrs, {'order_restrict':OrderRes.IOC})]
Beispiel #3
0
    aenums.TT_TAILOR_MADE_COMB_ID,
    'tt_prod_type':
    aenums.TT_PROD_OSTRATEGY,
    'tt_strategy_code':
    aenums.TT_TAILOR_MADE_COMB_ID
})
Messages.SERIES_CREATE_SUCCESS.register('Spread/Strategy created successfully')
Messages.SERIES_CREATE_REJECT.register(
    'DC3, EX: transaction aborted \(Illegal ratio between the legs\.\)')
Messages.SERIES_CREATE_INVERT_REJECT.register('You made a poopy strategy!')

###################################
## ORDER BOOK SHARING SCENARIOS  ##
###################################
change_hold_reject_mods = [
    bind(SetOrderAttrs,
         {'exchange_clearing_account': ExchangeClearingAccount.INVALID}),
    bind(SetOrderAttrs, {'tif': Tif.GTD}),
    bind(SetOrderAttrs, {'acct_type': aenums.TT_ACCT_NONE}),
    bind(SetOrderAttrs, {'order_qty': -9999})
]

change_ob_share_mods = [
    bind(TickRel, 2),
    bind(TickRel, -1),
    bind(SetOrderAttrs, {'chg_qty': 1}),
    bind(SetOrderAttrs, {'chg_qty': -2}),
    bind(SetOrderAttrs,
         {'exchange_clearing_account': ExchangeClearingAccount.NUMERIC})
]

hold_reject_mods = [bind(SetOrderAttrs, {'order_qty': -9999})]
from captain import TTAPICaptainTest, OrderContext, bind
from captain.lib import *
from captain.lib.controlled_types import (OrderType, OrderRes, OrderMod, Side,
                                          Worker, Tif, ExchangeClearingAccount)
from commontests import *

from pyrate.manager import Manager

from sgx.tests.utils import mf_config, futures_filter, option_filter, fspread_filter
from sgx.tests.overrides import SPQCOverride, SGXOverrides

#Parameters:
futures = futures_filter
options = option_filter
spreads = fspread_filter
smoke_chg = [bind(TickRel, 1), bind(SetOrderAttrs, {'chg_qty': -1})]
smoke_rep = smoke_chg
smoke_market_price_change = [bind(SetOrderAttrs, {'chg_qty': 1})]

smoke_direct = Worker.DIRECT.value
smoke_ttord = Worker.PROXY_DIRECT.value
smoke_fill = Worker.FILL

__all__ = ['TestOrderAcceptance']


class TestOrderAcceptance(TTAPICaptainTest):
    def __init__(self):
        super(TestOrderAcceptance, self).__init__()
        register_crews(Worker.DIRECT)