scorpion,
I really appreciate your taking the time to answer so many questions, as I'm sure do many others you've helped around here. How do you find the time? All I seem to have time for recently is working on my bot.
Just want to clarify a few things you said. Perhaps this thread will help some other developers out there who are as frustrated as I am with the lack of documentation...not that it will matter once brokers stop supporting this API! Did you ever determine which API you'll switch to after MT3? GAIN Capital looks very appealing to me--they don't charge for development or production use of their API.
Quote:
|
Originally Posted by scorpion
Actually, my program initially open two static connections: one for msg pump and another one for calling functions, so the program does not have to spawn a new connection every function call. This is quite efficient for me since first tested months ago.
|
I take it this means that both the 2-minute connection limit and the 5-second limitation on GetTrades are bogus? Does your program actually call it on every UPDATE_BIDASK message, as you suggested?
Quote:
|
Originally Posted by scorpion
You don't need to update the account and trades info everytime a msg comes in, but you cannot fresh the info more than once between each msg.
|
Not sure what you mean here. I don't seem to have any problems calling GetTrades/GetTradeRecords repeatedly in between UPDATE_TRADES messages (on a separate connection though, not on the pumping connection--the documentation indicates one is not allowed to call GetTrades while in pumping mode, so I've never tried.)
Quote:
|
Originally Posted by scorpion
I use 1 min interval for ticks flowing and END_PUMPING msg. The interval is relative to connection speed. For fast connection, 1 min is ok. I'm still finding out the correct interval for my server connection.
|
That makes sense. So you do both--reconnect if no ticks arrive for the interval, or whenever you get END_PUMPING?
Quote:
|
Originally Posted by scorpion
Yes, right. Call GetTradeHistory to get closed trades info. Actually, when a trade or an order is closed, there will be an UPDATE_TRADES msg pumped in.
|
I do get an UPDATE_TRADES after closing a position, but as the purpose of GetTradeRecords is to list the current
open positions, all this message tells me is that the trade has closed (since it's no longer in the list.) At that point, I don't know what the actual closing price was, so I must fetch it manually by calling GetTradeHistory so that my local database is accurate.
I think this is in fact what you meant, but that second sentence made me think you might be somehow determining the close info from only the UPDATE_TRADES message?
Ok, time to get some sleep so I can wake up early and get some more work done! I'm sure I'll be back to bug you with more questions later, or at least to let you know how my project is coming along.
