Esempio n. 1
0
    def __init__(self, *args, **kwargs):
        self.START_TIME = datetime.datetime.now()
        BaseExchangeServerClient.__init__(self, *args, **kwargs)

        # self.codes = ["C100PHX", "P100PHX",]
        self.codes = [
            "C98PHX",
            "P98PHX",
            "C99PHX",
            "P99PHX",
            "C100PHX",
            "P100PHX",
            "C101PHX",
            "P101PHX",
            "C102PHX",
            "P102PHX",
        ]
        self._orderids = {}
        self.asset_codes = self.__init_asset_codes()
        self.underlying_code = "IDX#PHX"
        self.underlying_price = 100
        self.inventory = self.__init_inventory()
        self.potential_inventory = self.__init_inventory()
        self.ticks = [[0]]
        self.tick = 0
        self.order_pops = set([])
Esempio n. 2
0
    def __init__(self, *args, **kwargs):
        BaseExchangeServerClient.__init__(self, *args, **kwargs)

        self._orderids = set([])
        self._count = 0
        self.k_array = []
        self.m_array = []
        self.n_array = []
        self.q_array = []
        self.u_array = []
        self.v_array = []
Esempio n. 3
0
    def __init__(self, *args, **kwargs):
        BaseExchangeServerClient.__init__(self, *args, **kwargs)
        self._orderids = set([])
        self.positions = {
            'C98PHX': 0,
            'P98PHX': 0,
            'C99PHX': 0,
            'P99PHX': 0,
            'C100PHX': 0,
            'P100PHX': 0,
            'C101PHX': 0,
            'P101PHX': 0,
            'C102PHX': 0,
            'P102PHX': 0,
            'IDX#PHX': 0
        }

        self.deltas = {
            'C98PHX': 0,
            'P98PHX': 0,
            'C99PHX': 0,
            'P99PHX': 0,
            'C100PHX': 0,
            'P100PHX': 0,
            'C101PHX': 0,
            'P101PHX': 0,
            'C102PHX': 0,
            'P102PHX': 0,
            'IDX#PHX': 1
        }

        self.vegas = {
            'C98PHX': 0,
            'P98PHX': 0,
            'C99PHX': 0,
            'P99PHX': 0,
            'C100PHX': 0,
            'P100PHX': 0,
            'C101PHX': 0,
            'P101PHX': 0,
            'C102PHX': 0,
            'P102PHX': 0
        }

        self.delta_ptflo = 0
        self.vega_ptflo = 0
        self.start_time = time.time()
        self.net_exposure = 0

        self.bid_dict = {}
        self.ask_dict = {}
        self.mid_dict = {}
Esempio n. 4
0
    def __init__(self, *args, **kwargs):
        BaseExchangeServerClient.__init__(self, *args, **kwargs)
        self.open_orderids = set([])
        
        self._count = 0
        self._mid_market = []
        self._lastGuess = []
        self._lastMarket = []
        self._lastPolly = []
        #This is used to relate the symbol to the index of the arrays
        self._symbol_dict = {'K': 0,
                             'M': 1,
                             'N': 2,
                             'Q': 3,
                             'U': 4,
                             'V': 5}
        
        #some arbitrary price calculation. probably will do something w/ the standard deviation that makes it better
        self._max_wiggle =  6
        self._modify_wiggle=0.05
        self._each_wiggle=0.02
        self._quant = 4
        self._pnl_fix = 0
        self._dumpLim = 10
        self._dumped = False
        

        
        '''
        order_id_dict holds the ids for the limit orders around the calcualted theo
        reversion dict holds the ids for the orders that calculate the mean reversion
        _price_dict is not implemented but will hold the prices if needed
        '''
        self.order_id_dict = {}
        self.market_data = {}
        self.owned_shares = {}
        for key, _ in self._symbol_dict.items():
            self.order_id_dict[key + '_short'] = [(0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0)]
            self.order_id_dict[key + '_long'] = [(0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0)]
            self.market_data[key] = []
            self.owned_shares[key] = 0
            
        #This is used to calculated the exponential weights needed for the MA time series
        self._weights = []
        for x in range(0,29):
            self._weights.append(math.e**-x)
