Example #1
0
        # announce new order, replacing the old order
        return [], [neworders[0]]

    def on_tx_confirmed(self, cjorder, confirmations, txid):
        if cjorder.cj_addr in self.tx_unconfirm_timestamp:
            confirm_time = int(
                time.time()) - self.tx_unconfirm_timestamp[cjorder.cj_addr]
        else:
            confirm_time = 0
        timestamp = datetime.datetime.now().strftime("%Y/%m/%d %H:%M:%S")
        self.log_statement([
            timestamp, cjorder.cj_amount,
            len(cjorder.utxos),
            sum([av['value'] for av in cjorder.utxos.values()]),
            cjorder.real_cjfee, cjorder.real_cjfee - cjorder.txfee,
            round(confirm_time / 60.0, 2), ''
        ])
        return self.on_tx_unconfirmed(cjorder, txid, None)


if __name__ == "__main__":
    ygmain(YieldGeneratorRandomize,
           txfee=txfee,
           cjfee_a=cjfee_a,
           cjfee_r=cjfee_r,
           ordertype=ordertype,
           nickserv_password='',
           minsize=minsize,
           gaplimit=gaplimit)
    print('done')
        oldorder = self.orderlist[0] if len(self.orderlist) > 0 else None
        neworders = self.create_my_orders()
        if len(neworders) == 0:
            return [0], []  # cancel old order
        # oldorder may not exist when this is called from on_tx_confirmed
        if oldorder:
            if oldorder['maxsize'] == neworders[0]['maxsize']:
                return [], []  # change nothing
        # announce new order, replacing the old order
        return [], [neworders[0]]

    def on_tx_confirmed(self, cjorder, confirmations, txid):
        if cjorder.cj_addr in self.tx_unconfirm_timestamp:
            confirm_time = int(time.time()) - self.tx_unconfirm_timestamp[
                cjorder.cj_addr]
        else:
            confirm_time = 0
        timestamp = datetime.datetime.now().strftime("%Y/%m/%d %H:%M:%S")
        self.log_statement([timestamp, cjorder.cj_amount, len(
            cjorder.utxos), sum([av['value'] for av in cjorder.utxos.values(
            )]), cjorder.real_cjfee, cjorder.real_cjfee - cjorder.txfee, round(
                confirm_time / 60.0, 2), ''])
        return self.on_tx_unconfirmed(cjorder, txid, None)

if __name__ == "__main__":
    ygmain(YieldGeneratorBasic, txfee=txfee, cjfee_a=cjfee_a,
           cjfee_r=cjfee_r, ordertype=ordertype,
           nickserv_password=nickserv_password,
           minsize=minsize, mix_levels=mix_levels)
    print('done')
        # announce new order, replacing the old order
        return [], [neworders[0]]

    def on_tx_confirmed(self, cjorder, confirmations, txid):
        if cjorder.cj_addr in self.tx_unconfirm_timestamp:
            confirm_time = int(
                time.time()) - self.tx_unconfirm_timestamp[cjorder.cj_addr]
        else:
            confirm_time = 0
        timestamp = datetime.datetime.now().strftime("%Y/%m/%d %H:%M:%S")
        self.log_statement([
            timestamp, cjorder.cj_amount,
            len(cjorder.utxos),
            sum([av['value'] for av in cjorder.utxos.values()]),
            cjorder.real_cjfee, cjorder.real_cjfee - cjorder.txfee,
            round(confirm_time / 60.0, 2), ''
        ])
        return self.on_tx_unconfirmed(cjorder, txid, None)


if __name__ == "__main__":
    ygmain(YieldGeneratorBasic,
           txfee=txfee,
           cjfee_a=cjfee_a,
           cjfee_r=cjfee_r,
           ordertype=ordertype,
           nickserv_password=nickserv_password,
           minsize=minsize,
           mix_levels=mix_levels)
    print('done')
Example #4
0
        # announce new order, replacing the old order
        return [], [neworders[0]]

    def on_tx_confirmed(self, cjorder, confirmations, txid):
        if cjorder.cj_addr in self.tx_unconfirm_timestamp:
            confirm_time = int(
                time.time()) - self.tx_unconfirm_timestamp[cjorder.cj_addr]
        else:
            confirm_time = 0
        timestamp = datetime.datetime.now().strftime("%Y/%m/%d %H:%M:%S")
        self.log_statement([
            timestamp, cjorder.cj_amount,
            len(cjorder.utxos),
            sum([av['value'] for av in cjorder.utxos.values()]),
            cjorder.real_cjfee, cjorder.real_cjfee - cjorder.txfee,
            round(confirm_time / 60.0, 2), ''
        ])
        return self.on_tx_unconfirmed(cjorder, txid, None)


if __name__ == "__main__":
    ygmain(YieldGeneratorBasic,
           txfee=txfee,
           cjfee_a=cjfee_a,
           cjfee_r=cjfee_r,
           ordertype=ordertype,
           nickserv_password=nickserv_password,
           minsize=max_minsize,
           gaplimit=gaplimit)
    print('done')
Example #5
0
            return [0], []  # cancel old order
        # oldorder may not exist when this is called from on_tx_confirmed
        # (this happens when we just spent from the max mixdepth and so had
        # to cancel the order).
        if oldorder:
            if oldorder['maxsize'] == neworders[0]['maxsize']:
                return [], []  # change nothing
        # announce new order, replacing the old order
        return [], [neworders[0]]

    def on_tx_confirmed(self, cjorder, confirmations, txid):
        if cjorder.cj_addr in self.tx_unconfirm_timestamp:
            confirm_time = int(time.time()) - self.tx_unconfirm_timestamp[
                cjorder.cj_addr]
        else:
            confirm_time = 0
        timestamp = datetime.datetime.now().strftime("%Y/%m/%d %H:%M:%S")
        self.log_statement([timestamp, cjorder.cj_amount, len(
            cjorder.utxos), sum([av['value'] for av in cjorder.utxos.values(
            )]), cjorder.real_cjfee, cjorder.real_cjfee - cjorder.txfee, round(
                confirm_time / 60.0, 2), ''])
        return self.on_tx_unconfirmed(cjorder, txid, None)


if __name__ == "__main__":
    ygmain(YieldGeneratorPrivEnhance, txfee=txfee,
           cjfee_a=cjfee_a, cjfee_r=cjfee_r,
           ordertype=ordertype, nickserv_password='',
           minsize=min_minsize, gaplimit=gaplimit)
    print('done')
Example #6
0
        return [], [neworders[0]]

    def on_tx_confirmed(self, cjorder, confirmations, txid):
        if cjorder.cj_addr in self.tx_unconfirm_timestamp:
            confirm_time = int(
                time.time()) - self.tx_unconfirm_timestamp[cjorder.cj_addr]
        else:
            confirm_time = 0
        timestamp = datetime.datetime.now().strftime("%Y/%m/%d %H:%M:%S")
        self.log_statement([
            timestamp, cjorder.cj_amount,
            len(cjorder.utxos),
            sum([av['value'] for av in cjorder.utxos.values()]),
            cjorder.real_cjfee, cjorder.real_cjfee - cjorder.txfee,
            round(confirm_time / 60.0, 2), ''
        ])
        return self.on_tx_unconfirmed(cjorder, txid, None)


if __name__ == "__main__":
    ygmain(YieldGeneratorPrivEnhance,
           txfee=txfee,
           cjfee_a=cjfee_a,
           cjfee_r=cjfee_r,
           ordertype=ordertype,
           nickserv_password=nickserv_password,
           minsize=minsize,
           mix_levels=mix_levels,
           gaplimit=gaplimit)
    print('done')