Пример #1
0
            trade = df_t[df_t['code'] == i]['trade'].values[0]
            self.df.ix[self.df[u'代码'] == i, u'当前价格'] = trade

            current_profit = (trade - self.df[self.df[u'代码'] == i][u'买入价格'].values[0]) / \
                             self.df[self.df[u'代码'] == i][u'买入价格'].values[0]

            self.df.ix[self.df[u'代码'] == i,
                       u'目前盈亏'] = round(current_profit * 100, 2)

        self.df.to_excel(self.name, encoding='utf-8')
        self.df.to_sql('tb_simulation', self.engine, if_exists='replace')
        ali_engine = get_engine('', False)
        self.df.to_sql('tb_simulation', ali_engine, if_exists='replace')
        df_str = self.df.to_html()
        sender_139('模拟盘 {}'.format(self.today), df_str, types='html')


def main():
    obj = Simulation()
    obj.caculation()


if __name__ == '__main__':
    if is_holiday():
        logger.info("Holidy")
        exit()
    logger.info("Start")

    main()
Пример #2
0
 def check_holiday(self):
     if is_holiday():
         logger.info("Holidy")
         exit(0)
     else:
         logger.info("Start")
Пример #3
0
 def check_holiday(self):
     if is_holiday():
         logger.info("Holidy")
         exit(0)
     else:
         logger.info("Start")
Пример #4
0
        if not x:
            return None

        if '%' in x:
            ration = 100
        else:
            ration =1

        x = re.sub('%','',x)
        try:
            ret = float(x)*ration
        except Exception as e:
            logger.error('转换失败{}'.format(e))
            ret = None

        return ret

#
def main():
    logger.info('Start')
    obj = Jisilu()
    obj.current_data()
    # obj.history_data()


if __name__ == '__main__':
    if is_holiday():
        logger.info("Holidy")
        # exit()
    main()