

Show HN: Quantblocks - Backtest your trading strategies - afarquhar
http://www.quantblocks.com
We think backtesting is too difficult, this is our attempt to make it much easier and more fun - let us know what you think!
======
arturadib
It is really too bad folks keep pushing technical trading platforms to the
public. The promise of quick money to be made in a sea of billions of dollars
might seem innocuous, but it's (a) bad for the market and (b) bad for society.

It's bad for the market because collectively, the buying and selling of shares
based on anything other than company fundamentals (earnings, cash flow,
projected growth, etc) distorts the price of the company. Unfortunately,
because of our hunger to make money fast, there are too many of us (including
large hedge-funds) playing this game, and the effects on price movement are
very real. And when prices no longer reflect the company fundamentals, all
sorts of bad things happen: Management is pressured to take extraordinary
actions just to mitigate the market situation (stock splits/reverse-splits,
stock buy-backs, accounting tricks, etc), employees freak out and quit, long-
term investors get nervous, potentially fruitful M&As fail to happen, etc.

(The argument that technical/high-frequency trading improves the liquidity of
the market is the biggest bullshit, cop-out answer ever: The only people that
benefit from this type of instant liquidity are short-term, short-sighted
traders ... such as the very people who advocate this type of trading, and not
long-term _investors_!).

As for the societal cost, technical trading educates and perpetuates the myth
that the stock market is a big gambling house, and not a means to become an
_owner_ of a company. To paraphrase Warren Buffett, every time you think about
buying stock you should think of it the same way as if you were buying a mom-
and-pop shop, like a pizza place. Is the price you're paying roughly
equivalent to - or better than - how much you'd expect to make by pocketing
the profits of the shop over the lifetime of the business?

I hate to leave completely negative feedback, so at least I'll give that this
tool looks spiffy.

UPDATE: It seems like I'm getting a lot of responses from traders here.
Already answered some, can't answer them all. Please sleep over these comments
and think about what you could be doing with your time. Life's short.

~~~
cynicalkane
Liquidity is the reason you can click a button on E-Trade and get your trades
almost instantly, for between zero and a few more pennies than what traders
would pay, plus a $9.99 commission. This was absolutely not the case before
computer trading and electronic markets.

The "good old days" of human traders where when you'd pay fifty bucks plus one
percent to a broker who would almost certainly front-run your trades, and the
best spreads were at least 1/8. Nowdays the worst that could happen is an HFT
might, perfectly legally, place an order a split second faster and extract
fractions of a penny as they narrow the spread for everyone. Please forgive me
if I don't consider this a disaster for investors, hedgers, mutual funds, and
other consumers of markets that they can quickly execute orders close to the
market price.

~~~
arturadib
> _Liquidity is the reason you can click a button on E-Trade and get your
> trades almost instantly_

I personally don't care that my trade happens in a second or a minute because
I'm a long-term investor - someone who wants to become a company owner, as I
explained above, and not yet another hacker who couldn't care less about the
long-term health of the company I'm buying.

My point is that if folks care about liquidity on the order of seconds/sub-
seconds, they are themselves falling into the short-term trading BS (and
consequently continuously distorting company prices).

Please stop perpetuating this insanity. Here's a timely article by Mark Cuban
fresh out of the oven to help clarify my point:

