示例#1
0
def create_account():
    # Prepare for new account name
    data = suggest_brain_key()
    data["account_name"] = ACCOUNT_PREFIX + RandomString(length=12, chars="d")

    # Create account
    bts_obj = BitShares(node=BITSHARES_NODE,
                        keys=REGISTRAR["private_key"],
                        nobroadcast=NOBROADCAST,
                        bundle=False,
                        debug=True)
    account = bts_obj.create_account(account_name=data["account_name"],
                                     registrar=REGISTRAR["account_name"],
                                     referrer=REGISTRAR["account_name"],
                                     password=data["private_key"],
                                     storekeys=False)
    bts_obj.clear()

    print(" * Created new account: " + str(data))
    print(account)
    print()
示例#2
0
def buy(ordertype,
        base,
        price,
        amount,
        expiration=None,
        killfill=False,
        account=None,
        returnOrderId=False):
    from bitsharesbase.account import PasswordKey, PublicKey
    active_key = str(
        PasswordKey(account=MEMBER["account_name"],
                    password=MEMBER["password"],
                    role="active").get_private_key())
    bts_obj = BitShares(node=BITSHARES_NODE,
                        keys=active_key,
                        nobroadcast=NOBROADCAST)
    market = Market(base, bitshares_instance=bts_obj)
    order = market.buy(price, amount, expiration, killfill, account,
                       returnOrderId)
    print(" * Placed order: " + str(
        market.buy(price, amount, expiration, killfill, account,
                   returnOrderId)))
    bts_obj.clear()
    print()