Example #1
0
    def OnGetMarketPrices(self, event):
        message, response, exception = self.SplitEventResponse(event)

        if not response:
            if exception:
                self.LogMessages(exception)
            return

        marketComp = self.marketCache[message.marketTuple]
        compPerc = float(self.m_sliderCompensate.GetValue()) / 100.0
        ticksAway = 0 if not self.compTicksAway else self.compTicksAwayCount
        marketComp.updateMarketPrices(response.marketPrices, compPerc, self.compIndex,
                                      ticksAway=ticksAway)

        if self.bfModulesActive or self.recordModule or self.excelModActive:
            clone = marketComp.clone()
            if self.recordModule:
                self.recordModule.passMessage(clone)
            for bfModule in self.bfModules.itervalues():
                bfModule.passMessage(clone)
            if self.excelModActive and not self.excelModPaused:
                excelMsg = Message(marketComp=clone)
                excelMsg.workbooks = self.workbooks
                excelMsg.sheets = self.sheets
                self.excelModule.passMessage(excelMsg)

        self.UpdateMarket(message.marketTuple)
        self.UpdateMarketPrices(message.marketTuple)
        self.UpdateMarketProfitAndLoss(message.marketTuple)
        self.UpdateMUBetsCompensations(message.marketTuple)
        self.StopBetCheck()