Alpaca is a bogus broker who implement Irrational behaviors and unfair illegal validations that should not be there in first place and are plain bogus implementations that are designed to discourage People from doing algo trading and testing. I have had enough email to alpaca customer support which they takes days to reply, there is no effect on them, and they do not care. I lose confidence in Alpaca to be able to move forward to live account. I believe the broker is engaging in unfair or illegal practices, which needs to be reported to the regulatory authorities.
Status Code: 403, Status Message: āForbiddenā, API Response Code: 40310000, API Response Message: āpotential wash trade detected. use complex ordersā
All I am trying to do it submit a market buy order while a limit sale order is pending on the same stock, it will throw trade wash detected error. HOW in the world is it a trade wash? WHO said it is illegal to submit a market buy when a existing limit sell is pending, if that was the case, WHY in the world every other broker TD ameritrade, Charles swab, Tradestation , IKBR allow it are perfectly okay with it ? Alpaca is bogus in my experience.
@Andy_S Alpaca, like all brokers, are required to comply with a number of SEC, FINRA, and other agencies rules and regulations. Specifically FINRA Rule 5210 regarding wash trades, brokers must
ā¦ have policies and procedures in place that are reasonably designed to review trading activity for, and prevent, a pattern or practice of self-trades resulting from orders originating from a single algorithm or trading desk, or related algorithms or trading desks.
FINRA aggressively enforces this rule. One broker was recently fined $250,000 for "failing to detect and review trades emanating from customer orders ā¦ that resulted in the firm failing to review in its wash trade surveillance program numerous trades"
Each broker implements their policies a bit differently, and Alpaca being primarily a trading platform for algorithmic traders has a bit different focus, and can face different regulatory scrutiny than other brokers. Notice the wording of the above requirement specifically calls out āorders originating from a single algorithmā.
In general, the wash trade protections should not be onerous to oneās trading. Why? There shouldnāt be a situation where one is both trying to buy and sell at the same time. The benefit of algorithmic trading is the ability monitor oneās strategy and react to changes quickly in real time. Additionally, one can and should (as the error message encourages) place bracket or OTO orders rather than simple orders. These orders automatically trigger the other related order preventing the possibility of both orders filling against one another (among a few other checks).
No Dan, your assumption is incorrect. My market orders are at different prices. The problem is I have a existing limit sell order at $10 and Iām trying to buy a market order at $10.05 and it rejects it as a potential wash trade. This is not making any sense. Please explain this behavior
When are you going to promote this restriction in live production accounts? Because you have this validation in a paper trading account. ?
I have checked with Charles Schwab who also have algo trading and they do not have such restriction in their paper trading account neither they are aware of any such rules.
Thanks Andy
Hi Andy, read carefully the error message āuse complex ordersā, the bracket order is a complex order example. The order class ābracketā I mean. It has a stop_loss property and that what your sell order is.
@Andy_S It is not āillegalā to place a market order if you have an open limit order. What is prohibited however, is to have a buy order fill against a sell order if both orders are from the same account or individual. That is known as a āwash tradeā. Both the broker and the individual can face stiff penalties imposed by the SEC and/or FINRA if this happens.
To avoid that situation, brokers are required to put in place processes to prevent wash trades. The process Alpaca implements is to prohibit a market order being submitted if there is an exiting limit order of the opposite āsideā. Granted this may be a bit broad but it is the current process and, as mentioned, required by FINRA.
I say that having 2 orders in opposite direction is very suspicious so to avoid any allegations that you are doing market makers job you can create a conditional order which is created when price reach the level. Since that moment your position will be closed it cannot be a wash order. I hope your idea is to control risk but not market manipulation
Dan, Iām totally puzzled with this wash trade trading logic which was implemented about a month ago. Despite my intent to only execute market orders that are 10 cents higher than the previous price, the system is still flagging potential wash trades. Iām perplexed as to how this could be an issue related to FINRA rules. Could there have been a misunderstanding of FINRA regulations on the part of your development team?
Dan, there is another scenario which is not making any sense. Put a limit sell at 11.73. Then place a market order, Alpaca rejected it in a potential trade wash issue, but TD ameritrade accepted it, Robin hood accepted it. Its not making any sense ? Why Alpaca is so weird and strange ? if you dont trust me, please see the attached screenshots.
@Andy_S You brought up several questions/issuesā¦
Why have you not implemented this restriction in live accounts yet ?
Alpaca uses the paper trading environment as a sort of staging/test system. Most changes are first rolled out to the paper environment, then after they are validated in real āpaperā trading, the changes get moved to live. That said, I thought this wash trade prevention was implemented currently in live accounts (but I may be mistaken).
Despite my intent to only execute market orders that are 10 cents higher than the previous priceā¦
Somewhere in your algo you must also be allowing open limit orders of the opposite side (ie buy vs sell). Cancel those limit orders first.
Put a limit sell at 11.73. Then place a market order, Alpaca rejected it in a potential trade wash issue, but TD ameritrade accepted it, Robin hood accepted it
As mentioned earlier, each broker implements their policies a bit differently, and Alpaca being primarily a trading platform for algorithmic traders has a bit different focus.
Hi Dan, Itās not currently in live production environment. I tested the same scenario that I put the screenshot of, and it worked pretty well without any potential trade wash detected error message. I can confirm that this problem does not exist in live accounts as of now. It was not in paper accounts also about 2 months ago. I still think stopping market orders to buy and sell does not make any sense. I donāt think FINRA can stop that , you can buy and sell at market orders x number of times on the other trading platform, not sure why Alpaca is so strange in this regard, I will call FINRA general customer phone tomorrow to discuss this scenario with them. Would like to see what their view point is on this issue. Thanks, Andy
the fix may be something like this:
try:
order = api.submit_order(
symbol=symbol,
qty=qty,
side=ābuyā,
type=ālimitā,
limit_price=limit_price,
time_in_force=āgtcā,
order_class=ābracketā,
stop_loss={āstop_priceā: price * 0.95, ālimit_priceā: price * 1.05}
)
except Exception as e:
logging.error(f"{inspect.currentframe().f_lineno} Error submitting buy order for {symbol}: {str(e)}")
traceback.print_exc()
i think another reason could be also that on paper the prices are not updated so often thats why it can be that: buy order exists, sell limit price should be greater than existing buy limit price. so the actual price you download on over get position is lagging the real price on the exchange. happens to me too. i will try on a small real money account and see it that proplem persists.