Example #1
0
def main():
    session = database.make_session()
    try:
        print "WARNING: DO NOT RUN WHILE SPUTNIK IS RUNNING. SHUT EVERYTHING DOWN FIRST"
        leo = LowEarthOrbit(session)
        if len(sys.argv) == 1:
            try:
                while True:
                    leo.parse(raw_input("leo> "))
            except EOFError:
                pass
        else:
            leo.parse(" ".join(sys.argv[1:]))

        # Before committing run a sanity check on all contracts
        contracts = session.query(models.Contract)
        failures = [contract.ticker for contract in contracts if not contract.sanity_check]
        if len(failures):
            print "CONTRACTS FAILED SANITY CHECK"
            print failures
            session.rollback()
        else:
            session.commit()

    except Exception, e:
        print e
        session.rollback()
        raise e
Example #2
0
    def setUp(self):
        logging.basicConfig(
            format="%(asctime)s - %(levelname)s - %(funcName)s() %(lineno)d:\t %(message)s", level=logging.DEBUG
        )
        os.chdir(os.path.dirname(os.path.abspath(__file__)))
        fix_config()

        from sputnik import database, models

        self.session = database.make_session()

        import leo

        self.leo = leo.LowEarthOrbit(self.session)
        self.run_leo(db_init)
#

from sqlalchemy.orm.exc import NoResultFound
import sys
import os

sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../server"))
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../dist/config"))

from sputnik import database, models
from sputnik import txbitcoinrpc
import getpass
from sputnik import config
from twisted.internet import defer, reactor, task

db_session = database.make_session(username=getpass.getuser())
print config.get("cashier", "bitcoin_conf")
conn = txbitcoinrpc.BitcoinRpc(config.get("cashier", "bitcoin_conf"))

# conn.walletpassphrase('pass',10, dont_raise=True)
count = 0


def go():
    d = conn.keypoolrefill()

    def get_addresses(result):
        quantity = 100

        dl = defer.DeferredList([conn.getnewaddress() for i in range(quantity)])