Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
- Twsapi
- Messages
Search
AW: twsapi: Re: order IDs
I store everything in a database, including the order details and the order
id. When you have a Limit order which doesn?t get executed, and you disconnect, close TWS, open TWS, and reconnect through the API to TWS, then TWS forget?s the API order ID. So I decided that I cancel all open orders manually in TWS and then send all open orders again from my programm to TWS. Marcus -----Ursprungliche Nachricht----- Von: kxlin99 [mailto:klin@...] Gesendet: Sunday, June 30, 2002 1:49 AM An: twsapi@... Betreff: twsapi: Re: order IDs Hi there - I would like to know how you manage order ids from session to session. I meant you place an order and store the order id in your table, what if the TWS/Windows crashed, and you need reboot the machine, how do you change/cancel your open orders? Thanks --- In twsapi@y..., Robert Carey <rcarey1@o...> wrote: You have to keep track of your trading over time. You have to keeptrack of what you or your Automated Trading System is doing. You need to store what was done, when, and why. Besides, the IRS is coming on 4/15/2003 for sure, if not sooner.backup. I choose to use the Microsoft .mdb format and access it from VBwith DAO 3.6. There is a table of trades. It has an entry order number and anexit order number in each record. There are lots of other fields to keep track of when, where, and why. A recordset RS.TradesEnter is created indexed on theopenOrderNumber. A recordset RS.TradesExit is created indexed on the exitOrderNumber.updates the when,where,why fields. When you or your ATS decides to close a position,RS.TradesExit "seeks" this ExitOrderNumber and updates the when, where, why fields. That should keep you and the IRS happy. Yahoo! Groups Sponsor ADVERTISEMENT To unsubscribe from this group, send an email to: twsapi-unsubscribe@... Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. |
Re: order IDs
kxlin99
Hi there -
I would like to know how you manage order ids from session to session. I meant you place an order and store the order id in your table, what if the TWS/Windows crashed, and you need reboot the machine, how do you change/cancel your open orders? Thanks --- In twsapi@y..., Robert Carey <rcarey1@o...> wrote: You have to keep track of your trading over time. You have to keeptrack of what you or your Automated Trading System is doing. You need to store what was done, when, and why. Besides, the IRS is coming on 4/15/2003 for sure, if not sooner.backup. I choose to use the Microsoft .mdb format and access it from VBwith DAO 3.6. There is a table of trades. It has an entry order number and anexit order number in each record. There are lots of other fields to keep track of when, where, and why. A recordset RS.TradesEnter is created indexed on theopenOrderNumber. A recordset RS.TradesExit is created indexed on the exitOrderNumber.updates the when,where,why fields. When you or your ATS decides to close a position,RS.TradesExit "seeks" this ExitOrderNumber and updates the when, where, why fields. That should keep you and the IRS happy. |
Tickers & 40 More Tickers....Someone Try This....See If It Works
marinindextrader
I wonder....wanting of more Ticker's....
[in regards to the 40 ticker limit to API users] If one logged on through multiple instance of the API moduel via an array or segragate naming could they pull more than 40 or multiples of 40? I will bet ya dozen Krispy Kreme your good to go.... Dim iTemp As Integer For iTemp = 0 To UBound(TWS1) TWS1(iTemp).connect "", 7496 + iTemp Next iTemp If id <= 39 Then TWS1(0).reqMktData(yada yada) Else If id > 39 And id <= 79 Then TWS1(1).reqMktData(yada yada) End If makes one wonder doesn't it? If anyone has time to burn give this a rip and see if it works...I will get around to it eventually but I am focused elswhere... Scott Yhoo TWSAPI |
Re: twsapi: Modifying an order & testing
marinindextrader
There is nothing in the files section that specifically deals with
trailing stops...though I can asure you that someday not to long from now it will As TonkaDad said there is a demo server To log in: Username for equities demo: edemo Username for commodities demo: cdemo And in both of the above cases the password is: demouser As to your trailing stop question: It is my understanding that this can be handled in a few different ways: Method A: Have no server sided order and have an order on your client side that is ready to execute. You track the security price on your side, then if and when certain price events occur, you do one of two things: modify the ready order, or go ahead and send it Method B: Have a standing order on the server, and if and when price events occur one of two things happens. You do nothing and the standing order is executed on the server side (you got stopped out), Or, You resubmit the order with modifications using the identical id # (not positive about this one), and the server sided order is modified (an event occured that triggered your modified order to send). Method C: Have a standing order on the server side, and when events occur either one of two things happen. The order triggers (you were stopped out), or you cancel the order and resubmit a new order with your new parameters based on a price action event. I havn't explored the nuts and bolts of it yet...but that is how I believe it is played out. Which method one chooses is a matter of prefrence and the liquidity of the market you trade. Scott --- In twsapi@y..., "Bruce Hawkins" <hawkinsk001@h...> wrote: I to would like to know how to place trailing stops.about half way down it should say "Files" there is some code there. Also Jaba puttogether a simple project that you can download look at post 189. connect to. Service. |
Re: twsapi: Modifying an order & testing
开云体育I to would like to know how to place trailing
stops.
?
If you go to
on the left about half way down
it should say "Files" there is some code there.
Also Jaba put together a simple project that you can download look at post
189.
?
As far as testing before you go live IB has a demo
that you can connect to.
?
Good luck,
?
Tonkadad
|
Modifying an order & testing
ruffstuff123
Hi,
First post in this forum. I hope this question han't been posted before....... The only thing that I'm really missing is a trailing stop. Anyone managed to code something like that? If so please mail me the code or point me to an example. It would save me huge amounts of time. Finally away from the screen for a few hours :-) I can code a bit in VB6. Level... erm... advanced 'Hello world' ;) But if anyone would be so kind to share a few lines of code that modifies an order I have enough to build on. Is their a way to test without placing real trades? Needless to say a little bug can cost 1000's........ Looking forward to the replies. And to the founder(s) of this group: Great initiative! Kind regards. |
IB TWS API Thread at WL.
techguy1313
Hi, I'm Techguy:
I started an IB Automation thread at Wealth Lab, under the Automation Category. Click here to read it. It may have some value to you, and will certainly expose my limited programming ability - but there may be some good information there for you as well. Some of you may know me from elsewhere - other forums - same guy. If you are in the Seattle or Portland area, we have a group of Trader Programmers that meet regularly: Here is the contact info: The PDX and Seatac Wealth Lab User Groups are now centralized at the Yahoo Groups area. Members can post, view the calendar, upload files, chat, and generally keep themselves informed of the PDX WLUG happenings. Membership is by moderator acceptance. Content is un-moderated. All Backtesting / Trading suite Users / Programmers / Developers are invited to attend (Tradestation, AMI, SmartQuant, Wealth Lab, C++ Users, etc. . . are invited to attend and participate in the meetings - if for nothing else comradiere) This User Group strives to meet monthly, and address topics of interest to Trader Programmers. Emphasis is on the use of Wealth Lab for Trading strategy testing and as use of a decision engine for Trading automation. For a brief synopsis of the groups and more about what we are all about go here: A link to Wealth Lab is located on the page above. For the sister SeaTac group membership request go here: For the Portland Oregon Wealth Lab User Group (PDX_WLUG) go here: |
Re: twsapi: Market Making App
fanjacks
Odd lots do not have to be represented in the NBBO. They do haveto trade if given the opportunity though.So does this mean that I can put a buy and a sell order inside the spread, and if the orders are odd lots, they are effectively invisible, at least on the level 1? I'm thinking there must be a huge disadvantage to this, like full lots are given execution priority (at that level), or it would be too advantagous. FYI, I know IB forbids you from making markets in options. II tried it out on my account it indeed, it does work for stocks. There's a specific regulation in the options market that forbids opening two opposit positions on the same option (something to that effect). I dont' think it exists for stocks, unless someone knows better. I have seen similar programs in the forex market (where the market makers are real A**holes, more so than any equity MM can ever be). I'm surprised that they aren't more prevasive in the equity market, or at least, I know they exist but they are never advertised. Does anyone know the reason? Cheers, JS |
Re: twsapi: Market Making App
Odd lots do not have to be represented in the NBBO. They do have to
trade if given the opportunity though. FYI, I know IB forbids you from making markets in options. I wouldn't be surprised to see something similiar in stocks. I know back in the old days it was not legal for complete automation, even on a fully certed OTC dealer desk. Good luck. Aaron SchindlerIB for a long while. I'm thinking about writing a fully automatedhave to admit, although I would have no problem writing the softwaretest 10- share sell/buy on a NASDAQ stock inside the bid/ask spread, itto hear from people with similar interest, and get a move on thisService. |
Re: How to get - Account Number
marinindextrader
That was an excellent question
toggle quoted message
Show quoted text
--- In twsapi@y..., bee_jay_61 <no_reply@y...> wrote:
--- In twsapi@y..., multicen2002 <no_reply@y...> wrote:I have 2 accounts.I am not sure, but isn?t the account number display in the window |
Re: How to get - Account Number
marinindextrader
Anyone know how to get account number >>?
I think you need to control this yourself and keep a cross refrence with which instance you are calling the connect from. In this case you need to either capture the port and compare it when you call it, or better yet keep an array that mirrors your API object array interms of indecies Such as a Long, 2 dimensional array that has as many lead indecie as you have API objects and as many columns as you feel fit to include...2 in this case...that would look something like this Dim arrAccount() ReDim arrAccount(UBound(TWS1), 1) arrAccount(0,0) = 7496 arrAccount(0,1) = 'some account number arrAccount(UBound(arrAccount),0) = 7497 arrAccount(UBound(arrAccount),1) = 'some other account number Then when you call any TWS you can refrence the array as well and return the account number easily based on the index API object. You could add a third element to the array and make the array variant and put a string value in the third slot such as "Stocks" or "Futures" to further expand its utility. Hope this helps as well Scott PS I will be exploring this subject in depth some time in the coming couple of weeks and will be posting example code... Unless of course you beat me to it --- In twsapi@y..., "marinindextrader" <marinindextrader@y...> wrote: This is an interesting question, and one I was intending at someyour program you can call the connection from a seperate instance of thecall direct.. |
Re: How to get - Account Number
marinindextrader
This is an interesting question, and one I was intending at some
toggle quoted message
Show quoted text
point to explore. Based on a cursory review of the methods and calls, there is no way to retrieve an account number. But on a little deeper look I believe I have a solution for you. Apparentley the TWS platform remembers the socket port you called with the account you called. In other words you must log onto to each account from a different socket port with seperate instance of TWS, and then from within your program you can call the connection from a seperate instance of the Active X componenet for each account. An array of controls would do the job... TWS1(0).Connect "", 7496 TWS1(1).Connect "", 7497 or perhaps just renaming the controls TWS1.Connect "", 7496 TWS2.Connect "", 7497 I am an array kind of guy so I would go the array route... Lastley, perhaps you dont even need the second instance and can call direct.. TWS1.Connect "", 7496 TWS1.Connect "", 7497 But this looks like your asking for trouble and corupted data...IMHO Either Way.... From there, you can then refrence your calls and segregate returns based on the source of the call TWS1(0).reqMktData(da dee da) TWS1(1).reqMktData(da dee da) Thats how I see it. Again, I havn't explored this in detail and perhaps I am wrong. Give that a shot and then report back here what you find so we can all benefit from your experience. Scott Owner TWSAPI --- In twsapi@y..., bee_jay_61 <no_reply@y...> wrote:
--- In twsapi@y..., multicen2002 <no_reply@y...> wrote:I have 2 accounts.I am not sure, but isn?t the account number display in the window |
Re: How to get - Account Number
bee_jay_61
--- In twsapi@y..., multicen2002 <no_reply@y...> wrote:
I have 2 accounts.I am not sure, but isn?t the account number display in the window caption of the "Account"-Window? If so, than I would read the Window Caption. |
Re: twsapi: Trader Guard - ES NQ futures ready app.
Shukrainternationals
开云体育Can anybody tell me what is the web site address of twsapi
group? (NOT the email address).
Thanks.
?
|
Re: twsapi: Market Making App
Schindler Trading
开云体育Hi JS,
?
I'd like to adapt your program to the futures markets I trade
through Interactive Brokers.? Unfortunately, unless you write your code in
C++, I won't be able to contribute much to the project.? But if you do get
your code working, I'd be happy to pay you something nominal for a copy of
it.
?
Regards,
Aaron Schindler
?
?
|
Re: COM error trying to connect.
houdinihound
Tried that as well (Python allows either) but no luck.
Thanks anyway. JC --- In twsapi@y..., "marinindextrader" <marinindextrader@y...> wrote: In VB this (tws.connect('', 7496)) Would be:no difference. |
stockwatchpro
Found this on silicon investor IB board. I tried stockwatchpro along
with IB today, works pretty good. I wish IB removed BEST routing restriction on its API. --------------------------------------------------------- Stock Watch Pro 2.3 with IB TWS integration just got released. Orders can be initiated from Stock Watch Pro as follows: - QuoteSheets (double-clicking on bid or ask) - Level II or Island book (double-clicking on a market maker) - Charts (from the right-click menu) - From alerts when they trigger. SWP formula language allows you to define any condition and associate an order with it. Stock Watch Pro website: For integration details see |
Re: twsapi: Trader Guard - ES NQ futures ready app.
Shukrainternationals
toggle quoted message
Show quoted text
|
to navigate to use esc to dismiss