I e-mailed both C2 and Matthew about a possible bug in hypotheticalEquity, but received no response (as usual). The lack of customer service to developers really leaves a lot to be desired.
Anyway, my test system started with $10K and has made 45 trades so far. It is currently approximately $-600 but returns the below when querying for hypotheticalEquity before open this morning:
<collective2>
<hypotheticalEquity>
<system>
<systemid>40720168</systemid>
<systemname>Swinger</systemname>
<totalequityavail>2960.90</totalequityavail>
<cash>3170.90</cash>
<equity>-210</equity>
<marginused>0</marginused>
</system>
</hypotheticalEquity>
</collective2>
Now, correct me if I’m wrong, but shouldn’t the <totalequityavail> value represent the actual account cash and equity of all open positions and not whatever bizarre value it is returning? That would be approximately $9400 which is indeed what you would see when subscribing to the system – which seems the only place to actually find such a value. Where did the other $7K disappear to? The “Cash & Margin” on the system details page is no more helpful for this purpose either.
This isn’t a minor quibble as any position sizing relies on receiving an accurate total account value. I should also point out that before any trades were placed, <totalequityavail> was returning exactly $10K.
Anyone?
J. -
Probably the confusion stems from the fact that C2 uses terms that mean slightly different things on C2 than they do anywhere else in the world. Of course, we hope the rest of the world will correct their error soon. In the meantime, let me explain what the terminology on C2 means and why C2 does things the way it does.
The reason for our non-standard approach is that, with your C2 Model Account, you have a single, universal account that you can use to buy and sell all sorts of instruments – stocks, options, futures, and forex. As you know, each instrument has its own regulatory regime and margining system. Other (smarter?) brokers such as Interactive Brokers display your account’s available margin in different buckets depending on instrument. So for example, in your IB account you might see Available Futures Margin, Available Stock Margin, etc.
For a variety of historical legacy reasons, C2 did not choose to do things in this way. Rather, we have one single bucket of available margin. But that bucket is reduced or increased differently depending on the instrument you are trading and the position you are holding.
So, from a math point of view, your “total equity available” (elsewhere referred to as buying power) is your cash plus your equity minus your margin. When you buy a stock on margin (which happens automatically at C2 for stocks priced over $5 dollars), your cash is reduced by the price of the stock multiplied by the number of shares divided by 2. That last part is crucial: the divided by 2 means you can essentially buy twice as much stock as you have available cash.
So, for example, if you start with $1,000 and buy 20 shares of $50 stock, your cash is reduced by $500 dollars - not $1,000.
Earlier in this post I said that your buying power is your cash plus your equity minus your margin.
What do I mean by equity? Your equity is your open position profit. This is universal across all instruments.
What do I mean by “minus your margin?” What is that last “margin?” That is a number that C2 defines in a special way: it is either the margin required to hold open your futures and options positions, or it is the margin used to hold open short stock positions. Long stock positions do not affect this margin bucket.
By doing things in this (admittedly somewhat unusual) way, we can use a single “buying power” bucket for all instrument classes. Remember that buying power is cash plus equity minus margin. The trick is that each instrument class affects those three different numbers in different ways.
Finally there is one last source of confusion: in C2 various programmer’s APIs we refer to <totalequityavail>. The use of the term “equity” was not well considered. We probably should have called it “buyingpoweravailable” to avoid confusing the number with the “equity” component I describe above. In any case, it will probably be helpful for you to make a mental substitution of “buying power available” for <totalequityavail> when using the API.