[http://blogmaverick.com/2012/09/21/what-business-is-wall-
str...](http://blogmaverick.com/2012/09/21/what-business-is-wall-street-in-3/)

~~~
Permit
Mark Cuban bemoans the good old days like any technical trader before they
were beaten out by computers. He doesn't advocate trading on fundamentals. The
battle cry against high frequency tradings seems to come primarily from
individuals who were previously successful in specialist trading.

Here he talks about how he bought a stock, watched it climb then shorted it
and celebrated its bankruptcy: <http://blogmaverick.com/2008/09/08/talking-
stocks-and-money/>

But yes, speak to us from the moral high ground. Cuban simply rode what
essentially amounted to a pump-n-dump. He wasn't doing the promotion, but he
sure as hell wasn't in it for the long term growth of the underlying company.

Here's a fantastic quote from Mr. Cuban: "What about fundamentals?
Fundamentals is a word invented by sellers to find buyers.

Price-earnings ratios, price-sales, the present value of future cash flows,
pick one. Fundamentals are merely metrics created to help stockbrokers sell
stocks, and to give buyers reassurance when buying stocks. Even how profits
are calculated is manipulated to give confidence to buyers."

------
dunster
If you find Quantblocks interesting, you should also look at Quantopian.
(www.quantopian.com)

We're geared a bit more towards programmers. Rather than use blocks, our
members develop their algorithms in Python. We have an in-browser IDE with a
lot of smart auto-completion.

A few of our nifty features: * free access to 10 years of by-minute historical
data for all US stocks * the writer of the algorithm owns the algorithm *
batteries included - all of your favorite Python math and science packages
including Pandas and NumPy * a robust backtester that models slippage,
commissions, risk metrics, and more

We also have a community of quants and programmers who like talking about this
kind of stuff. People share code, give advice, ask questions, etc.

Full disclosure: I work for Quantopian!

Happy hacking,

Dan Dunn

~~~
jnewell
Great work Dan, it is totally what I would be looking for when backtesting and
strategy development. Do you mind sharing what js framework you used on the
client side?

~~~
dunster
We wrote a bunch, and used a bunch, so there is no straight answer. A short
list: highcharts for charting, jquery and underscore for the glue, crossfilter
for data filtering, bootstrap for components, codemirror for the IDE,
handlebars for templates, markdown for markdown, prettifier for code
highlighting, and the list goes on.

------
etrain
The signup/confirm/login metaphor is really tired and annoying. Don't give me
two screens of meaningless text, show me what your product does and let me
interact with it before making me sign up. For example, open the strategy
builder window up to anyone, but make me sign up before I can save my
strategies.

On the product itself - security specific rules are fine but you're missing
the point of backtesting and automated trading. The ability to spot patterns
across any security (or perhaps in an industry) is the key here. I wish there
were some way to specify this. I realize it's v1, but your rules are too
simple for most traders.

Finally - you should call out that your market data is EOD. You should also
offer VWAP (I know Xignite offers it) as a reasonable alternative for prices
you "could have gotten" as a retail investor.

Also, the IP thing scares me, and I wouldn't use the service until you change
it.

------
sycren
Looking at the terms & conditions, any algorithms that the users create become
the intellectual property of Quantblocks. Is this just a tool to help users or
is it a tool for the company to source the best algorithms?

~~~
kevinpet
Upvoted for importance, but I note that you are actually only granting them a
perpetual worldwide fully paid-up irrevocable license to them.

------
adg001
A cautionary note on backtesting (ie, assessing how trading strategies would
have performed over a historical period in time).

If an a posteriori probability distribution is a good fit for historical
events, it doesn't mean in any way it is going to fit future data points. It
may or may not.

Hence, use backtesting with care while trading.

~~~
theorique
Past performance may not be a guarantee of future performance, but it's all
we've got to work with.

~~~
adg001
Actually, this is not accurate. Before relying on our models, we get also the
opportunity to validate them by checking at what extent they successfully
predicts future data points.

Simply for the next t-time periods let the model give the user an estimate of
the future prices/rates, together with an estimate of how accurate the model
expects these predictions to be. This would allow the user to build confidence
in the algorithm strategy she/he came up with, before employing it on the open
market.

~~~
theorique
I mean it in the naive sense - we can observe the past but not the future. It
definitely makes sense to paper trade a strategy and see its predictiveness in
real time.

------
farnja
Hey! This is very cool, very fast. One thing I would suggest is the ability to
specify a list of securities rather than a single security. In my experience,
if you're going to test a general heuristic for trading, you're going to want
to test it across as broad of a spectrum as possible to determine if it really
has some predictive abilities. Obviously, this requires a lot more
computational power if you're applying your rules to everything in the Russell
3000 rather than just a single security. The results would then be the
composite of all trades across the securities.

------
crntaylor
This is kind of neat. It would be even better if it let you work with the
returns of each stock, rather than just with the price. In my experience most
technical strategies work better, and are more stable, when they work with
data in return space rather than price space.

~~~
startuprob
Thanks for the feedback, that's definitely something we've been looking at.
This is our initial feature-set that we're using to collect usage-statistics.
If you have any other feedback, please feel free to let us know.

------
ukoki
This is fantastic. Love the clean, straightforward interface. However I have a
feeling that anyone knowledgeable enough to profit from this is probably
already heavily invested in another system for doing these calculations and/or
feel the rules system isn't flexible enough. One thing you could do is to
implement sharing. ie, have a list of "top performing strategies measured from
date of creation". Then let users subscribe to other users' "proven"
strategies for a fee - you take half and the author takes half - this could be
an alternative way to monetize the site as well attract the kind of people who
make a living doing this - ie the kind of people you want talking about your
product.

~~~
startuprob
Thanks for the great feedback. Do you think people would be too protective of
their strategies to participate though?

~~~
ukoki
Possibly. If you integrate with a trading platform you could always let other
users subscribe to a strategy without knowing what the strategy is (eg they
only know it's gained X% vs the S&P 500 in the last few months, the author's
profile and that 5000 other users have 5MM invested in this strategy). However
I have a feeling that a) the money from commissions and b) the feeling of
being at the top of a list will compel a lot of people to share their
strategies - people blog about their stock picks constantly. Also I'd love to
see some left-field data about these companies eg: Google search volume,
Wikipedia edits/day, mentions on Twitter, press releases, sentiment analysis
of news articles etc...

