-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error creating OTOCO order v8.5 #177
Comments
Both closing orders should be debit or credit, having one credit and the other debit is an invalid structure. |
Appreciate your prompt response. I am now getting a different error. If I change the order to maintain the correct structure (shown below), I am getting the following error:
Not quite sure what is now wrong with the trade. Why is the structure invalid and why is the order price invalid?
|
So think about it this way. You're sending an order for a credit, then you're immediately sending two closing orders for a debit which would in theory both fill instantly since the order is actually worth a credit. Tastytrade doesn't allow this because it's nonsensical. What you could do that would probably work is have all 3 be credits, but set the stop loss at $0 credit. Are you able to do a corresponding order in the actual Tastytrade platform? |
I can't replicate it in the platform as you mention. When I do a bracket order on the platform, it does allow me to put the profit as a credit and the stop loss as a debit. We could look at possible another, maybe simpler example. If I have the following legs:
My trade parameters are as follow:
No matter how I structure the order, I get either invalid structure or invalid order price error messages. How would you set it up, if you don't mind me asking? I've tried all combinations of CREDIT/CREDIT, DEBIT/DEBIT, CREDIT/DEBIT, etc to no avail.
|
So I just tried and I wasn't able to build any of these orders in the browser platform.
And in this case, your take profit and stop loss are both higher than the trigger order price, which also doesn't make sense. And you can't have a price effect of credit for everything either. |
What I'd recommend is first building the order in the platform, then copying EXACTLY the parameters you see to make sure you're building it right. The basic concept is this: trigger order is an opening order. The take profit and stop loss are both closing orders, one for wins and the other for losses. So the price effect of both closing orders needs to be opposite that of the trigger order, and all the prices need to look like this: stop loss price < trigger order price < take profit price |
In the case of the kinds of orders you're doing where in the future they could be worth either a credit or a debit, it may just be a platform limitation that you can't place complex orders in the way you're trying to. |
Thank you for your responses again. I will try to do one of these on the platform and once successful, will attempt to do it via the API and provide feedback. Thank you again |
Hello again. I tried another trade via the desktop and then tried to replicate it via the API. The desktop order was processed with no problem, however, the API call came back with similar errors. Below is code used and output. Attached is screenshot from desktop before the order was placed. Any help is greatly appreciated.
|
In this case, the take profit that you see in the platform is a debit, not a credit. So you should be able to get this to go through by switching it to a debit. The price effects of both closing orders should always match and be the opposite of the opening order. |
When I change both closing orders to debit, I get the following error:
|
Hmm, one more thing you can try. I think it may be invalid to pass a price effect at all for the stop loss order. |
Hi. The example in your documentation does show a price effect in the stop loss order. Not sure if maybe TastyTrade's own API has changed the requirements. Anyway, I tried removing the price effect from the stop loss order and got the following error:
|
I took another look and it seems like in your code you switched the long and short legs, so it wasn't allowing you to place the opening trade for a credit when it should've been a debit. |
Trying to follow the example in the documentation to create an OTOCO order. Modified it for a simulated COIN transaction. Error message seems to indicate that something may be missing in the NewComplexOrder method and when calling the TastyTrade API. Not 100% sure.
Below is the OTOCO order once created by the NewComplexOrder method call
When calling a dry run order, I'm getting the following error message:
You can reproduce it by running:
The text was updated successfully, but these errors were encountered: