Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
How to Print or Log Specific Factors and Values

In the attached algo, stocks are ranked using the following:

df['rank_long'] = df['pe_ratio'] * df['pb_ratio']

Can someone tell me how to print or log the following after each transaction?

  1. Stock symbol (currently showing up under 'Placing Order')
  2. "rank_long" value
  3. pe ratio
  4. pb ratio

Currently, the logs look like this:

2015-02-02rebalance:153INFOPlacing order: Equity(3450 [MNST])

I would like the logs to look like this (or similar as long as the data are shown):

2015-02-02rebalance:153INFOPlacing order: Equity(3450 [MNST]), rank_long=xxx, pe_ratio = xxx, pb_ratio = xxx

Edit: It looks like changing the ranking factors (pe ratio & pb ratio) do not have an impact on performance, so there must be a bust in the algo. If anyone could help a beginner out to get this working I'd appreciate it.

Thanks.

Troy

3 responses

Hi Troy,

This tutorial video on get fundamentals might be able to help you out with configuring your log statements as you described!

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Thanks Jamie. I will check it out.

Troy

You compute rank_long from pe_ratio and pb_ratio in the function rank_long, but you never call the function. Of course the ratios will have no impact on anything if you never use them.