Esempio n. 5
0
    def __init__(self, *args, **kwargs):
        # Init BaseExchangeServerClient
        BaseExchangeServerClient.__init__(self, *args, **kwargs)

        self._orderids = set([])

        # Our future contract codes and pairs
        self.contract_list = ['K', 'M', 'N', 'Q', 'U', 'V']

        # redesign pair
        self.contract_pairs = [('K', 'M'), ('K', 'N'), ('K', 'Q'), ('K', 'U'), ('K', 'V'), \
                                ('M', 'N'), ('M', 'Q'), ('M', 'U'), ('M', 'V'), \
                                ('N', 'Q'), ('N', 'U'), ('N', 'V'), \
                                ('Q', 'U'), ('Q', 'V'), \
                                ('U', 'V')]

        # History Data

        self.hist_mid_price = {
            contract_code: None
            for contract_code in self.contract_list
        }

        # Record weights
        self.current_weights = {
            contract_code: 0
            for contract_code in self.contract_list
        }

        # Record contract status
        self.in_Long = {
            contract_pair: False
            for contract_pair in self.contract_pairs
        }
        self.in_Short = {
            contract_pair: False
            for contract_pair in self.contract_pairs
        }

        # Time Windows
        self.long_ma = 10
        self.short_ma = 5

        self.counter = 0
Esempio n. 6
0
    def __init__(self, *args, **kwargs):
        BaseExchangeServerClient.__init__(self, *args, **kwargs)

        self._bids = {
            "C98PHX": set(),
            "C99PHX": set(),
            "C100PHX": set(),
            "C101PHX": set(),
            "C102PHX": set(),
            "P98PHX": set(),
            "P99PHX": set(),
            "P100PHX": set(),
            "P101PHX": set(),
            "P102PHX": set(),
            "IDX#PHX": set()
        }
        self._asks = {
            "C98PHX": set(),
            "C99PHX": set(),
            "C100PHX": set(),
            "C101PHX": set(),
            "C102PHX": set(),
            "P98PHX": set(),
            "P99PHX": set(),
            "P100PHX": set(),
            "P101PHX": set(),
            "P102PHX": set(),
            "IDX#PHX": set()
        }
        self._quant = {
            "C98PHX": 0,
            "C99PHX": 0,
            "C100PHX": 0,
            "C101PHX": 0,
            "C102PHX": 0,
            "P98PHX": 0,
            "P99PHX": 0,
            "P100PHX": 0,
            "P101PHX": 0,
            "P102PHX": 0,
            "IDX#PHX": 0
        }
        self._filled = {}
Esempio n. 7
0
    def __init__(self, *args, **kwargs):
        BaseExchangeServerClient.__init__(self, *args, **kwargs)
        self.open_orderids = set([])
        self._count = 0
        self.k_array = []
        self.m_array = []
        self.n_array = []
        self.q_array = []
        self.u_array = []
        self.v_array = []
        #some arbitrary price calculation. probably will do something w/ the standard deviation that makes it better
        self._wiggle = .001

        #This is used to relate the symbol to the index of the arrays
        self._symbol_dict = {'K': 0, 'M': 1, 'N': 2, 'Q': 3, 'U': 4, 'V': 5}

        #order_id_dict holds the ids for the limit orders around the calcualted theo
        #reversion dict holds the ids for the orders that calculate the mean reversion
        #_price_dict is not implemented but will hold the prices if needed
        self.order_id_dict = {}
        self.reversion_dict = {}
        self.price_dict = {}
        for x in ['K', 'M', 'N', 'Q', 'U', 'V']:
            self.order_id_dict[x + '_short'] = 0
            self.order_id_dict[x + '_long'] = 0
            self.price_dict[x + '_short'] = 0
            self.price_dict[x + '_long'] = 0
            self.reversion_dict[x + '_short'] = 0
            self.reversion_dict[x + '_long'] = 0

        #This is used to calculated the exponential weights needed for the MA time series
        self._weights = []
        for x in range(0, 50):
            self._weights.append(math.e**-x)

        #This is used to know what amount of shares we have
        self.owned_shares = {}
        for x in ['K', 'M', 'N', 'Q', 'U', 'V']:
            self.owned_shares[x] = 0
Esempio n. 8
0
    def __init__(self, *args, **kwargs):
        BaseExchangeServerClient.__init__(self, *args, **kwargs)

        self.symbols = [
            "C98PHX", "C99PHX", "C100PHX", "C101PHX", "C102PHX", "P98PHX",
            "P99PHX", "P100PHX", "P101PHX", "P102PHX", "IDX#PHX"
        ]

        self.kernel = kvt.MarketMaker(
            10,  # straddle size
            10,  # max position size
            5,  # liquidity depth
            1,  # reprice threshold
            1.0)  # delta max

        self.mid_market_price = {}
        self.orders = {}
        self.portfolio = {}
        for sym in self.symbols:
            self.mid_market_price[sym] = 0
            self.orders[sym] = deque()
            self.portfolio[sym] = 0
    def __init__(self, *args, **kwargs):
        BaseExchangeServerClient.__init__(self, *args, **kwargs)

        self._orderids = set([])