Hello,
Please consider allowing some formatting in the log.info message and multiple items, like this:
log.info(stock, value, price, context.portfolio.cash)
and
log.info('Stk: %2d Value: %3d Price: %4d' % (stock, value, price))
Thanks,
JM
Hello,
Please consider allowing some formatting in the log.info message and multiple items, like this:
log.info(stock, value, price, context.portfolio.cash)
and
log.info('Stk: %2d Value: %3d Price: %4d' % (stock, value, price))
Thanks,
JM
I've been using the Python string format method:
log.info( 'Stk: {:.2f} Value: {:.3f} Price: {:.4f}'.format(stock, value, price))
Hello,
Great, thanks.
Can I suggest adding some examples to the documentation, so that newbies like myself pick up on that quickly?
Here are some examples:
In the initialize function
log.info(' SID-- Price-- Shares Value------- Order')
In handle_data fuction
log.info('{:>5} {:>7.3f} {:>6} {:> 12.3f} SELL'.format(stock, price, shares, value))
or
log.info('{:>5} {:>7.3f} {:>6} {:> 12.3f} BUY'.format(stock, price, shares, value))
Best regards,
JM