def __updateOptionRow(self, irow):
     pos = self.dp.getOptionData()
     code = pos.getByHeader(irow, 'code')
     last_price = self.md.getLastprice(code)
     pos.setByHeader(irow, 'last_price', last_price)
     ###################################
     S = self.etf.getByHeader(0, 'last_price')
     K = pos.getByHeader(irow, 'strike')
     T = pos.getByHeader(irow, 'left_days')
     opt_type = pos.getByHeader(irow, 'type')
     #greeks
     stat = None
     if opt_type.lower() == 'call':
         stat = ANALYSER.getStatistics(S, K, T, last_price, True)
     elif opt_type.lower() == 'put':
         stat = ANALYSER.getStatistics(S, K, T, last_price, False)
     if stat:
         for header in Engine.STATISTICS_HEADERS:
             pos.setByHeader(irow, header, stat[header])
     #trade state
     float_profit = ANALYSER.getFloatProfit(
         pos.getByHeader(irow, 'dir'), pos.getByHeader(irow, 'lots'),
         pos.getByHeader(irow, 'open_price'), last_price,
         self.md.getOptionMultiplier())
     pos.setByHeader(irow, 'float_profit', float_profit)
     return
 def __updateOptionRow(self, irow):
     pos = self.dp.getOptionData()
     code = pos.getByHeader(irow, 'code')
     last_price = self.md.getLastprice(code)
     pos.setByHeader(irow, 'last_price', last_price)
     ###################################
     S = self.etf.getByHeader(0, 'last_price')
     K = pos.getByHeader(irow, 'strike')
     T = pos.getByHeader(irow, 'left_days')
     opt_type = pos.getByHeader(irow, 'type')
     #greeks
     stat = None
     if opt_type.lower() == 'call':
         stat = ANALYSER.getStatistics(S, K, T, last_price, True)
     elif opt_type.lower() == 'put':
         stat = ANALYSER.getStatistics(S, K, T, last_price, False)
     if stat:
         for header in Engine.STATISTICS_HEADERS:
             pos.setByHeader(irow, header, stat[header])
     #trade state
     float_profit = ANALYSER.getFloatProfit(pos.getByHeader(irow, 'dir'),
                                            pos.getByHeader(irow, 'lots'),
                                            pos.getByHeader(irow, 'open_price'),
                                            last_price, self.md.getOptionMultiplier())
     pos.setByHeader(irow, 'float_profit', float_profit)
     return
 def __updateStockRow(self, irow):
     pos = self.dp.getStockData()
     last_price = self.etf.getByHeader(0, 'last_price')
     float_profit = ANALYSER.getFloatProfit(
         pos.getByHeader(irow, 'dir'), pos.getByHeader(irow, 'lots'),
         pos.getByHeader(irow, 'open_price'), last_price,
         self.md.getStockMultiplier())
     pos.setByHeader(irow, 'last_price', last_price)
     pos.setByHeader(irow, 'float_profit', float_profit)
     return
 def __updateStockRow(self, irow):
     pos = self.dp.getStockData()
     last_price = self.etf.getByHeader(0, 'last_price')
     float_profit = ANALYSER.getFloatProfit(pos.getByHeader(irow, 'dir'),
                                            pos.getByHeader(irow, 'lots'),
                                            pos.getByHeader(irow, 'open_price'),
                                            last_price, self.md.getStockMultiplier())
     pos.setByHeader(irow, 'last_price', last_price)
     pos.setByHeader(irow, 'float_profit', float_profit)
     return