Acquiring autotrade constraints

Is there a way for the software to acquire the max forex lots, max options, max futures, or max dollar value for each system being traded? Isn’t it necessary to do that to prevent exceeding those limits?

Hi, Greg:



Currently there is no way for your software to request this data directly.



But there’s a reason for this, and it is important. Part of the design philosophy for the autotrade API is that the “smarts” for determining what trades to place, and at what quantities, etc. should reside in C2 servers, and not in your client software.



In fact, under this design paradigm, your program should really contain only the functionality necessary to place orders at a broker, cancel them, and query broker status.



If you follow this, your programming job is much easier. You need only to listen to C2’s instructions and follow them.



For example, in a previous post you mentioned that the quantities returned by C2 for position-sync seemed wrong to you. The system was long X, but C2 told you that you should be long only Y. But in fact I pointed out that the number was not wrong; rather the quantity already had built into it the maximum size constrain requested by the user via the C2 user interface.



So in theory, if you agree with and follow the spirit of this design philosophy, your software should just ask for position-sync data (i.e. “What positions am I supposed to have and at what quantities?”) and the constraints desired by the user will already be baked into the quantities returned by C2. No need for you to know the raw constraints quantities.



Another example: if your software correctly reports to C2 the fill confirmations received by your customer’s broker, then C2 will use that information when sending you orders that must be subsequently placed. You shouldn’t have to worry about deciding what quantities to place; C2 will tell you. It will incorporate the information you have already reported to it. For example, let’s imagine a system recommends closing 50% of a position. C2 will know (for example) that you previously reported opening 4 contracts, and so will tell you to close 2. (Notice how you don’t even need to keep track of the state information regarding the quant previously opened. C2 does that for you.) Similarly, if the system recommends buying 5 contracts to open a position, but C2 knows that your user wants to trade at 100% scaling with a maximum of only 4 contracts, then C2 will tell you to open only 4 contracts (i.e. the quantity it tells you to open will respect the max quantity selected by the user; again - no need for you to know or care what that max quant set by the user is).



In summary, in theory you shouldn’t need or want the raw quantity constraints set by the user via the C2 UI. The C2 autotrade interface will use that information itself when sending you quantity information in the trade signals. Then you can act directly on C2’s instructions without worrying how they were derived.



Again, the idea is to (hopefully) make a programmer’s life easier, by allowing him to focus solely on the broker interface.



I hope this clarifies things a bit.



Matthew

Matthew,

I get the concept and like it. However, your 2nd example has not been my experience even though my software is correctly reporting to C2 the fill confirmations… Even though I had set GREEN FOREX to max 5 contracts, I continued to receive signals beyond that quantity and my software bot them. Then I was out of sync. Is the sync data updated before the signal arrives? I am checking sync data only every 2 minutes whereas signals are checked every 7 seconds. If I receive a new signal, should I store it and then check the sync data to see if it should be executed? Sometimes the signals come rapid fire so maybe your sync server has not caught up with the signal data. What then?

Greg

I don’t really think you should be getting opening signals beyond the user’s max quantity if you are reporting fills to C2. Of course it’s always possible there’s a problem somewhere, so let me know the next time this happens so I can look into it. Specifically I would want to see a log of your poll/response to the c2 server along with time stamps, etc.



Regarding your other question, there shouldn’t be any latency / synchronicity issues, other than rare edge conditions such as your reporting a fill during the exact same moment that C2 is sending you position-sync information. Your proposed scheduling of retrieving signals every 7 seconds while checking sync data every 2 minutes sounds just about right to me.



So I think the best thing is to get a concrete example of a case where customer quantity max constraints don’t seem to respected, and then we can delve into it further and try to see what’s going on. Again, it’s possible that the mistake is on the C2 side of things, but I really need an example to be able to figure out whether that is the case or whether there is something else happening.



Thanks -



Matthew

Ok, I reduced my max forex back down to 5 from 15. The C2 web site shows 15 open long positions for GREEN FOREX so if I understand you correctly, I should not get any more BTO signals until it drops below 5. I will send you a log file if/when that is not the case.

Thanks,

Greg

Matthew,

I reproduced the problem and sent you a synopsis and full log of a concrete example by email.

Thanks,

Greg

Very useful info! I have made a few changes that I’d like you try on a test server before we roll it out to the public. I will email you privately and post here when we confirm it works as expected.