Thank you. This is where it got messy. I noticed that the bin folder in my virtual env does not have 'activate'. It has only python, python3 and python 3.12. Also, this is a fresh install of Ubuntu.
|
I use venv in VS Code and it works simple for all my projects.? I haven't actually install ib_async yet, since ib_insync still works.? I should do that just to be sure.? Also I'm using windows for most of my testing. Mel
toggle quoted message
Show quoted text
-------- Original message -------- From: "Pranav Lal via groups.io" <pranav@...> Date: 2024-07-22 9:48 p.m. (GMT-08:00) To: ib-async@groups.io Subject: Re: [ib-async] Installing ib_async
Hi, ? What happened when you tried using a virtual environment? I ask because I have always installed ib_insync this way. ? Did you use the python native virtual environment? If yes, could you try virtualenv? ? Pranav
|
Hi, ? What happened when you tried using a virtual environment? I ask because I have always installed ib_insync this way. ? Did you use the python native virtual environment? If yes, could you try virtualenv? ? Pranav
|
Hello,
I tried to install the package on my Ubuntu laptop but got the error "This environment is externally managed".
After searching for resolutions online, first I tried the virtual environment option but that got messy. Instead I was able to install it using pipx with 'pipx install --include-deps ib_async' followed by 'pipx ensurepath'.
At this point, running 'pipx list' confirms that the package was installed but 'pip list' does not display it. (I think this is expected)
Now, when running my Python script to connect with IB and place orders, I'm getting 'ModuleNotFoundError' error.
Anyone know how to resolve this?
Thanks!
|
Confirmed, ?transmit=True is the solution.
toggle quoted message
Show quoted text
On 13 Jul 2024, at 19:26, Gonzalo Saenz <yo@...> wrote:
?This is what I thought too. I have updated my code, let’s see on Monday.
When I attach the stop loss order, I enter transmit=False to all orders, except the last attachment. I realised earlier today that on the log "Transmit=False”, which how I entered it.
Now I can only wait to Monday.
Thanks for your inputs.
On 13 Jul 2024, at 19:10, Jason via groups.io <muffles.amatory.0a@...> wrote:
The only other thing I can think of is that the STP isn’t getting transmitted (transmit=False) but I believe the default is transmit=True, however I don’t know offhand how a non-transmitted order’s order status presents.
On Sat, Jul 13, 2024 at 11:21 AM, Gonzalo Saenz via?<yo=gnzsnz.com_at_groups_io_k21bj418pxe6c8_756s0895@...> wrote:Yes, STP has it’s parentId=MOO.orderId
Do you think this might be to problem? On 12 Jul 2024, at 20:47, Jason via groups.io <muffles.amatory.0a@...> wrote:
Are you linking the STP order to the MOO via parentId?
On Fri, Jul 12, 2024 at 12:24 PM, Gonzalo Saenz via groups.io < yo=gnzsnz.com_at_groups_io_k21bj418pxe6c8_756s0895@...> wrote: Hi,
I’m running an algo that triggers Market-on-Open orders. As it’s a MOO order the price is not known (although my logic will use a ticker to decide to trigger or not) at the time the order is created.
As I want to have a stop loss, I have added a commissionReportEvent handler. When orders are filled, I wait for the order to be fully filled, “trade.order.totalQuantity == fill.execution.cumQty” and I update the stop loss attached to the MOO order, with a stop loss price in line with the avg fill price.
This is working all fine. The problem that I have is that the updated order is never actually in status “submitted”. As per the orders notebook https://nbviewer.org/github/ib-api-reloaded/ib_async/blob/main/notebooks/ordering.ipynb, I update the order, execute placeOrder(contract,updated_order), status is ‘PendingSubmit’ then —> ‘PreSubmitted’ but it never reaches “Submited”
There is no error message, nothing on the log not TWS. I used to have some problems due to incorrect values on the order, but those were showing an actual error message. Now there is nothing.
Any pointer to the right direction will be appreciated.
Cheers
|
|
Re: What is the proper way to get an option's greeks?
During market hours you can do...
``` ticker = ib.reqMktData(option_contract,"",False,Flase) ib.sleep(2) ticker.modelGreeks ticker.askGreeks ticker.bidGreeeks ticker.lastGreeks ``` See below for more details
|
What is the proper way to get an option's greeks?
|
Re: Placing Trailing Stop Limit Orders
Hey please try this with PAPER account and assume everything I am saying is wrong, but from my experience it corresponds to the pct so trailingPct = 3 is 3% NOT 0.03. I talk about the specific example at 13:55 in video below.
|
Re: Placing Trailing Stop Limit Orders
Got it, thank you. Guess I'm unclear about the purpose of order.trailStopPrice and order.lmtPriceOffset fields. Is the following accurate?
order.trailStopPrice is calculated by the system as (1-trailingPercent) * (last price) order.lmtPriceOffset is provided by the user
order.trailStopPrice is the price at which the order gets triggered with a limit price of (order.trailStopPrice - order.lmtPriceOffset)
|
?This is what I thought too. I have updated my code, let’s see on Monday.
When I attach the stop loss order, I enter transmit=False to all orders, except the last attachment. I realised earlier today that on the log "Transmit=False”, which how I entered it.
Now I can only wait to Monday.
Thanks for your inputs.
toggle quoted message
Show quoted text
On 13 Jul 2024, at 19:10, Jason via groups.io <muffles.amatory.0a@...> wrote:
The only other thing I can think of is that the STP isn’t getting transmitted (transmit=False) but I believe the default is transmit=True, however I don’t know offhand how a non-transmitted order’s order status presents.
On Sat, Jul 13, 2024 at 11:21 AM, Gonzalo Saenz via?<yo=gnzsnz.com_at_groups_io_k21bj418pxe6c8_756s0895@...> wrote:Yes, STP has it’s parentId=MOO.orderId
Do you think this might be to problem? On 12 Jul 2024, at 20:47, Jason via groups.io <muffles.amatory.0a@...> wrote:
Are you linking the STP order to the MOO via parentId?
On Fri, Jul 12, 2024 at 12:24 PM, Gonzalo Saenz via groups.io < yo=gnzsnz.com_at_groups_io_k21bj418pxe6c8_756s0895@...> wrote: Hi,
I’m running an algo that triggers Market-on-Open orders. As it’s a MOO order the price is not known (although my logic will use a ticker to decide to trigger or not) at the time the order is created.
As I want to have a stop loss, I have added a commissionReportEvent handler. When orders are filled, I wait for the order to be fully filled, “trade.order.totalQuantity == fill.execution.cumQty” and I update the stop loss attached to the MOO order, with a stop loss price in line with the avg fill price.
This is working all fine. The problem that I have is that the updated order is never actually in status “submitted”. As per the orders notebook https://nbviewer.org/github/ib-api-reloaded/ib_async/blob/main/notebooks/ordering.ipynb, I update the order, execute placeOrder(contract,updated_order), status is ‘PendingSubmit’ then —> ‘PreSubmitted’ but it never reaches “Submited”
There is no error message, nothing on the log not TWS. I used to have some problems due to incorrect values on the order, but those were showing an actual error message. Now there is nothing.
Any pointer to the right direction will be appreciated.
Cheers
|
The only other thing I can think of is that the STP isn’t getting transmitted (transmit=False) but I believe the default is transmit=True, however I don’t know offhand how a non-transmitted order’s order status presents.
On Sat, Jul 13, 2024 at 11:21 AM, Gonzalo Saenz via groups.io < yo=gnzsnz.com_at_groups_io_k21bj418pxe6c8_756s0895@...> wrote:
toggle quoted message
Show quoted text
Yes, STP has it’s parentId=MOO.orderId
Do you think this might be to problem? On 12 Jul 2024, at 20:47, Jason via groups.io <muffles.amatory.0a@...> wrote:
Are you linking the STP order to the MOO via parentId?
On Fri, Jul 12, 2024 at 12:24 PM, Gonzalo Saenz via groups.io < yo=gnzsnz.com_at_groups_io_k21bj418pxe6c8_756s0895@...> wrote: Hi,
I’m running an algo that triggers Market-on-Open orders. As it’s a MOO order the price is not known (although my logic will use a ticker to decide to trigger or not) at the time the order is created.
As I want to have a stop loss, I have added a commissionReportEvent handler. When orders are filled, I wait for the order to be fully filled, “trade.order.totalQuantity == fill.execution.cumQty” and I update the stop loss attached to the MOO order, with a stop loss price in line with the avg fill price.
This is working all fine. The problem that I have is that the updated order is never actually in status “submitted”. As per the orders notebook https://nbviewer.org/github/ib-api-reloaded/ib_async/blob/main/notebooks/ordering.ipynb, I update the order, execute placeOrder(contract,updated_order), status is ‘PendingSubmit’ then —> ‘PreSubmitted’ but it never reaches “Submited”
There is no error message, nothing on the log not TWS. I used to have some problems due to incorrect values on the order, but those were showing an actual error message. Now there is nothing.
Any pointer to the right direction will be appreciated.
Cheers
|
Re: Placing Trailing Stop Limit Orders
Hi,
TWS documentation has good examples
| |