~~~
mdupenois
It's funny that you mention it because, as Rob said, we've been playing with
the idea of adding a competitive edge, but the commissions is a cool idea. We
were also considering a kind of achievements approach as well as a leaderboard
but want to try and keep the idea of it as a tool as opposed to a toy.

Love the data idea, in fact surplus of data is already a bit of an issue;
we're running out of screen real-estate.

~~~
ukoki
of course - the alternative is to not share anything. With the data you have
on your users, once you can isolate users who consistently come up with
strategies that consistently make money after their creation date - well, you
might as well set up a hedge fund on the side and give the product away for
free.

~~~
mdupenois
Hah, yeah, unfortunately the legal team at the incubator we're in suggests we
might not survive too long as a company if we go down that route :)

~~~
ukoki
haha fair enough - thinking about it there's all kinds of nefarious ways you
could use the data. Looking at your product a bit more, this might be
complicating things a little and it's going to hammer your database but I'd
love the ability to fit variables to a strategy - eg I want a strategy like
"IF X day moving sample average for GOOG is better than Y day moving sample
average for GOOG buy ELSE sell" But I don't really know the best X and Y, so
I'd like to leave those as variables and have the software find the optimum
values based on historical data.

~~~
afarquhar
we've all been salivating about the potential for an 'Optimise' button. It
would be really cool, it has a few wrinkles though, e.g. there might not be a
unique maximum solution, so how do you choose the best one? Once there are a
few variable involved it may be a job for a genetic algo, but it would have to
be in the background. All food for thought ;-)

~~~
ukoki
Here's how I'd do it: Don't let the variable be the stock itself because
otherwise your search space will be too big... limit the number of stocks you
can optimise on and constrict it to variables like "moving average duration".
That way you can load the stock data onto the client side and do the
processing there (presumably you're already doing this for your graphs anyway)
- kick it off with a few generations of pretty loose genetic algorithm then
when you get near your time limit switch to simulated annealing with the best
handful of results to narrow down the answer as fast as possible. Keep it
quick, say 2 seconds tops. Then what you can do is give the client a
confidence rating so you can say something like "Found the following result
with 89% confidence. Click here to perform a longer search for higher
accuracy". Work out your confidence rating based on how bumpy the ride was.

------
espinchi
Very neat.

Do you guys have plans to add support for Forex trading too?

And, even if one of the strong points is "no coding required". Do you foresee
at some point to let advanced users write trading strategies in some type of
programming language?

------
mswen
How granular is the data that you backtest against? Daily, Hourly, Minute or
tick data?

I subscribed to another similar service for several years but one thing I
always wished they would add was more granular data than daily.

~~~
afarquhar
Currently it's daily. One of the possible future extensions is into intra-day
but it brings a whole load of extra technical problems. Honestly the problems
look really fun, things like keeping the backtest running relatively fast,
caching the large amounts of extra data and the added complexity of intra-day
strategies. However at the moment we need more data on how people want to use
it as that's a pretty big outlay on development time.

------
mikecsh
Couple of observations:

1) The leading x days from the moving averages on the default strategy are
charted at 0 when they should be null and not visible on the chart.

2) If I mouse over the 20 day moving average block and change it to a sell
block, then click run, my charts disappear into loading bars and I get a
warning message up. However, there is no indication to an uninformed user what
they've done wrong, why it's wrong, or how to fix it. This could use a bit of
work.

This is very similar to an iPad app I've been developing - I like it a lot,
you've done a good job!

~~~
mdupenois
1) Just pushed an update to fix that, thanks for pointing it out.

2) Syntax checking has been a big discussion point for us, we would love to be
able to limit people to only valid blocks but also didn't want to have a giant
block of validation javascript to deal with the drag and drop on the blocks.
As for error messages, you're totally right; they're massively lacking.
Difficulty is that we keep changing the way we're storing rules as we learn
more about what users want to do, given that we didn't want to have to build a
proper syntax parser until we had a more stable concept of how they'd be
structured.

Out of interest, what sort of error message would be useful? As in, how
technical e.g. "I don't understand how to if moving_avg > buy" or "There is an
error at 'if moving_avg > buy' returns: Nil expected: boolean"

