
Developing in Stockfighter with No Trading Experience - srpeck
http://www.kalzumeus.com/2015/10/30/developing-in-stockfighter-with-no-trading-experience/
======
darklajid
I have the utmost respect for Patrick and the team - and just read the same
thing via mail.

But - as someone that _loved_ Microcorruption and followed StarFighter from
day one, stalking the people on Twitter as to not miss the launch: That's not
for me.

The game right now - as this article, this mail shows - requires you to learn
about finance systems before you even start playing the game. It's a game
where the rule book is - from this pov - too long and already uninteresting.

Good luck, I'll sit this one out and would love to see a future expansion in
different directions. Or another Microcorruption, Stripe CTF etc.

~~~
MichaelGG
Interesting. I'm the opposite. I was sorta curious, so I started reading Flash
Boys. It became immediately obvious that A: the author is fucking clueless,
and B: I didn't know enough about how this system worked. The book called
"Dark Pools" was a bit better (mainly as a light history of electronic
trading). "Flash Boys: Not So Fast" was really fun, mainly because it
systematically trashes the author of Flash Boys.

It was interesting enough that I've picked up a few books on market
microstructure, that really get into the details. It's fascinating, not just
technically, but from a standpoint of looking at humans. It's odd to see how
such strange systems persisted for so long (like Patrick mentions in this
post, the crazy 1/8th spreads that were gamed). Or in "Dark Pools", they
discuss how some of these traders would call up Nasdaq wondering why a certain
trade did or didn't work how it did. And they'd find out all sorts of strange
rules. Which makes me wonder, wtf? Are Nasdaq's rules hidden? Or were people
doing this as a living just too lazy to read the specs? [1] I can only guess
how much easy money there was to be made 20 years ago.

I'm so looking forward to Stockfighter, enough that I started looking at FIX
and OUCH (OUCH looks far faster since there's ~no silly parsing - just copy
into a struct) just in case that's what they offered. It's too late for me to
actually work in finance (far smarter people with more experience in math and
compsci), but playing the game is still an option. (I've actually been
thinking of how we might run some fake exchanges, federated, as a game.)

Anyways, I guess to each his own. But I'm guessing I'm not the only one that
will find this scenario intriguing.

