How to use the pywaves.Asset function in PyWaves

To help you get started, we’ve selected a few PyWaves examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wavesplatform / demo-python-trading-bot / SimpleBot.py View on Github external
try:
            self.log("Reading config file '{0}'".format(cfg_file))
            config = configparser.RawConfigParser()
            config.read(cfg_file)
            self.node = config.get('main', 'node')
            self.chain = config.get('main', 'network')
            self.matcher = config.get('main', 'matcher')
            self.order_fee = config.getint('main', 'order_fee')
            self.order_lifetime = config.getint('main', 'order_lifetime')

            self.private_key = config.get('account', 'private_key')
            self.amount_asset_id = config.get('market', 'amount_asset')
            self.amount_asset = pw.Asset(self.amount_asset_id)
            self.price_asset_id = config.get('market', 'price_asset')
            self.price_asset = pw.Asset(self.price_asset_id)
            self.price_step = config.getfloat('market', 'price_step')
        except OSError:
            self.log("Error reading config file")
            self.log("Exiting.")
            exit(1)
github wavesplatform / nanos-app-waves / python / ledger-waves.py View on Github external
binary_data += chr(8)
        # fee amount asset decimals
        binary_data += chr(8)

        # Tx info
        #
        # amount: 1
        # asset: 9gqcTyupiDWuogWhKv8G3EMwjMaobkw9Lpys4EY2F62t
        # from: 3PDCeakWckRvK5vVeJnCy1R2rE1utBcJMwt
        # to: 3PMpANFyKGBwzvv1UVk2KdN23fJZ8sXSVEK
        # attachment: privet
        # fee: 0.001
        # fee asset: WAVES
        some_transfer_bytes = build_transfer_bytes('4ovEU8YpbHTurwzw8CDZaCD7m6LpyMTC4nrJcgDHb4Jh',
                                                   pw.Address('3PMpANFyKGBwzvv1UVk2KdN23fJZ8sXSVEK'),
                                                   pw.Asset('9gqcTyupiDWuogWhKv8G3EMwjMaobkw9Lpys4EY2F62t'), 1,
                                                   'privet', timestamp = 1526477921829)
        input = raw_input(colors.fg.lightblue + "Please input message to sign (for example \"" + base58.b58encode(
            str(some_transfer_bytes)) + "\")> " + colors.reset)
        if len(input) == 0:
            binary_data += some_transfer_bytes
            print(colors.fg.lightgrey + "tx bytes:   " + base58.b58encode(str(some_transfer_bytes)))
        else:
            binary_data += base58.b58decode(input)
            print(colors.fg.lightgrey + "tx bytes:   " + base58.b58encode(str(input)))
        signature = None
        while (True):
            try:
                offset = 0
                while offset != len(binary_data):
                    if (len(binary_data) - offset) > CHUNK_SIZE:
                        chunk = binary_data[offset: offset + CHUNK_SIZE]
github wavesplatform / demo-python-trading-bot / SimpleBot.py View on Github external
def __init__(self):
        self.log_file = "bot.log"
        self.node = "https://nodes.wavesnodes.com"
        self.chain = "mainnet"
        self.matcher = "https://matcher.waves.exchange"
        self.order_fee = int(0.003 * 10 ** 8)
        self.order_lifetime = 29 * 86400  # 29 days
        self.private_key = ""
        self.amount_asset = pw.WAVES
        self.price_asset_id = "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS" # BTC
        self.price_asset = pw.Asset(self.price_asset_id)  
        self.price_step = 0.005
        self.min_amount = 1
        self.seconds_to_sleep = 15
github PyWaves / PyWaves / address.py View on Github external
data = json.dumps({
                "senderPublicKey": self.publicKey,
                "name": name,
                "quantity": quantity,
                "timestamp": timestamp,
                "description": description,
                "decimals": decimals,
                "reissuable": reissuable,
                "fee": txFee,
                "signature": signature
            })
            req = pywaves.wrapper('/assets/broadcast/issue', data)
            if pywaves.OFFLINE:
                return req
            else:
                return pywaves.Asset(req['assetId'])