Ejemplo n.º 1
0
 def __init__(self, config):
     if "service_account" in config:
         self.service_account = config["service_account"]
     else:
         self.service_account = service_account
     self.account = config["account"]
     cli_wallet = config["cli_wallet"]
     self.password = cli_wallet["wallet_unlock"]
     self.rpc = HTTPRPC(cli_wallet["host"], cli_wallet["port"],
                        cli_wallet["rpc_user"], cli_wallet["rpc_passwd"])
Ejemplo n.º 2
0
 def __init__(self, config):
     if "service_account" in config:
         self.service_account = config["service_account"]
     else:
         self.service_account = service_account
     self.account = config["account"]
     cli_wallet = config["cli_wallet"]
     self.password = cli_wallet["wallet_unlock"]
     if 'uri' in cli_wallet:
         uri = cli_wallet["uri"]
     else:
         uri = "http://%s:%s" % (cli_wallet["host"], cli_wallet["port"])
     self.rpc = HTTPRPC(uri)
Ejemplo n.º 3
0
 def __init__(self, config):
     self.cycle = 15  # run bots every 60 seconds
     self.isSim = False
     self.data = {
         "tradeinfo": {}, "watchdog": [0, 0], "rate_usd": {},
         "bill": 0.0, "profile": {}}
     self.account = config["account"]
     cli_wallet = config["cli_wallet"]
     self.password = cli_wallet["wallet_unlock"]
     self.rpc = HTTPRPC(
         cli_wallet["host"], cli_wallet["port"],
         cli_wallet["rpc_user"], cli_wallet["rpc_passwd"])
     self.custom = {}
     self.custom["addition_spread"] = config["addition_spread"]
     self.custom["threshold"] = config["threshold"]
     self.custom["price_factor"] = config["price_factor"]
     self.account_id = self.rpc.get_account(config["account"])["id"]
     self.trade_pusher = TradePusher(self.account_id, self.data)
     self.last_table = ""
Ejemplo n.º 4
0
                        pubkey = PublicKey(memo["from"], prefix=self.prefix)
                    else:
                        pubkey = PublicKey(memo["to"], prefix=self.prefix)
                    trx["memo"] = Memo.decode_memo(privkey, pubkey,
                                                   memo["nonce"],
                                                   memo["message"])
                except Exception:
                    trx["memo"] = None
            else:
                trx["nonce"] = None
                trx["memo"] = None

            if trx["from_id"] == self.account["id"]:
                self.onSent(trx)
            elif trx["to_id"] == self.account["id"]:
                self.onReceive(trx)


if __name__ == '__main__':
    import sys
    uri = ""
    if len(sys.argv) >= 2:
        uri = sys.argv[1]

    ws = TransferProtocol(uri)
    node_api = HTTPRPC(uri)
    ws.init_transfer_monitor(
        node_api, "BTS", "nathan",
        "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3")
    asyncio.get_event_loop().run_until_complete(ws.handler())