Back to Community
Newbie question: How do we output the transactions for Dividend and Stock split in logs

Sorry if this question is too lazy: I was checking and confirming the working of quantopian for corporate actions. Created a simple algo to buy apple shares in 2014 and check for the dividend (06-Feb-14 Ex; 13-Feb-14 paid) and stock split impact (1/7 on 09-Jun-14) that happened in 2014. I can confirm that Quantopian showed the impact in the Activity->Positions tab.
What I want to do is to see these transactions either in Activity->Transaction, Logs or Custom Data. Could you please tell me how to do this simple task? As I said, it is a lazy question from a newbie, but will save me a lot of time. Thanks.

Clone Algorithm
3
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
"""
This algorithm defines a long-only equal weight portfolio and 
rebalances it at a user-specified frequency.
"""

# Import the libraries we will use here
import datetime
import pandas as pd

def initialize(context):
    # In this example, we're looking at 2 ETFs for stocks and bonds. The algo always keeps 10% in cash.  
    context.security_list = symbols(
                           'AAPL' 
                         )
                                    
    # This variable is used to manage leverage
    context.weights = 1


    # Rebalance every day (or the first trading day if it's a holiday).
    # At 11AM ET, which is 1 hour and 30 minutes after market open.
    schedule_function(rebalance, 
                      date_rules.month_start(),
                      time_rules.market_open(hours = 1, minutes = 30))

def rebalance(context, data):

    # Do the rebalance. Loop through each of the stocks and order to
    # the target percentage.  If already at the target, this command 
    # doesn't do anything. A future improvement could be to set rebalance
    # thresholds.
    month_number = get_datetime().date().month
    if month_number not in [1,7]:
        return
    for sec in context.security_list:
        if data.can_trade(sec):
            order_target_percent(sec, context.weights)

    # Get the current exchange time, in the exchange timezone 
    exchange_time = get_datetime('US/Eastern')
    log.info("Rebalanced to target portfolio weights at %s" % str(exchange_time))
There was a runtime error.