IBPy beginner / any experience like this?

Dear-

Following the link at

Here is the photo capture of my screen. Unlike the link explanation above, I do not see any order in my IB TWS.

Anyone had similar experience like this before? This is to deliver a buy order of 100 MSFT at $41.2 to IB.

-Jay
 

Attachments

  • 12.png
    12.png
    39 KB · Views: 287
Last edited:
For actual development, the demo account is not really the way to go. That's fine to just proof a few things, like: "Can my code connect to TWS", but not what you want to develop production code on. You want a paper account, and to get that you need to actually have a real account with them.
It's been a fair bit of time since I've played around with the TWS code. I believe the order # resets each day...I think there is also an API event which fires at connection to give you the next OrderID (nextValidId or something like that). Check the docs.
Also, you may want to set up the API so that it auto-accepts connections from the local machine (127.0.0.1). That way you don't have to click "ok" on that message box every time you connect.
 
Thanks to the both replies.

1) Probably it might be bacause the oid should be reset everytime.

2) At this point, my local internet provider gives me cheap variable IP, instead of the (expensive) fixed 127.0.0.1.
I wonder if someone pay additional monthly charge for the fixed IP, specially for trading in IB API.
 
Thanks to the both replies.

1) Probably it might be bacause the oid should be reset everytime.

2) At this point, my local internet provider gives me cheap variable IP, instead of the (expensive) fixed 127.0.0.1.
I wonder if someone pay additional monthly charge for the fixed IP, specially for trading in IB API.

Yes the orderid resets daily. If you go through the blog it will give you the code to get the orderid.

I can see no advantage of all to have a fixed IP for trading - why would you need to do this?
 
I can see no advantage of all to have a fixed IP for trading - why would you need to do this?

That is just my guess, based on the Goodnior's advice "to set up the API so that it auto-accepts connections from the local machine (127.0.0.1)" and "Trusted IP Adress" under the menu File/Config/API/Setting in IB TWS.

It may not be true.
 
That is just my guess, based on the Goodnior's advice "to set up the API so that it auto-accepts connections from the local machine (127.0.0.1)" and "Trusted IP Adress" under the menu File/Config/API/Setting in IB TWS.

It may not be true.

Whats going on here is that the IB API software will only accept connections from certain IP addresses. These are local network IP addresses, by the way. Its nothing to do with your ISP provider.

You can run the gateway on the same machine as all your trading software. In this case the only IP address you need to add is the local machine IP, which is always 127.0.0.1.

Alternatively depending on your setup it could make sense to allow connections from other machines on your network. You'd need to hack your router setup so that the IP addresses allocated are fixed, or you'll need to change the IP on the trusted list everytime you reset your router. Again this is not a call to your ISP. Unless you spread your processes over multiple machines this probably won't make sense.

Suppose I have roughly 500 orders everyday, then "resetting orderid" means that I can use 1 to 500 oid once everyday?

Yes, but its better practice to generate your own order id's. I assume you will have a database object of orders, and you can make a call to it like dbobject.generatenextorderid() . Then you just need to check that the orderid you've generated is 'legal' with IB and not equal to an existing IB orderid you've used (it only won't be if you've accidentally submitted a manual order or not kept track properly).

Also see:
http://qoppac.blogspot.co.uk/2014/05/the-placing-of-orders-to-interactive.html
 
Back
Top