1: Even basic stuff, like market orders, are weird. Who the hell would ever
submit an order that's literally saying "Sell at any price, including $0"?
(Well I suppose now it's "current price minus circuit breaker limits".) Or
"buy at any price up to $MAX"? Sure, most of the time it works out fine, but
if you can't be bothered to come up with a limit, perhaps you shouldn't be
buying or selling?

~~~
SEJeff
FWIW: I used to work at the predecessor to Virtu Financial with Peter Kovac,
who wrote an excellent counter argument book to flash boys.

[http://www.amazon.com/Flash-Boys-Insiders-Perspective-
High-F...](http://www.amazon.com/Flash-Boys-Insiders-Perspective-High-
Frequency-ebook/dp/B00P0QI2M2)

He's one of the most honest and intelligent people I've ever had the pleasure
to work with in my entire career. He was at Madison Tyler while I was there
roughly 4 years until the Virtu merger (at which point many of us left).

~~~
gammarator
Here's a lengthy critique of the Kovac book alleging it misreads Lewis's
point:

[http://www.amazon.com/review/R28Y8AI4PIPYZ2/ref=cm_cr_dp_tit...](http://www.amazon.com/review/R28Y8AI4PIPYZ2/ref=cm_cr_dp_title?ie=UTF8&ASIN=B00P0QI2M2&channel=detail-
glance&nodeID=133140011&store=digital-text)

"Kovac misfires by supposing the "front-running" condemned in "Flash Boys"
refers to a particular kind of abuse, and not surprisingly it's the kind he
plans to refute. In common usage there are at least two meanings to the term.
One common meaning is as shorthand for "front-running demand," which is what
happens when someone tries to figure out whether your mutual fund or your
pension fund is buying or selling stock, realizes that it will change supply-
and-demand dynamics for the stock, affecting the price, and front-runs that
demand to profit.

Imagine if someone made a reasonable guess you needed milk, raced ahead of you
to the only store in town to buy up all the milk before you got there, and
then offered to sell you milk at a higher price than the store sold it to him;
this is one example of front-running demand, just as described in "Flash
Boys." (It's also called "trading ahead.") Another common meaning is "front-
running a customer order," a type of insider trading, where a stock broker
believes his own customer's order will change supply-and-demand and tries to
profit from that; this is what Kovac apparently intends to refute, and it has
nothing at all to do with "Flash Boys.""

~~~
tptacek
This is a review written by someone who, by their own (repeated) admission,
hasn't read past the introduction of the book; further, the premise of the
review is that Kovac doesn't know what he's talking about vis a vis trading,
which is something we know to be false.

~~~
SEJeff
Correct. Peter Kovac wrote the entire realtime risk and clearing system that
is now live at Virtu (formerly California Applied Trading Science which split
into EWT and Madison Tyler, which became Virtu. This is all public knowledge
if you dig deep enough). Again, the source is I worked with him for several
years.

------
jonknee
> These days the markets are decimalized — stocks trade in increments of a
> penny. (They are not allowed to trade in increments smaller than a penny, by
> federal regulation. This is unfortunate, because “the minimum spread is 0.01
> dollars” is not any more rational than “the minimum spread is 0.125 dollars”
> — if someone is willing to provide liquidity for cheaper, we should
> encourage that.)

This is not true, at least in the US. HFT has made sub-penny trades a pretty
common thing. Quotes are displayed in pennies, but using limit orders you
frequently see sub penny trades for highly liquid tickers (AAPL for example).

[http://blogs.reuters.com/ben-walsh/2013/11/18/do-stocks-
real...](http://blogs.reuters.com/ben-walsh/2013/11/18/do-stocks-really-trade-
for-fractions-of-a-penny-sort-of/)

------
tezza

      > "A level is simply a price. Why not call it a price? 
      > I have a sneaking suspicion Wall Street invented many of 
      > these words to give customers the impression “This is
      > all really, really difficult — pay us money and the 
      > complexity goes away.”)"
    

Its called a level because an order book has many different orders at
different prices and quantities. If you funge all the quantites at the same
price together you create a 'level', say 1100 shs of VODAFONE @ 107.5 . The
next 'level' may then be 17 shares of VODAFONE @ 108 followed by 5 shares @
110

\--

Another term for 'Level' is a trade term for what 'level' of market data you
are paying for.

Level 1 Market Data corresponds to trade and price data... Price, bid, ask,
trade price, trade quantity

Level 2 Market Data corresponds to when you want to know much more about what
is happening on the exchange. You want to know how many orders are on each
book and at what price/qty.

This is also commonly referred to as 'Depth of Book'

Dark Pools do not send out Level 2 data, while primrary exchanges do ( LSE,
NYSE )

~~~
MichaelGG
Any suggestions on what to read to get up on these details? I've started
"Trading and Exchanges", "Algorithmic Trading and DMA", and "Market
Microstructure in Practise". Does that sound like a good path?

