Closed Quenos closed 1 year ago
Please note you can run tests locally with make test
; also, you'll need to add your TT credentials as secrets to your repo fork (explained in CONTRIBUTING.md).
@Graeme22 The tests now run locally, but 95% is not reached. I think this is mainly because streamer.py has a low coverage, but that was not touched.
@Graeme22 The tests now run locally, but 95% is not reached. I think this is mainly because streamer.py has a low coverage, but that was not touched.
It's because you added new code, but no tests for it! If you're not comfortable writing tests, lmk and I'll do it.
It seems impossible to test the complex orders.
It seems impossible to test the complex orders.
- Testing in the certification environment is not possible
- Testing with a LIMIT order gives the error that it's not allowed E tastytrade.utils.TastytradeError: preflight_check_failure: One or more preflight checks failed E illegal_buy_and_sell_on_same_symbol: Cannot buy and sell against the same symbol.
- Using a MARKET order is possible, but only during market hours, and will buy the stock
- To test the OCO you need to have the stock
- I tested it with buying stock and it works. However, buying in automated testing is not ideal for obvious reasons
- I need to test cancelling orders, because that I might have overseen.
I was able to test successfully in a certification account!
Thanks for this, I went ahead and merged! For a OCO order, you create a NewComplexOrder
and pass in two NewOrders
to the orders
argument; for an OTOCO order, it's the same but you also add another NewOrder
as the trigger_order
argument, this makes it pretty straightforward.
Appreciate the contributions!
You're most welcome. Always fun to contribute to this kind of projects. Also good to know that it's running in the certification environment. Need to have a look where I went wrong.
Hi Graeme,
i was trying several times using the certification account class. I was not able to place a simpel order. Could you pls provide a code snippet for this.
My API Sandbox account is up and running.
Hi Graeme,
i was trying several times using the certification account class. I was not able to place a simpel order. Could you pls provide a code snippet for this.
My API Sandbox account is up and running.
Is the code example in #63 not working for you?
The general usage of the certification class.
The general usage of the certification class.
Just make a certification session, here's the docs on that: https://tastyworks-api.readthedocs.io/en/latest/sessions.html
Its working as expected. I was running into an Issue because I never got filled due to using a realistic! market price on a symbol.
Sandbox Environment The base url for all sandbox api endpoints is api.cert.tastyworks.com The websocket url for account streamer updates is streamer.cert.tastyworks.com Orders in the sandbox environment all remain within the sandbox system. They never go to a real market. Orders statuses in the sandbox system are all determined by the order type and order price. The logic is as follows: Market orders will be Live and never fill. Day orders with a price <= $3 will fill immediately. Day orders with a price between >= $3 will be Live and never fill. You are logged in as xyz
Description
Add the possibility to create complex orders:
Also cancel channel has been added to the DXLinkStreamer
Related issue(s)
Fixes: #63
Pre-merge checklist
Please note that, in order to pass the tests, you'll need to set up your Tastytrade credentials as repository secrets on your local fork. Read more at CONTRIBUTING.md.