Live data from Hacker News

Case study: Algorithmic trading with Go

polygon.io

171–180 of 311 posts

Re: Case study: Algorithmic trading with Go

#171

Earlier quoted context omitted.

I don’t have time to reply properly until a few hours from now. In the meantime what I can say very simply in the hope that someone else knowledgeable can contribute earlier. It’s simply an empirical fact that the costs of intermediation to the system are the lowest they have ever been. The US and other global electronic markets are incredibly efficient and deliver unmatched liquidity, information efficiency, and the…

Your dismissals seem to be very biased and you’re not allowing the possibility of being wrong. As a practitioner who worked on the systems you’re citing I can tell you’re wrong on many fronts. As far as costs are concerned, you’re not answering the most relevant question that applies to most users of this forum: costs to retail traders, and are only tackling the institutional side of things. Nobody from retail concer…

I’m a practitioner and no, the costs to retail traders is included and analyzed.

The most vocal critics of HFT are very often previously practitioners who are upset when their strategies and models becomes obsolete are are outwitted by even more efficient operators.

Give any example of where you are going?

I will say RegNMS and NBBO regulations are actually preventing even further efficiencies. Dark pools and off exchange matching or internalization are complex topic that are easy to misunderstand. There are absolutely bad actors to be found in the system. This is true in any system. But on aggregate the system is continuously reducing costs and improving efficiency.

Intermediation costs are a friction on the real economy and capital markets and they will always exist, but on aggregate they are dropping for all users, institutional and retail.

In regards to party line, it’s absurd, you can simply take the aggregate income, not profits, of all the top HFT operators, their income is their counterparties costs, and when attributed per market, this number is continuously dropping on aggregate. If you look at an individual firm, you can see it’s income growing, however that will come from 2 dimensions, either expanding their operations to other markets, or taking share from a competitor. However if you sum all profits across all HFT operators on a single market complex, say US equities, on longer economic timescales, this number is continuously dropping. Obviously during periods of market volatility this number can increase, but the trend over years, will be always downward.

HFT is a absolutely brutally competitive industry.

I’d be interested in what you saw working on such systems seem “wrong” or “unfair”. My guess is you don’t understand that all is fair in war and that includes HFT, as long as it is legal.

Re: Case study: Algorithmic trading with Go

#173
I caught the algotrading bug recently and I've been wanting to backtest a couple of strategies involving ETFs. Right now I'm only looking at the open, close, daily high/low. The problem however is that you have to account for dividends and splits, which I'm not sure how to do (Admittedly, I haven't looked too deeply into it). Any advice on how to do that? Let's say I want to backtest some strategy involving UPRO; would I be fine just using yahoo finance historical prices as is, or would I have to manipulate it in some way? Also, what would be the ideal backtesting software/service to use?

Re: Case study: Algorithmic trading with Go

#174

This is professional gambling. Embrace (weak form) market efficiency. Why do you think mutual funds have never generated profit in the history of their existence?

I'm naive but as far as I know mutual funds are risk-averse and by consequence their profits are lower, if any.

Re: Case study: Algorithmic trading with Go

#175
post #124
post #106

Earlier quoted context omitted.

Hey, I write this. I did program this in Go. The reason is that it's my go to programming language. Using it is actually a disadvantage in that the industry uses C++ and Python but that's just what I know how to program in. I wasn't trying to be misleading. Go does work really well for taking in data, doing something with it, and then calling a remote API. So, it actually works really well but if you wanted to get a…

Go is great for network heavy apps like algo trading! I used Go to write trading algos that would find small windows of triangle arbitrages in crypto exchanges. Made me some money but the risk of a big loss made me stop pursing crypto trade and it required too much time and attention. It's a full time job from my experience. Reasons I could lose big at any given time if I scaled up the stakes: - Exchanges temporarily…

It's a full time job bc your competitors are full time quant traders :)

Re: Case study: Algorithmic trading with Go

#176
post #125

Earlier quoted context omitted.

As a counter I had some VW shares I couldn’t access for 6 months because they were moved to another exchange. 20 calls to the broker to find out what had even happened. Eventually I was able to sell them.

Well, your first problem was investing in VW (KIDDING!). But seriously, I usually stick to self-serve stock purchases. Was this a situation where you had to contact a human to make the buy in the first place, or was it that you bought it yourself, then VW changed up their infrastructure and inadvertently locked you out? Shitty situation either way.

Self serve, one one of those trading sites. No human contact, until the site wouldn’t let me trade the shares. I think the exchange changed up things and I am buying from another country so communication issues etc.

Re: Case study: Algorithmic trading with Go

#177

Earlier quoted context omitted.

As a counter I had some VW shares I couldn’t access for 6 months because they were moved to another exchange. 20 calls to the broker to find out what had even happened. Eventually I was able to sell them.