~~~
hardikp
For US equities, nanex research articles
([http://www.nanex.net/NxResearch/ResearchPage/0/?sort_val=dat...](http://www.nanex.net/NxResearch/ResearchPage/0/?sort_val=date))
provide good insight into various aspects.

I haven't read any of the books you've mentioned. But, "Market Microstructure
in Practise" seems more relevant.

By the way, the overall trading landscape has changed rapidly over the past
few years and the pace of change continues to increase.

~~~
phyalow
Nanex is overhyped gibberish.

~~~
hardikp
You could be right (or wrong). But, if the point is to understand the market
microstructure and dynamics (rather than endorse their philosophy), in my
humble opinion, these articles do a good job there.

------
minimax
_The stock market is incredibly liquid: for any stock listed on an exchange,
you can buy almost any quantity and sell almost any quantity, at any time the
market is in session._

I think that sentence would make most professional equities traders chuckle. I
mean, it's true-ish for some of the big etfs and some of the highest volume
individual companies, but there are 8k+ listed symbols in the US and you can't
just go buying and selling "almost any quantity" of most of them. Nobody
really trades that way. Trading in size typically involves chopping a large
order into smaller orders that get managed by a trader or really a trader's
execution algorithm.

~~~
patio11
Yeah, should have said "relative to the expectations of a normal human."
Shopping a block trade is, I think, level two?

~~~
minimax
I'm not sure what exactly you mean by block (in terms of size), but let's say
you have a stock and the average number of shares at the inside (best) price
is X. If you are trying to trade 10X shares, you aren't just going to
aggressively trade through multiple price levels all at once to get the trade
done, and if you just place an order for 10X shares into the book you will
find that the price starts moving away from your order price pretty quickly.
For a high volume ETF like SPY, X can be thousands of shares, but for low
volume mid/small caps it may be only a few hundred shares, which is not
something I'd consider "incredibly liquid."

------
lordnacho
As someone who wrote the whole tech stack of a hedge fund, this looks really
interesting. The summary looks pretty good, though I've only skimmed it.

There's a lot of stuff in there for future games. Network stuff, low level
memory stuff, backoffice, a million FIX engines to write against, optimal
execution, distributed computing.

How long would a game take? And what other languages would you support?

~~~
BWStearns
> And what other languages would you support?

It seems like it's utterly language agnostic. Patrick has said a few times
that you could play entirely through curl if you really wanted to, or play
manually through the trading interface. I'm planning on using this as a first
"real[ish]" project for Haskell.

------
EFruit
I'd much rather use something like Stockfighter, but built around
experimentation; one that has no competition, and no recruiters looking over
your shoulder, scrutinizing your work.

I tried to build one-- and quickly found myself far out of my league. I wish
this article had been around back when I was trying to write it!

<plug shame="1">If anyone's interested, it's up on Github at
[https://github.com/Efruit/marqit](https://github.com/Efruit/marqit) .</plug>

I might take another swing at it if I can get through this article in one
piece.

~~~
tptacek
The non-competitive open-ended Stockfighter you're looking for is called
Stockfighter. :)

We will have way, way, way too many people noodling around with this to
scrutinize everyone's work. The linkage between the CTF and our recruiting
work will be largely automated, and entirely opt-in: nobody that works for us
is going to notice you until some automated thingy asks if you're on the
market, and you tell the automated thingy "yeah, I'm interested in being
recruited".

The _overwhelming majority_ of people noodling with our CTFs, including most
of the "best" players, will not be job candidates.

------
tptacek
Correction to Patrick: we do support FIX in ch1, but you have to write AVR
assembly to use it.

------
steveklabnik
Fantastic read, and a great introduction to the subject matter. Kudos!

I'm also really enjoying the position taken on OSS here:

    
    
      > I’d personally be very disappointed in an engineer who, in 2015, defaulted
      > to scratchbuilding their own clients for every API they consumed.
      > Starfighter loves OSS and the OSS culture. Go nuts.
    

Perfect.

------
zerr
I don't fully understand what's the main purpose of this "game" (edit:
regarding recruiting)?

1\. Is it just useful for getting noted by some companies and get invited to
interviews? So basically it is equivalent of sending them CV and/or contacting
relevant persons.

2\. Is it supposed to replace the tech interviews (which suck) completely? In
this case, yes, I can see the value of allocating significant time for these
games.

~~~
tptacek
I don't fully understand the purpose either. People just seem to love playing
CTF-style programming games, and we happen to really enjoy making them.

It is OK if they are not your cup of tea.

~~~
zerr
I meant with regard to recruiting, which is what your (new) company is about
(again, if I understand correctly :)).

~~~
tptacek
I literally lack the ability to form coherent sentences about our business
that don't somehow involve how to render a graph of AVR basic blocks in a
React web app, is how little we're thinking about how the game interacts with
recruiting right now.

We are going to get the CTF right, and then work from there to a sustainable
recruiting business. We should have done it the other way around, but we
didn't. :)

~~~
LoSboccacc
the idea is sound, however this is bungling together as requirements good at
programming + good at markets

I'm just wondering if and why those kind of people really need a jig :D

~~~
kbenson
Instead of "good at markets", I interpreted it as "good at understanding
complex systems". I never assumed the companies they would contact would be
entirely financially based, I think the idea is that if someone can figure
this out the should essentially be vetted (after a good in-person meeting) as
a good candidate for almost any project you want to throw at them.

To me, the stock-market aspect of this seems entirely because it's a large,
complex, distributed system that's not entirely theoretical (i.e. has been
real-world tested), can be modeled accurately enough in the game, and is
complex enough to provide for some real challenging problems. There are likely
quite a few candidates that could have been used instead of the stock market,
but the stock market might be the _ideal_ one in this case.

