Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Trade record

Hi evrybody,
I'm a nooby in the quantopian community, so please indulgent you will be :)

Is it possible to record transaction and call them to code a strategy based on if trade win or lose ?

Thanks

4 responses

+1

Or more simpliest, which is the fonction to call the trade history ?

There isn't a 'built in' way to get trade history. One needs store the orders manually. All the order methods return an order ID. Add this to a dictionary or other data structure to capture all your orders. You will need to then look at each order to determine if it was filled and at what price and what the commissions were. The documentation is here https://www.quantopian.com/help#api-orderobj . Depending upon what you are trying to do, you could also look at the portfolio object for current positions. see https://www.quantopian.com/help#api-portfolio .

What exactly are you trying to do? There may be other simpler ways?

Hope that helps.

Would http://quantopian.com/posts/track-orders help you get started there guerin? Just drop that big code block from Jan 14 into your algo at the end of initialize() to give it a try. One caviat, since order_optimal_portfolio fills more immediately, some adjustments may be necessary but if not using Optimize it should be ok.