Beispiel #1
0
        ComponentExport.__init__(self, cashier)

    @export
    @session_aware
    @schema("rpc/cashier.json#request_withdrawal")
    def request_withdrawal(self, username, ticker, address, amount):
        return self.cashier.request_withdrawal(username, ticker, address, amount)

if __name__ == '__main__':
    log.startLogging(sys.stdout)

    accountant = AccountantProxy("dealer",
            config.get("accountant", "cashier_export"),
            config.getint("accountant", "cashier_export_base_port"))

    session = db.make_session()
    bitcoin_conf = config.get("cashier", "bitcoin_conf")

    log.msg('connecting to bitcoin client')

    bitcoinrpc = {'BTC': BitcoinRpc(bitcoin_conf, 1)}
    compropago = Compropago(config.get("cashier", "compropago_key"))
    cold_wallet_period = config.getint("cashier", "cold_wallet_period")
    sendmail=Sendmail(config.get("administrator", "email"))
    minimum_confirmations = config.getint("cashier", "minimum_confirmations")
    alerts_proxy = AlertsProxy(config.get("alerts", "export"))
    bitgo_config = {'use_production': not config.getboolean("cashier", "testnet"),
                    'client_id': config.get("bitgo", "client_id"),
                    'client_secret': config.get("bitgo", "client_secret")}
    bitgo = BitGo(**bitgo_config)
    bitgo_private_key_file = config.get("cashier", "bitgo_private_key_file")
Beispiel #2
0
        d = self.process.ping()
        d.addCallbacks(self.got_ping, self.ping_error)
        d.addCallback(self.schedule_ping)

    def schedule_ping(self, event=None):
        reactor.callLater(self.step, self.ping)

    def run(self):
        log.msg("Watchdog %s starting" % self.name)
        self.schedule_ping()


if __name__ == "__main__":
    log.startLogging(sys.stdout)
    monitors = ["administrator", "cashier", "ledger", "webserver"]
    session = database.make_session()
    proxy = AlertsProxy(config.get("alerts", "export"))
    watchdogs = {}
    for name in monitors:
        watchdogs[name] = Watchdog(name, config.get("watchdog", name), proxy)
        watchdogs[name].run()

    num_accountants = config.getint("accountant", "num_procs")
    for i in range(num_accountants):
        name = "accountant_%d" % i
        watchdogs[name] = Watchdog(
            name,
            config.get("watchdog", "accountant") %
            (config.getint("watchdog", "accountant_base_port") + i), proxy)
        watchdogs[name].run()
Beispiel #3
0
                    if user.username not in self.low_margin_users:
                        self.low_margin_users[user.username] = datetime.datetime.utcnow()
                        self.email_user(user, self.cash_positions[user.username], low_margin, high_margin, severe=False)
                    result = "WARNING"
                else:
                    if user.username in self.low_margin_users:
                        del self.low_margin_users[user.username] # resolved
                    if user.username in self.bad_margin_users:
                        del self.bad_margin_users[user.username] # resolved
                    result = "OK"

                log.msg("%s: %s / %d %d %d" % (result, user.username, low_margin, high_margin,
                                                     self.cash_positions[user.username]))


if __name__ == "__main__":
    log.startLogging(sys.stdout)

    session = database.make_session()

    safe_price_subscriber = connect_subscriber(config.get("safe_price_forwarder", "zmq_backend_address"))
    safe_price_subscriber.subscribe('')
    sendmail = Sendmail(config.get("riskmanager", "from_email"))
    accountant = AccountantProxy("dealer",
                                 config.get("accountant", "riskmanager_export"),
                                 config.getint("accountant", "riskmanager_export_base_port"))

    riskmanager = RiskManager(session, sendmail, safe_price_subscriber, accountant)

    reactor.run()
Beispiel #4
0
    @export
    @session_aware
    @schema("rpc/cashier.json#request_withdrawal")
    def request_withdrawal(self, username, ticker, address, amount):
        return self.cashier.request_withdrawal(username, ticker, address,
                                               amount)


if __name__ == '__main__':
    log.startLogging(sys.stdout)

    accountant = AccountantProxy(
        "dealer", config.get("accountant", "cashier_export"),
        config.getint("accountant", "cashier_export_base_port"))

    session = db.make_session()
    bitcoin_conf = config.get("cashier", "bitcoin_conf")

    log.msg('connecting to bitcoin client')

    bitcoinrpc = {'BTC': BitcoinRpc(bitcoin_conf, 1)}
    compropago = Compropago(config.get("cashier", "compropago_key"))
    cold_wallet_period = config.getint("cashier", "cold_wallet_period")
    sendmail = Sendmail(config.get("administrator", "email"))
    minimum_confirmations = config.getint("cashier", "minimum_confirmations")
    alerts_proxy = AlertsProxy(config.get("alerts", "export"))
    bitgo_config = {
        'use_production': not config.getboolean("cashier", "testnet"),
        'client_id': config.get("bitgo", "client_id"),
        'client_secret': config.get("bitgo", "client_secret")
    }