SmartQuant Discussion
http://www.smartquant.com/forums/

Position.QtyBought, QtySold, QtySoldShort...
http://www.smartquant.com/forums/viewtopic.php?f=42&t=7179
Page 1 of 1

Author:  Olive [ Tue Dec 02, 2008 2:58 am ]
Post subject:  Position.QtyBought, QtySold, QtySoldShort...

Does these variables represent the net quantity/status of my current position, or an accumulated counter since the positoion is opened?

Say I bought 1000 DELL, then sold 2000 DELL...what would be the QtyBought, QtySold, and QTySoldShort respectively?

Author:  Baraz Sergey [ Tue Dec 02, 2008 1:58 pm ]
Post subject: 

Hi,

Quote:
Say I bought 1000 DELL, then sold 2000 DELL...what would be the QtyBought, QtySold, and QTySoldShort respectively?


In the current version the values are following:
QtyBought = 1000;
QtySold= 2000;
QtySoldShort = 0;
Qty = 1000;

which is incorrect, so in the next version the values will be:
QtyBought = 1000;
QtySold= 1000;
QtySoldShort = 1000;
Qty = 1000;

Regards,
Sergey.

Author:  Olive [ Wed Dec 03, 2008 1:49 am ]
Post subject: 

Thanks Sergey.

Few more questions related to this...

1) So in the example earlier, say I bought another 1000 to cover my short, would QtyBought be 2000 and Qty be zero? In other words, would QtyBought, Sold, SoldShort keep accumulating quantity of all the transactions in this position, and Qty is the current/net quantity(regardless of short or long)?

2) I was expecting "Amount" to be the position size in dollar...but it appears to be the same as "Qty"...only it shows a negative if we are in short position...correct? Is so, to close a position, I suppose I can do:

if (myPosition.Amount > 0)
sell( Qty, "ABC");
else if( myPosition.Amount < 0)
buy( Qty, "ABC"); // to cover

?

3) I tried to look up the API document for "Side", but it gave me an error...what is it: ('long', 'short'...'buy', 'sell'?). What would it be in my example earlier?

Author:  Baraz Sergey [ Wed Dec 03, 2008 6:07 pm ]
Post subject: 

Hi,

1)
Quote:
So in the example earlier, say I bought another 1000 to cover my short, would QtyBought be 2000 and Qty be zero? In other words, would QtyBought, Sold, SoldShort keep accumulating quantity of all the transactions in this position, and Qty is the current/net quantity(regardless of short or long)?

Yes and yes.

2) 3) You are right, but you can do the same by checking if (Position.Side == PositionSide.Long) or PositionSide.Short.

Regards,
Sergey.

Author:  Olive [ Wed Dec 03, 2008 6:25 pm ]
Post subject: 

You've been very helpful, thanks!!

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/