------
buzzdenver
I agree 1000% that the best way to learn something is to start with a problem
that interests you, and dive into it. The opposite way, where you start with a
technology that sounds interesting and new, and learn it for the sake of
knowing it never worked for me.

~~~
hodwik
I wish I could trade with you; I love learning stuff but it's not so much
about using it practically, as it is that I just want to understand it.

Unfortunately, for most stuff, at some point you simply must have a problem to
solve to progress further, and that's where I get derailed. I have a hard time
getting excited about the real-life problems, so I end up getting stuck in the
beginning stages of new pursuits. I'll read textbooks, I'll memorize syntax,
but I'm never drawn to getting my hands dirty.

What I like about this sort of games is that they provide targeted problems
for people who aren't naturally drawn to this stuff in practice.

------
mrdrozdov
Just had the realization that Starfighter believes there's a huge market for
the sort of talent matching they want to do in finance. Why else would they
pick this topic?

~~~
patio11
We're actually not terribly interested in finance qua finance. We're
interested in finance qua "it allows us to do _anything_ in engineering in a
fiction-consistent way, plugging into _anything_ else."

Networks. Compiler theory. Language design. Web APIs. Caching layers. Core
algorithms. Packet switch microcontrollers. FPGAs. CRUD apps. Big Data. Anti-
abuse tooling. Application security. Machine learning. Any topic you possibly
want to throw an engineer at, an investment bank is already throwing a team of
engineers at.

Our Chapter 1 release includes levels which have you jailbreak multiple chips
(AVR microcontrollers) on a custom handheld device given to minimally trusted
gophers to own up a stock exchange through their REST API. And that _isn 't
even a theoretical attack_.

Additional factors which tipped the scales include "finance has a default goal
function which is really easy to understand", "some subsets of financial work
are surprisingly easy to model" (like a stock exchange is), and "finance has
narrative choices which allow us to excite people without getting typecast as
A Video Game For People Who Played Dungeons and Dragons In High School" (which
is, for a variety of reasons, important to the team, including to me, the ex-
DM).

Other strong contenders for our first game were "Like Dwarf Fortress but with
code" (harder to build than a stock exchange; includes the word "dwarf") and
"a nuclear power plant" (slight problem: we know nothing about nuclear power
plants).

~~~
pavlov
_Any topic you possibly want to throw an engineer at, an investment bank is
already throwing a team of engineers at._

This comment makes me feel that I must live in an alternate universe of
software engineering. I've spent 99% of my career working on things that would
be of no interest to an investment bank: GUIs, graphics, video, audio, GPU
rendering, mobile platforms, CAD, content creation tools...

(It's not the first time I've had this feeling. At one point years ago, when I
had been doing professional programming for maybe 3 years, a friend and
colleague asked me a question about databases. I had to confess that I had
never worked on software that interfaced with one; that all my work
exclusively dealt with local files and network streams. He almost wouldn't
believe it.)

~~~
patio11
_I 've spent 99% of my career working on things that would be of no interest
to an investment bank:_

One of the many interesting conversations I've had over the last few months is
with a guy who leads a team of X00 developers out of one bank's 1X,000
developers, which does minimally GUIs, graphics, GPUs (for rendering and
simulation), mobile platforms, and content creation tools. His #1 problem
right now is that you are representative of many, many developers who don't
know that his sort of group exists. I think he'd describe his job as "We're
the thin edge of the wedge hitting the really _hard_ problems so that our
customers in the bank can focus development on the really _valuable_
problems."

