Ejemplo n.º 1
0
    if DEBUG:
        if notifier:
            notifier.notify(
                "No change needed in portfolio -- " + str(money_maker.__calculate_portfolio_value__(current_portfolio))
            )
        print "Done!"
    sys.exit(0)


# Let's run those transactions
if DEBUG:
    print "Transactions to run:"
    pp.pprint(transactions)

if not dry_run:
    broker.run_transactions(transactions)
    if recorder:
        # Record the original portfolio
        recorder.write_portfolio(current_portfolio, money_maker.__calculate_portfolio_value__(current_portfolio))
        # Record the new portfolio
        new_portfolio = broker.get_portfolio()
        recorder.write_portfolio(new_portfolio, money_maker.__calculate_portfolio_value__(new_portfolio))
        # Record the transactions that were carried out
        recorder.write_transactions(transactions)

    if notifier:
        notifier.notify(
            "Done rebalancing portfolio. New value: "
            + str(money_maker.__calculate_portfolio_value__(new_portfolio))
            + " "
            + base_currency
Ejemplo n.º 2
0
            notifier.notify(
              'No change needed in portfolio -- ' \
              + str(
                money_maker.__calculate_portfolio_value__(current_portfolio)
              )
            )
        print "Done!"
    sys.exit(0)

# Let's run those transactions
if DEBUG:
    print "Transactions to run:"
    pp.pprint(transactions)

if not dry_run:
    broker.run_transactions(transactions)
    if recorder:
        # Record the original portfolio
        recorder.write_portfolio(
            current_portfolio,
            money_maker.__calculate_portfolio_value__(current_portfolio))
        # Record the new portfolio
        new_portfolio = broker.get_portfolio()
        recorder.write_portfolio(
            new_portfolio,
            money_maker.__calculate_portfolio_value__(new_portfolio))
        # Record the transactions that were carried out
        recorder.write_transactions(transactions)

    if notifier:
        notifier.notify(