Back to Posts
Listen to Thread

Hi,

Just a quick suggestion.

In some of my algorithms I've been trying to use logs for creating custom reports (like winning percentage, number of winning trades vs number of losing trades, etc).

It would be cool if there was a way we could define these things in the code, and then have a new tab at the side of the backtest for "Custom Reports" which was able to display my defined things in a variety of forms - which I could also define in the code - such as pie charts, bar charts, scatter diagrams etc.

It would make the information much easier to read than in the logs, enabling better glance-ability of information on how my algorithms are adding up, so I can make faster and better decisions in how to improve them.

Adam.

Hello Adam,

You may want to review the postings here: https://www.quantopian.com/posts/priority-plotting-and-universe-selection. My understanding is that the process is discovery --> backtesting --> live trading, with the present focus on fleshing out the backtesting and getting to live trading pronto, and then circling back to discovery (at least this is what I've been able to glean). I gather that they are sorting out which features will go into the discovery bucket and which will end up in the backtester.

They also need to provide functionality to like peoples posts in the forum ;)

Hi Adam,

If you are talking about thumb up/down type voting, my vote is a thumb down on that one. Much better to provide direct written feedback, code examples, etc. with technical content.

Grant

More like a button at the bottom of posts that says "thanks" when someone has been helpful on the forum... Maybe even like the karma/reputation systems on other forums :P

@Adam: Yep, we're currently working on this. Actually today I finished up the basic functionality to plot arbitrary time-series (or rather, the ability to record variables). However, this feature will at first be restricted to 1-D timeseries and line-plots (ultimately, of course, it would be preferable to have full plotting capabilities). One idea for the interface is the following:

def initialize(context):  
    record_variables('mavg)

def handle_data(context, data):  
    context.mavg = sid[23].mavg(5)  

And this will start plotting the values of mavg alongside the algo returns. How does that sound?

Thanks Thomas,

I'll stick my nose in again...hopefully Adam will chime in, too. Some questions:

  1. Will all of the variables be plotted on the same chart? If so, how will you handle the vertical scaling?
  2. What if we just want to record the variables and not plot them?
  3. Will this be a general feature, allowing us to record anything (e.g. prices) each time handle_data gets called?
  4. What is the data type (e.g. of context.mavg above)? Will a datetime stamp be stored, as well? Anything else?
  5. Could this new feature be used in place of the (slow) batch transform?

Grant

  1. Will all of the variables be plotted on the same chart? If so, how will you handle the vertical scaling?
    -- For the first iteration, probably yes. For vertical scaling there could be an option to plot this variable on a different y-axis and get auto-scaling.
  2. What if we just want to record the variables and not plot them?
    -- I suppose so, but since you can't download the output at this time I don't see how it'd benefit you.
  3. Will this be a general feature, allowing us to record anything (e.g. prices) each time handle_data gets called?
    -- Yes, that's the plan. Although there is a caveat currently in minute mode since we only display one data point per day. What the code currently does is snapshot the variable state at the end of the trading day. While that's not ideal it gives at least some way to plot in minute mode. In daily it would certainly record every state.
  4. What is the data type (e.g. of context.mavg above)? Will a datetime stamp be stored, as well? Anything else?
    -- We will assume it is aligned with the price you received at that time, so implicitly have the same timestamp. context.mavg in the above example is a float.
  5. Could this new feature be used in place of the (slow) batch transform?
    -- I don't really see how those two are related, but maybe I'm missing something? Certainly you could use this to plot the analysis you did with a batch_transform, e.g. plot how the z-score changes over time the gold-miner algo.

Thanks for the feedback,
Thomas

Thanks Thomas,

Seems that if you put multiple variables on the same chart along with the return, you'll need a different y-axis (e.g. on the right-hand side), and all of the variables will need to be auto-scaled to the same max y-axis value (e.g. 1), right? If so, you'll need to provide the individual scale factors in a table so that the user can calculate the actual values.

Take care,

Grant

Log in to reply to this thread.
Not a member? Sign up!