~~~
mikecsh
My app is slightly different and uses a patch panel style of interface rather
than linear blocks. Every time the system is changed, the layout is parsed
into code and any invalid paths are coloured red to show

a) where the problem originates b) which blocks are affected by the problem

Additionally there is a crude type system that prevents the wrong type of
signal being passed to a block - e.g. a buy/sell datatype cannot be passed
into a block which expects numerical time series data. I would say that you
should _prevent_ users from entering rules which make no sense as far as is
possible..

I guess it depends how technical your users are. I'm attempting to stay away
from terms such as nil or boolean, so I would go for something like your first
example, but with more information, perhaps like:

"I don't know how to follow the rule "if moving_avg > buy" _because_ xyz"
which sounds friendly and non-technical but hopefully xyz will help them
understand why it doesn't work and learn from their mistake.

------
s_henry_paulson
I built something similar for my own personal use, so it's very interesting to
see something similar polished for mass consumption.

The only thing I'm confused about is what you get in the Pro version..

"3 Months of Unlimited Access to Every Area of QuantBlocks"

How is the user supposed to know what "every area" is? How could anyone expect
to know what they get with a subscription? Most importantly, how could they
know if a particular symbol would be available in the pro version, what about
futures, forex, etc?

~~~
startuprob
So what if we said "3 Months of Unlimited Access to Every Daily Upgrade" ??

We're doing daily agile upgrades so we're trying to communicate that they'll
get access not only to ALL of the global equities data, but also all of the
updates that we make in terms of ability to save strategies, indicators, etc.

~~~
mikecsh
It might just be me, but I find it confusing that the upgrade statement says
"a one-time payment of $39" and then the first checkbox says "3 months of
access".

Does this mean I pay $39 every quarter to continue access? In which case why
is it a one-time payment?

~~~
mdupenois
Hacker news has throttled Rob's replying (too fast), he says:

Thanks for the great feedback. We've just pushed an update that tries to
clarify by removing "One time payment" and removing the "every area of
Quantblocks" language.

Thoughts?

~~~
mikecsh
That seems much clearer to me now! :)

------
paddy_m
Nice polished UI. Good to see some integration in the finance space. A couple
of years ago I was working on something similar idea.

One of the things we did was backtest a couple of strategies for hold with
entry points of "Jim Cramer" recommended this stock on this day.

What are your backgrounds.

Ping me if you want to talk more.

------
Dzidas
If you really want quant stuff, then use R, Octave||Matlab or even Excel. MA,
RSI test are available on Internet and works with all browser. By the way - it
does work well with my Chrome and you should move a message about supported
browsers on the first page or before I fill registration form, not after.

------
steamfarmer
I like the idea of the site, but only having 5 stocks available to test
against doesn't allow me to get comfortable enough with the platform to pony
up for a paid account.

Additionally, the choices you've made for inclusion could be more diverse.
Where is SPY, SQQQ, GLD, etc?

------
kevinpet
I'd really like to be able to model the effects of rebalancing to a static or
tactical asset allocation, but it seems that the only strategies that matter
to the technical camp is thresholds based on trailing n days moving average.

------
tixocloud
Great job! Everything is really smooth. As a fellow developer who's interested
in finance, I would love to discuss (if you don't mind) about your approach
and effort.

------
dollar
Never received a confirmation email. No delivery attempt in the mail server
log.

------
greendestiny
Looks cool, can I ask where you sourced the historical data from?

~~~
startuprob
We're using Xignite's API right now. It's super-simple to integrate with.

~~~
mikecsh
Why did you choose that over something like Yahoo! Finance or Google?

~~~
afarquhar
yeah that caught us out - we found that even though the data is freely
available from those sources, you're not allowed to include that data in a
commercial app :-(

~~~
mikecsh
Oh really? That's interesting - does that apply even if it's not distributed
_with_ the commercial app? I'm sure I've used trading platforms before which
use Yahoo...

~~~
afarquhar
Our understanding of the Yahoo/google T&Cs was that we couldn't aim to profit
from their data (<http://finance.yahoo.com/badges/tos>). We may be being
overcautious but we didn't want to risk getting into trouble ;-)

------
annon
Volume data would be nice.

------
azmenthe
So judging from the the screenshots... Buy Apple? Yea that would of totally
worked. Now for any other stocks, probably not. Also you can see it's less
than the simple buy and hold.

Seriously I don't know why people even try trading in their free time.

Now, that being said, I'll take a bet against anyone who thinks they can find
a profitable trading strategy using this product :D

~~~
solutionyogi
Relax. The tool lets you create a strategy and back-test it. It is selling the
fact that you can do this without coding, it is not trying to sell you 'Long -
AAPL' strategy.