What do you mean « moved to another exchange » ? Shares are not held at an exchange.

No idea. I don’t know technically what is meant by this.

Re: Case study: Algorithmic trading with Go

#178

I worked in HFT for a while. I find the whole space fascinating. I'm glad OP found similar thrills. "This aspect, the platform itself, seems to be often overlooked in most discussions. Many conversations revolve around strategies (mean reversion, trend following, linear regression, etc.), and backtesting, without fully addressing the practical mechanics or logistics of strategy implementation, particularly in the con…

Seems more pointless than crypto to be honest.

And like crypto, feel free to ignore it instead of making things you don’t like illegal.

Re: Case study: Algorithmic trading with Go

#179

Earlier quoted context omitted.

Your dismissals seem to be very biased and you’re not allowing the possibility of being wrong. As a practitioner who worked on the systems you’re citing I can tell you’re wrong on many fronts. As far as costs are concerned, you’re not answering the most relevant question that applies to most users of this forum: costs to retail traders, and are only tackling the institutional side of things. Nobody from retail concer…

I’m a practitioner and no, the costs to retail traders is included and analyzed. The most vocal critics of HFT are very often previously practitioners who are upset when their strategies and models becomes obsolete are are outwitted by even more efficient operators. Give any example of where you are going? I will say RegNMS and NBBO regulations are actually preventing even further efficiencies. Dark pools and off exc…

I am not disagreeing with you that the costs are dropping and that participants benefit from that. In fact I agree. Your projection that I find the field unfair is also unfounded. I love the field and find it immensely interesting. I just don’t take mythology surrounding it at face value because I often found it to be a) outdated b) full of mythology but no hard data.

What I am saying is that the thesis that the costs are dropping due to HFT style strategies has not been proven. Majority of the HFT tend to be market makers which tend to help with liquidity but not all are. I agree that liquidity helps offload or acquire large stakes.

As for NBBO and the effect a regulation has on markets you seem to be extremely US centric but if you go across the ocean and find out that Europe has no concept of NBBO at all, and that a retail person trading experience is equivalent for getting a different price on Amazon depending on which web browser they use you could imagine how that would make an average retail person feel.

Another example of the regulation is trying to move a large stake outside regular hours when NMS is suspended. Why do you think OTC block trades are pre-arranged at a fixed price? You can even look them up in relevant reporting facilities.

As for dark pools, ATS and internalizers there’s nothing difficult about them. I don’t think you’re doing anyone any favors by obfuscating an extremely simple concepts. Those market participants with their specific mechanics that are learnable. What’s complex is how to devise strategies and how to rely on the liquidity sources to get your desired fills and desired rates. You’re describing bread and butter of trading at an institutional level and the fact it seems difficult can maybe be attributed to the fact that it is opaque, doesn’t enjoy public communities, e.g. very little blog posts exist on the subject and the knowledge is sort of centralized to a specialized corners of the industry. But it is learnable without great difficulty if you have access to the resources.

What’s surprising to me is that a lot of people can talk about abstract concepts in computer science and then don’t connect facts that bridge into a separate discipline. As an example I could refer to consistency that people love to rave about but somehow forget the concept the moment capital market is introduced.

And yes, I’m familiar with the no trade theorem and relevant academic concepts but they are all models that often don’t translate to real life due to extremely limiting assumptions that don’t enjoy any connection to reality. I think it’s a problem with the community in this particular industry to take academic market models at face value. Often you will find that looking at a model carefully with assumptions that mirror real world, your performance gets better.

Re: Case study: Algorithmic trading with Go

#180
post #158

When developing an automatic trading system the following aspects are important: - Data feeds and data ingestion. It can be a fairly independent component which collects data from different sources (might be even discussion forums) making it available to other components in some uniform format - Feature generation. The source data is rarely used in its original form for decision making and having good (informative) f…

Hey, thanks. Yeah, I agree with you. That's an oversight on my end. I'll tell you here though. I'm just using go routines and channels to talk between them and then a giant mutex for locking. That's basically it. So, as new data comes in, it builds aggregates (tick based candlesticks) as needed, this then triggers the the BUY logic loop on that new data, if something is detected, that triggers a IB API order. It is d…

Also, what's your approach to risk management?

For example:

1. Do you have anything that limits the size of a single trade or position?

2. How do you measure and manage overall volatility/risk/VAR to your portfolio?

3. What kind of safeguards do you have to avoid catastrophic bugs? (For reference, see Knight capital and how a single bug brought down the entire company: https://www.henricodolfing.com/2019/06/project-failure-case-...) Given how fast your system trades, I imagine it must be difficult to visually spot these errors. (You did mention paper trading, but I wonder if you have anything else you want to mention)

Thanks so much for sharing your knowledge publicly. It's very much appreciated!

Post reply on HN