I tried to place an order to buy 43 shares of AMZN to close out the short position at 2024-01-09 15:59:09-0500
However, I got “potential wash trade detected. use complex orders”
The order is to close out the short position opened by another order filled 4 hours earlier, which sell short 43 shares of AMZN and was filled at 2024-01-09 11:59:50.643684
As a result I’m not able to close my position that’s meant to be held intra-day.
There’s no wash trade whatsoever. This has happened multiple times to me, starting a few weeks ago. I’ve been running my algo for over a year and there’s no change to the code.
I believe there’s likely bug in Alpaca’s wash trade detection. I reached out to support@alpaca.markets but just got a generic link to doc pages on order types, which I’m very familiar already.
I just started using alpca and I’ve been getting this error on paper trading too??
Also I see this sending even 1 share orders and closing it right away.
I saw it today using the liquidate button on a paper position.
This is about the most basic trading function that can be done in any broker, mystified as to why this is hard. Certainly seems like a bug (which as I’m evaluating alpcaca, it’s also reflecting of quality issue since I’m seeing it for such basic operations).
I’ve also e-mailed alpca support but haven’t heard back yet.
I have the same error and it’s extremely frustrating. Before markets open, if I que a long trade for a stock and a few moments later I decide to cancel that trade by trading a short for the same amount as my long so that they cancel eachother out, it detects it as a wash trade even though markets haven’t been open yet.
I really hope they fix this, I’m not sure what else I can do
@Roi_Bel The order is being rejected because it could result in a a ‘wash trade’. A wash trade (not to be confused with a wash sale) is when one trades with oneself. This is when one’s buy order fills against one’s sell order. The SEC looks very unfavorably on that and imposes harsh penalties for repeat offenders.
Because of that, Alpaca puts in place protections which reject any order where there is an existing open order having the opposite side. In general, one’s algo should be either increasing a position or decreasing a position (ie buying or selling) and not be doing those simultaneously.
I would assume that an API that allows users to trade stock thousands of times per minute would consider that most of their user base uses their services for trading bots that frequently buy and sell the same stock to earn micromargins. This entire wash trade detection destroys everything about that, and now I’m unsure what platform I should migrate to that would allow for such bots without a wash trade detector. If you have another platform in mind, please let me know, until then all my progress is paused
Thanks, Roi
@Roi_Bel Alpaca has many accounts that execute many thousands of trades each day and frequently buy and sell the same stock. The Wash Trade Rule doesn’t impact them. It simply implies one cannot be both buying and selling at the same time. Algos typically respond to either a ‘buy’ signal or a ‘sell’ signal and therefore would either be buying or selling and not both. If, in a odd circumstance where both buys and sells are created, then simply submit a single order for the net of those orders.
Perhaps elaborate more on why this creates issues for your strategy.
First post here. I think you guys really do need to go back and look. I’m getting wash sale errors on an autotrader that I’ve run for a couple months in the past with no problems. Additionally, it didn’t even have sell orders. I execute the sell orders manually. I’ll run it again on Monday, but please tell me what details you need to troubleshoot more effectively.
@Bobrot Essentially wash trades are when there is no beneficial change of ownership of a security. The quote below is from FINRA Regulatory Notice 14-28. Basically buying and selling at the same time.
…unintentional interaction of orders originating from the same firm that involve no change in the beneficial ownership of the security (self-trades)
You stated “I’m getting wash sale errors on an autotrader that I’ve run for a couple months in the past with no problems”. That could be. These protections have rather recently been put in place and have gone through several iterations on exactly how they are implemented.
You also stated "it didn’t even have sell orders. I execute the sell orders manually.". It doesn’t matter where an order originates (eg the web UI or via an API call), if there is an existing order on the opposite side (ie buy and sell) there is the potential for a wash trade and the conflicting order will be rejected independent of where it originates.
If you provide your account number and an idea of the time when you saw any wash trade errors I can look at the logs and maybe provide insight into what is happening.
I personally have written an arbitrage bot which does fast trades and i keep getting the wash trade detected error. Alpaca’s own blog talks about arbitrage and its ridiculous that such system has been implemented on an api that is supposed to be used for complex algos.
After getting this problem and reading the thread, I went through the list of all my orders and found some old ones which were still open for the stock I wanted to sell. Once I deleted the buy orders that never closed, I could sell the shares I owned. (paper account)
I’ve been getting this error frequently. I am testing my python script on paper trades. The script is either going to buy or sell each loop (usually 60 seconds) but never both.
Advise using complex orders. Stop loss, limit, take profit etc. I still do a majority of sells manually, and it save crashing when the server detects the error.