QuantConnect/lean-cli

How to turn on print in Python?

Closed this issue · 1 comments

I just test the simplest case by using main.py like:

from AlgorithmImports import *
from pdb import set_trace as bp

class TestPanda(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2013, 10, 7) # Set Start Date
self.SetEndDate(2013, 10, 11) # Set End Date
self.SetCash(100000) # Set Strategy Cash
self.AddEquity("SPY", Resolution.Minute)

def OnData(self, data):
    """OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
        Arguments:
            data: Slice object keyed by symbol containing the stock data
    """
    print("++++++++++++++++++++++++++++++++++++++++++++")
    if not self.Portfolio.Invested:
        self.SetHoldings("SPY", 1)
        self.Debug("Purchased Stock")

Why the "++++++++++++++++++++++++++++++++++++++++++++" never show up?
Of course my purpose is to print some data values instead of ++.
Could you please help on how to make print work on your platform?

Hey @avatarstones!
self.Debug/Log should do the trick, for more details and information please visit our documentation https://www.quantconnect.com/docs/v2/