Live data from Hacker News

Show HN: Trade stocks from the command line with no commission

gitlab.com

151–160 of 170 posts

Re: Show HN: Trade stocks from the command line with no commission

#151
post #52

Earlier quoted context omitted.

Since you’re not from US, what trading platforms do you use? I haven’t found any with free commissions and public APIs in the EU. Well, except for Interactive Brokers.

I'm in Australia, so the choices here are also a bit limited. Also, I'm less interested in equities. In the CFD space, my shortlisting technique now is basically "do you offer cTrader", because as mentioned above, this means they have a FIX endpoint. Broker offerings here seem a few "paradigm shifts" behind the US. Zero commissions are unheard of last I checked. Also, if you approach some brokers here and ask for an…

    > Broker offerings here seem a few "paradigm shifts"
    > behind the US. Zero commissions are unheard of last
    > I checked.
A US-style zero-commission model is not viable in the Australian landscape. The root of this is due to regulatory differences, rather than actions by the brokers.

A key to understanding the US system is something called Regulation National Market System (RegNMS). Loosely, if you are filling an order for someone, it must be at a price that is at least as good as the best price available on any US market at that time. [Anecdotally, if the NYSE receives an order, and there is a better price available for the same stock on Nasdaq at the same time, NYSE can't fill it at their inferior price.]

This creates a hyper-competitive single market. At any one time, you can know the bid/ask spread for any stock, nationally. And, it's a tight spread.

Market makers compete here. But a market maker would prefer to interact with retail orders. Because what a typical retail participant cares about is getting an immediate execution at the best price currently in the market, in order to make a long-term investment.

So a market sprung up: market-makers pay brokers to send these benign orders to them directly, without going through the public market. The market maker fills these order at a price that satisfies RegNMS. [Some of them might even distinguish themselves by giving the consumer a better price than they would have got on the public market. Your broker might send you a report with your trade saying how much "price improvement" you got compared to what you would have got at the same time on the public market.]

The reason the trade is "zero commission" is because the market maker is paying your broker for the privilege of interacting with you directly, because you don't have a view on where the market is going to be in five seconds' time.

Australia has not developed anything equivalent to RegNMS. Without that, there is no foundation for the zero-commission trades (there is no national best price to protect consumers with). In Australia, the typical situation is retail orders being sent directly to the book on the ASX (a pseudo-monopoly exchange), where they are directly interacting with the most sophisticated houses.

If you google, you can find an ASIC paper trumpeting that Payment for Order Flow has been banned. In my view, the real story is a lack of innovation by Australia's regulators.

Re: Show HN: Trade stocks from the command line with no commission

#152

Earlier quoted context omitted.

Do you have any reference on `legit factor stats`? I do not understand how leverage will be beneficial. Leverage will also multiply the potential downside risk after all? I would like to understand more how the trading cost would make up for it on average.

> I do not understand how leverage will be beneficial. Same here, if I understood the grandparent they were saying you lose 0.04% on every trade (from spread) and "in a year" that is 10% (250 trades?). If you have a strategy that has expected returns of x bips per trade then you make an expected x-4 and with leverage 4 * (x - 4). Both have the same "sign", so if x-4 is expected positive, leverage just makes it higher…

I was just reading their docs [1], and I got two things wrong above: - Schwab's overnight interest rate is actually ~1.8 bips. Alpaca's is even lower at 3.75% annual which translates into ~1 bip / day - If you liquidate stock the same day, you pay no interest

[1] https://alpaca.markets/docs/trading-on-alpaca/margin-and-sho...

Re: Show HN: Trade stocks from the command line with no commission

#153

Earlier quoted context omitted.

Do you have any reference on `legit factor stats`? I do not understand how leverage will be beneficial. Leverage will also multiply the potential downside risk after all? I would like to understand more how the trading cost would make up for it on average.

> I do not understand how leverage will be beneficial. Same here, if I understood the grandparent they were saying you lose 0.04% on every trade (from spread) and "in a year" that is 10% (250 trades?). If you have a strategy that has expected returns of x bips per trade then you make an expected x-4 and with leverage 4 * (x - 4). Both have the same "sign", so if x-4 is expected positive, leverage just makes it higher…

Well you have 504 trades approx, but you're buying in and selling out, so you're paying the cost of spread once per day (252 trading days in a year).

Let's say you have have a strategy that has 7% return and 3% volatility. That's a pretty fucking amazing strategy. So you lever up to 4x and now you have 28% return and 12% vol. With your spread tax, you now have 18% return and 12% vol. Using their 2x leverage, you'll have a 14% and a 6% vol. So while your Sharpe ratio will be lower, your max return will be higher. And since you can't eat risk-adjusted returns, the tradeoff could very well be worth it.

Re: Show HN: Trade stocks from the command line with no commission

#154

Beginner question on a related topic for those of you more knowledgeable than me: Is there a way to get access to the order books on Nasdaq or other exchanges? I'm working on a script that can run stock trading algorithms (and hopefully see some profit). My first trading experience was with crypto on GDAX (now Coinbase Pro). The order book on GDAX is basically available via their API. I've been looking at various sto…

I could have sworn yahoo finance or some other stock/finance site had order book available ( though it may have been a delayed version ). But I can't find it, maybe they shut it down or maybe I'm imagining things. If you have a brokerage account, it might have it depending on your account level/type. Else you would have to pay for it.

Re: Show HN: Trade stocks from the command line with no commission

#155

Beginner question on a related topic for those of you more knowledgeable than me: Is there a way to get access to the order books on Nasdaq or other exchanges? I'm working on a script that can run stock trading algorithms (and hopefully see some profit). My first trading experience was with crypto on GDAX (now Coinbase Pro). The order book on GDAX is basically available via their API. I've been looking at various sto…

Check out interactive brokers. You have to pay for the market feeds but it’s all available via API. It’s a completely horrible, painful API, but it’s the only way I found to get the data as a hobbyist.

There’s a process where you certify that you are a non-professional trader and they give you access to the data feeds for a reasonable price.

I’m working on a similar project, in case you’re interested in swapping notes (contact info in profile)

Re: Show HN: Trade stocks from the command line with no commission

#156

(Disclaimer that I'm working on an open source FIX engine in Lisp.) This is a really cool project! But alas I couldn't use it as I'm not in the US, and I don't trade with Alpaca. And I feel like this plays into a negative trend I'm seeing. The retail brokerage market right now is treading on similar 'mistakes' in institutional markets 15ish years ago. Proprietary APIs were prolific, and therefore increased switching…

I have implemented FIX for a living for a few years. It’s fragmented beyond belief. You can have different standards for different parts of the same brokerage. You have to do separate conformance tests for different asset classes at the same (big, well known, reputable) broker. The proprietary APIs like Bloomberg’s provide additional value rather than being alternatives to FIX. Make no mistake: you cannot interchange…

I can confirm. When I was implementing FIX to communicate with some big banks, it was common practice to put everything specific for the interface as XML in a single FIX field. FIX was only used because many banks had existing infrastructure built around it, such as reverse proxies on application level that would scan the FIX messages for some standard fields and route the incoming message to the appropriate server.

Re: Show HN: Trade stocks from the command line with no commission

#157
What are you folks using this kind of stuff for? The best I can come up with is carefully studying issuers' financial reports and reaching some not very good but close enough conclusion about the state of businesses. At which point paying a few $$ or even $100 in commissions is really irrelevant given how much effort I had to put in ...

Re: Show HN: Trade stocks from the command line with no commission

#158

Shameless plug: I started a YouTube channel on this topic that covers a lot of commission free trading API's, including Alpaca (got featured in their docs), Robinhood Private API, TD Ameritrade, Tradier, and more. I'm seeing a huge growth in interest in developing automated trading bots and algos. With commissions dropping to zero, there is a huge wave of day/swing traders that want to learn Python, so am creating as…

I have subscribed to your channel. Do you know of any services that allow non US residents to join? I am in New Zealand.

Sorry for the delayed reply, I wanted to get confirmation from our brokerage team before posting.

Tradier Brokerage (https://brokerage.tradier.com) can open individual accounts for New Zealand residents and API access comes standard with every account (including market data). You can place orders for US-based equities and options and we offer competitive pricing models for all traders.

If you have any questions, you can email service@tradierbrokerage.com or call 980-272-3880.

Full disclosure, I work at Tradier.

Re: Show HN: Trade stocks from the command line with no commission

#159
post #104

Earlier quoted context omitted.

FIX is just a protocol template. Vendors will make non-standard extensions to it. For example: OCO you send to CQG won't work with StoneX.

Is there a open source framework/application in go or rust based on FIX protocol? In forex quite a lot broker offer FIX apis(because MT4 is using FIX). The use case would be to have only one application to watch/place orders simultanously on 2-3(...multiple) broker accounts. To spread risk of losing funds in case a broker goes bankrupt (or whatever reason).

QuickFIX, a long-standing C++/Java FIX engine, has a Golang implementation:

https://github.com/quickfixgo/quickfix

Re: Show HN: Trade stocks from the command line with no commission

#160

(Disclaimer that I'm working on an open source FIX engine in Lisp.) This is a really cool project! But alas I couldn't use it as I'm not in the US, and I don't trade with Alpaca. And I feel like this plays into a negative trend I'm seeing. The retail brokerage market right now is treading on similar 'mistakes' in institutional markets 15ish years ago. Proprietary APIs were prolific, and therefore increased switching…

I wrote a FIX engine in Common Lisp once, working for a Norwegian retail broker. Worked like a charm for many years, connected to multiple market places and brokerages. Adapting to new counterparties was certainly a bit of work, but generally far less than implementing their binary protocols. (We tried that too from time to time, usually if FIX was not an option from the exchange. Admittedly rare i later years.) Unfo…

Thanks! Until your reply, I was pretty sure the intersection of lispers and markets devs was close to nil. It's been mainly Java/C++ from what I've seen.

It's a shame that you couldn't open source it. If you're open to it, I'd appreciate any feedback, thoughts or code review you could offer. You can get to it (and my email) with the second link in my profile.

Edit: typo, and point about Java/C++ dominance.

Post reply on HN