(I don't know if I'm cleared to talk about them until contract negotiation
wraps. Sorry, not trying to be coy here. Take it on faith that many of the big
guys run shops which have those needs and more besides.)

~~~
pavlov
Huh, that's interesting. I certainly wouldn't have guessed that.

Now that I think about it, I have no idea what investment banks are really
like as work environments. The caricature in my mind is a rigid hierarchy
populated by career-minded sycophants who judge people based on the college
they attended; bosses that would be played by Alec Baldwin in fiction;
software stacks sold by Oracle salesmen on golf courses; senior architects who
manage via UML drawings; workdays that extend to 9pm just because; and for a
touch of fun, brokers who throw half-eaten lobsters at each other on Friday
nights.

In all, the kind of place that would have absolutely no interest in hiring me
and where I would never imagine working... Maybe my prejudices would need a
reality check.

~~~
lucozade
I think you're describing investment bankers circa 1995.

Tech in investment banks is full of, well, developers. I'm currently working
on stuff that has X0,000 cores, X00 GPUs (compute though not rendering), web
UI, large data aggregation and visualisation (around 1bn data points moving in
near real time). I don't do fpga work but I sit near some chaps that do.

In fairness, I haven't done any CAD or audio at a bank. However, I did design
sonar absorbing materials prior to working in finance and there's a surprising
amount of similarity in the engineering I did then and the statistical sims we
do now.

Oh, and lobster night is Tuesday night.

------
STRML
Markets are truly fascinating. However much you think you know, you don't know
as much as you could. The whole idea of Stockfigher really resonated with my
experience over the last year and a half. Markets are incredibly complex.

Around the time a large contract ended in Hong Kong, I was at a web
development conference for new programmers getting out of a bootcamp-style
program (8 weeks, program or die). They put me on a panel and asked me about
what it was like to be a freelance web dev.

At one point, a guy raises his hand and starts asking about equity deals. He
asks what it would take to get someone like me to work on a startup with him,
no cash. Now, the market's rough for that sort of thing if you want
experience. I told this guy that he would just "have to find some bozo who
believed in the idea so much, he'd be willing to give up salary in exchange
for massive risk. Who's going to do that?" We laughed a bit and moved on.

Well, I ate my hat: I'm that bozo. I was impressed with his knowledge, so I
joined up with him and another expert he wrangled. The two of them had an
impressive amount of cumulative experience not only in trading, but in writing
financial systems. We filled in each others' knowledge gaps perfectly. They
took the lead on the backend systems and I did the rest.

