You've successfully subscribed to Alpaca Learn | Developer-First API for Stocks, Options, and Crypto
Great! Next, complete checkout for full access to Alpaca Learn | Developer-First API for Stocks, Options, and Crypto
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

Chatting with Alpaca: Backend Operations for a Trade

Mariangela Martinez
Mariangela Martinez

In this video, our VP of Operations, Allen Spence, walks us through what happens when you place a trade!

Watch the whole video:


Mariangela: Hi, everyone. I'm Mariangela Martinez, Content Marketing Specialist at Alpaca.

Allen: Hi, I'm Allen Spence, VP of Operations at Alpaca.

Mariangela: In our series of Chatting with Alpaca, we're going to dive into the backend operations of a trade. What happens when you click buy or sell and see in your account, the stock or the money. And Allen here is gonna explain this to us.

Allen: Yeah, absolutely. Thank you everybody for tuning in. I've been here since March of ‘21 in a couple of different roles but my background is equity trading. So I know that the best and we've got a great equity trading operation here at Alpaca. Happy to explain it.

So basically when you enter an order, several different things are gonna happen. Well, the one thing that's gonna happen is either we're gonna, we're gonna route your order. We may fill the order principally against ourselves depending on the kind of order type that's usually gonna be a fractional order. So in that case, we're just gonna execute the order. And then if we route the order out to the market, we have a best execution committee that will kind of determines the firm's order routing strategy. So we're gonna to route the orders kind of based off of execution metrics. We have an index that we've created internally that we use to evaluate each venue's execution quality. We have three different market makers right now that the order could go to. So we have our own principal venue primarily for fractional share executions. And then we've got three wholesale market makers that we will route the order to. And we will route in the order. We're really looking for them to fill our orders better than the inside of the market. So there's something called the NBBO, National Best Bid Offer.

And if you're selling, you know, we're trying to fill your order higher than what the current bid price is. And then if you're buying, we're trying to get your order filled lower than what the ask is in the marketplace. You're trying to get your order filled better than what's available in the market. That's the mission of the Best committee. So we will route your order to the market maker. They will fill the order. They can fill it principally themselves. They could route the order to an ATs. They might send some of that to an exchange that might send it to an ECN. So they have several different things that they can do with the order once they receive our order, but we're gonna hold them to the standard of what was the quote at the time the order was entered.

So let's just say they send it out there, it gets filled, you know, on an exchange. So, you know, you sold, you know, 100 shares, you know, at $10. So immediately in your account, you see, you know that you sold the stock and that you have $1000 in your account to spend. So that money is actually not going to be received by Alpaca for two business days. So currently trades take two business days to settle. And so, you know, if you, you know, buy something on a Wednesday, the money is really not there for Friday. So, but you have access in your Alpaca account to go ahead and use that money to buy something else. If you would like, you know, your buy trade is not gonna settle until Friday as well. So, the trade have the same settlement date.

Mariangela: So how does that work for Alpaca? Are there some challenges for it? Like am I borrowing your money? How does that work?

Allen: We do have margin accounts at Alpaca and there are, there are limitations, you know, on the margin accounts, you can only borrow so much money. You know, you can only hold so much of a position, you only have so much of a position overnight relative to the equity in your account. And there are risks. So we're constantly having to monitor clients accounts to see, to make sure that they're over the house requirement that we have set. And also to make sure, you know, they're not, the equity is not going down in today because if you're in margin, you can actually lose more than you, you know, put into the account, you know, you can put in $3000 and end up owing us $1000 let's say, in a specific scenario. So we're constantly having to watch the accounts intraday for that risk.

Mariangela: Ok. That's interesting.So it takes two settlement dates because I know like some companies do, they don't give you the money right away like it shows there as cash, but you can't use it to buy more. Is that gonna change?

Allen: At Alpaca no, everyone has a margin account. So you're, you know, you're able to, to use that money to buy another equity now to withdraw the money from the account is a little different. But if you wanna use that money to buy something else, that's not an issue and it's, no, it's not gonna be something that's gonna change any time soon. What, you know, what may end up changing now in the future is the industry is gonna be going to potentially a one day settlement starting in 2024. So, you know, they'll be right now, trades take two days to settle. So at a company like Alpaca, that's mainly retail, it's not really an issue because we have for the most part clients funds before they trade more an institutional where there's delivery verse payment trades where they might do the trade.

And let's say you're selling something, the assets might be held at a prime broker and they have to send the shares to the executing broker that all has to be done by settlement and then the money exchanged as well, going back to the prime broker. So, you know, there will be some challenges when the industry goes to one day settlement. I think a lot of the operational processes need to be at every and every, you know, everyone in the industry need to be, you know, automated as much as possible. It's really gonna put a lot of stress on the back office, industry wide.

Mariangela: Yeah. OK. Very interesting. So that's until 2024.

Allen: Yeah, potentially, maybe, maybe it'll be, they'll push it back a little bit. A lot of times these big things they get pushed back. So that'll put the US at a place where all the other developed markets, equity markets in the world are gonna be on two day settlement and we would be on one day settlement will present a lot of challenges also with people, you know, like in different markets.

If you're in Europe or you're in Asia, you know, the currencies are gonna take two days to settle. So if you want to buy a US equity, the FX takes two days to settle and you've got to pay for the equity in one day. So there's all these kinds of things that really need to be thought out, you know, by the industry really before it goes, but it's, it's, you know, it's gonna happen. I think it's just a question of when I think investors really want it to be, they don't understand why things take two days to settle.

A long time ago, the exchange actually would close like in the sixties. I've talked to people who've told me this that they used to shut down the exchange on Wednesdays and on Wednesdays, they would have to work and just do like trade reconciliation, you know, between, you know, buyers and sellers. So we're kind of, you know, and even before that, then we went to a five day settlement and then we were at three and then, I think in 2017, the US went to a two day settlement. So it's getting, yeah, well, hopefully one day we'll get things, you know, we'll have like same day settlement or things will be a block Right. I think that's where a lot of people want to go.

Mariangela: Yeah. I mean, it looks like we're moving towards that.

Allen: Yeah, absolutely. I guess this is, we're all part of history. Right?

Mariangela: Perfect. Thank you so much for explaining that. So, to all of our viewers let us know what you want to watch next and we'll explain it to you. Thank you so much.

Contact Us

Learn more about Broker API:

Broker API Resources: Webinars, eBooks, and Guides
Discover Alpaca Broker API resource hub, a complete library featuring our latest ebooks, guides, learn articles, webinars and more.

The content is for general informational purposes only. Alpaca Securities LLC does not recommend any specific investments, or investment strategies.

All investments involve risk and the past performance of a security, or financial product does not guarantee future results or returns. Keep in mind that while diversification may help spread risk it does not assure a profit, or protect against loss. There is always the potential of losing money when you invest in securities, or other financial products. Investors should consider their investment objectives and risks carefully before investing.

Margin trading involves interest charges and risks, including the potential to lose more than deposited or the need to deposit additional collateral in a falling market. Before using margin, customers must determine whether this type of trading strategy is right for them given their specific investment objectives, experience, risk tolerance, and financial situation. For more information please see Alpaca's Margin Disclosure Statement and Margin Agreement. These disclosures contain information on Alpaca Securities's lending policies, interest charges, and the risks associated with margin accounts.

VideosChatting with AlpacaTrading APIBroker API

Mariangela Martinez

Mariangela Martinez is a Content Marketing Specialist, DX & Community at Alpaca. She loves working in the Fintech industry and is invested in how it is changing.