Hello,
I am having a difficult time writing what is suppose to be a simple algorithm. I cannot determine if it is me not understanding Python or do not have a grasp on properly using the API. Can anyone help me write it, I am a student trying to understand simple market behaviors.
What I want the algorithm to do is buy SPY five trading day before the ex-dividend date and sell it three days after the pay date. I want to buy an arbitrary amount, 5000 shares. These are the dates of interest:
Ex-dividend date Pay date
9/20/13 10/31/13
6/21/13 7/31/13
3/15/13 4/30/13
12/21/12 1/31/13
I would appreciate the help very much. I tried using the get_date() function to access a certain day, but I got errors. I'm going over Python because I believe my problems stem from here.
Thanks