Exemple #1
0
 def insert_book(self,
                 id,
                 name,
                 description,
                 author_id=0,
                 category_id=0,
                 is_finish=0,
                 recommend_count=0):
     return self.db.execute(
         "INSERT INTO tb_book(id, name, description, author_id, category_id,is_finish,recommend_count,create_at) VALUES(%s,%s,%s,%s,%s,%s,%s,%s)",
         int(id), name, description, int(author_id), int(category_id),
         int(is_finish), int(recommend_count), unixtime())
Exemple #2
0
            trades = lib.tradeHistory(forceUpdate = True)
            all_bal = lib.returnCompleteBalances()

            if not lib.is_fake:
                os.system('clear')
            print("\033[0;0H")
            stats = lib.analyze(lib.tradeHistory('BTC_STRAT'), brief = True)
            anal.write("{} {}\n".format(stats['avgBuy'], stats['btc']))
        ctr += 1

    currency = currency_list[index]
    index = (index + 1) % mod 

    did_act = False
    if currency in next_act:
        if lib.unixtime() > next_act[currency]:
            del(next_act[currency])
        else:
            running.please_skip(currency, margin_buy=margin_buy, margin_sell=margin_sell, extra=int(next_act[currency] - lib.unixtime()))

    if not currency in next_act:
        #try:
        did_act = running.should_act(currency, margin_buy=margin_buy, margin_sell=margin_sell)
        """
        except:
            did_act = False
            lib.returnTicker(forceUpdate = True)
            lib.tradeHistory(forceUpdate = True)
        """

    if did_act:
Exemple #3
0
 def insert_chapter (self, id, title, sort_num, book_id, volume_id):
     _sql = u"INSERT INTO tb_chapters(id, title, sort_num, book_id, volume_id, create_at) VALUES(%s, '%s', %s, %s, %s, %s)" % (int(id), title, int(sort_num), int(book_id), int(volume_id), unixtime())
     #print _sql
     return self.db.execute(_sql)
Exemple #4
0
 def insert_volume (self, title, book_id):
     _sql = "INSERT INTO tb_volume(title,book_id,create_at) VALUES('%s',%s,%s)" % (title, book_id, unixtime())
     return self.db.execute(_sql)
Exemple #5
0
 def insert_author (self, name):
     _sql = "INSERT INTO tb_author(name,create_at) VALUES('%s',%s)" % (name, unixtime())
     return self.db.execute(_sql)
Exemple #6
0
 def insert_book (self, id, name, description, author_id=0, category_id=0, is_finish=0, recommend_count=0):
     return self.db.execute(
         "INSERT INTO tb_book(id, name, description, author_id, category_id,is_finish,recommend_count,create_at) VALUES(%s,%s,%s,%s,%s,%s,%s,%s)", int(id), name, description, int(author_id), int(category_id), int(is_finish), int(recommend_count), unixtime()
     )
Exemple #7
0
 def insert_chapter(self, id, title, sort_num, book_id, volume_id):
     _sql = u"INSERT INTO tb_chapters(id, title, sort_num, book_id, volume_id, create_at) VALUES(%s, '%s', %s, %s, %s, %s)" % (
         int(id), title, int(sort_num), int(book_id), int(volume_id),
         unixtime())
     #print _sql
     return self.db.execute(_sql)
Exemple #8
0
 def insert_volume(self, title, book_id):
     _sql = "INSERT INTO tb_volume(title,book_id,create_at) VALUES('%s',%s,%s)" % (
         title, book_id, unixtime())
     return self.db.execute(_sql)
Exemple #9
0
 def insert_author(self, name):
     _sql = "INSERT INTO tb_author(name,create_at) VALUES('%s',%s)" % (
         name, unixtime())
     return self.db.execute(_sql)