Cue months of finance training, seemingly endless numbers of commits (over
5000 between just the frontend and API alone, and that's only half the
system), and we quickly pushed out our first beta of BitMEX. It's our take on
a derivatives exchange with a much more finance-slanted perspective than our
peers. We did months of paper trading and went live November of last year
(we're almost to our first birthday!). In that time, we've explored many of
the very hard problems in finance (margin trading is incredibly complex), and
many more in UX (in short: finance is hard, making it simple for users is even
harder). And now we're trading nearly $10M/day and growing.

What's so great about today is that there are so many markets out there you
can play on, and so much code to learn from. If you try Stockfighter, I
commend you. I'd like to offer our simulation to the community - we run it at
[https://testnet.bitmex.com](https://testnet.bitmex.com), and a really simple
market making bot at [https://github.com/BitMEX/market-
maker](https://github.com/BitMEX/market-maker). In about 20 minutes you can be
up and running market making on our Testnet and trying out your strategies.

Yeah, it's not the most complex bot out there (and we forked it from an old
MtGox bot). It pretty much does the minimum possible to quote both sides of a
market. But it's a great building block for more complex strategies, and it
has all the parts you need, including Websocket hookups. Come grab me on
Freenode #bitmex-testnet if you want help with it.

I hope some of you give Stockfighter or our Testnet a try. Finance is a rabbit
hole, but it's worth learning about.

(tl;dr: Moved to Hong Kong, met some finance pros, wrote a ton of code, and
now am CTO of BitMEX, one of the top Bitcoin exchanges by volume. We have a
simulation market, it's worth trying out)

~~~
dikaiosune
I skimmed this, but it sounds interesting. Might I recommend a blog post
shared as a link instead of a TLDR comment buried on someone else's story?

------
TeMPOraL
I know next to nothing about stock markets, but reading 'patio11's description
made me think about two things:

\- Doesn't this ask/bid matching sound very, very much like barter?

\- If so, for the times when the market isn't liquid, couldn't they
introduce... money? You know, to abstract over barter.

(I know I'm asking idiot questions here, but I'd really appreciate someone
ELI5 my idiocy here.)

~~~
tomjen3
Well that is what they are doing, say you want to sell you stock in apple
because the new iPhone is crap. Well Apple doesn't pay dividends (i think
Microsoft is the only tech stock that does) so the only way anybody wants to
buy is if they think the stock will go up in the future, so you need to find
somebody who wants Apple stock more than they want the money. Well what if you
can't find somebody right now? That is where the makers come in and buy the
stock for a short while, hoping that they are then able to sell it shortly to
somebody else for a profit.

I think what is confusing you is that a grocery have one price for an item and
very rarely sold out, whereas as a stockmarket is more like a market: you are
dealing with multiple sellers and not guaranteed to be able to find what you
want and the price may depend on where you get it.

------
ninjakeyboard
I saw this email today - sounds like some cool play to me. There are both
trading problems as well as lower level challenges. Seems like there is
something for everyone. The idea that hits home is that it presents problems
which you may not know about in domains and technology areas that are not ones
that you work in so you get to flex yourself a bit in new ways.

------
finnh
bugfix - the sample order:

    
    
      {
      “symbol”: “BAR”,
      “venue”: “FOOEX”,
      “direction”: “buy”,
      “qty”: 20,
      “price”:  5100,
      “type”: “limit”,
      “account” : “OGB12345”, // your trading account (game gives you this)
      }
    

should read "qty": 100 to jive with the response ("originalQty": 100, 80
filled, etc).

------
MCRed
A fun programming challenge is building an open source platform or some other
software that scratches your own itches-- it's being a creator.

Solving arbitrary puzzles someone else has set in front of you, in order to
get a job, is not a fun programming challenge.

It's one engineer saying "I bet I can come up with something this guy won't be
able to do" and clueless companies and HR thinking they can "evaluate"
programmers by "how well" they do on these quizzes.

They will miss out on the best programmers because the best ones value their
time enough to create new things-- not solve "challenges".

Challenges are attempts to make you fail. They are not about learning about
the person.

If you have self respect, you will use Straighter as a filter to exclude
companies that are not worth working for (because if they use Starfighter, you
can guarantee their working environment is not conducive to a career where you
look forward to going to work every day.)

Starfighter should pivot into education. Then this work would be useful. Right
now it's corrosive to programming as a profession.

~~~
ncallaway
Here's a thought: If you're playing Stockfighter simply because you want a
job, you probably aren't the target audience for the game.

By that I mean, they have two different target audiences: companies who want
to hire people, and separately, developers that want to play their game. When
there is an overlap of those two groups where they can make a job connection,
then great.

I don't think the goal of this is to make it so that anyone who wants a new
job plays Stockfighter.

~~~
tptacek
Yes, this is exactly what we're doing.

------
MichaelGG
Patrick: If the REST URL has FOOEX and BAR, why is that info repeated in the
JSON body?

~~~
patio11
It's optional -- if you don't put them in, we do. The canonical
representations of any order has them in, otherwise you have no clue what is
going on.

~~~
MichaelGG
So why bother with putting them in the URL? Why not just have /submit and put
the details in the body where they belong?

------
KasianFranks
Contact me, I know a lot about what you're trying to do.

------
it_learnses
did you mean "model web developer" instead of "modal web developer" ?

~~~
tptacek
Modal as in the statistical mode.

