Esempio n. 1
0
 def get_trades_per_day(self,user):
      result = self.db.query("select DATE(trans_date) as date, count(id) as num_trades from transactions where user=('%s') group by DATE(trans_date)"%(user)+";");
      if result:
           l = []
           for i in range(len(result)):
                t = Date_transaction()
                t.set_date(result[i]['date'])
                t.set_num_trades(result[i]['num_trades'])
                l.append(t)
           return l
      else:
           return False
Esempio n. 2
0
     def select_algorithm_profit_per_day(self, user, algo_id):
          result = self.db.query("select UNIX_TIMESTAMP(DATE(trans_date))*1000 as date, sum(profit) as profit from transactions where user=('%s') and sold='1' and algo_id=('%s') group by DATE(trans_date)"%(user, algo_id)+";");

          if result:
               l = []
               for i in range(len(result)):
                    t = Date_transaction()
                    t.set_date(result[i]['date'])
                    t.set_profit(result[i]['profit'])
                    l.append(t)
               return l
          else:
               return False
Esempio n. 3
0
 def get_trades_per_day(self, user):
     result = self.db.query(
         "select DATE(trans_date) as date, count(id) as num_trades from transactions where user=('%s') group by DATE(trans_date)"
         % (user) + ";")
     if result:
         l = []
         for i in range(len(result)):
             t = Date_transaction()
             t.set_date(result[i]['date'])
             t.set_num_trades(result[i]['num_trades'])
             l.append(t)
         return l
     else:
         return False
Esempio n. 4
0
    def select_algorithm_profit_per_day(self, user, algo_id):
        result = self.db.query(
            "select UNIX_TIMESTAMP(DATE(trans_date))*1000 as date, sum(profit) as profit from transactions where user=('%s') and sold='1' and algo_id=('%s') group by DATE(trans_date)"
            % (user, algo_id) + ";")

        if result:
            l = []
            for i in range(len(result)):
                t = Date_transaction()
                t.set_date(result[i]['date'])
                t.set_profit(result[i]['profit'])
                l.append(t)
            return l
        else:
            return False