Back

CSV output of trades

https://screencast.com/t/OsxczOT9

In the CSV output from running a trade backtest, is it possible emit data that is more friendly if imported into a spreadsheet?

- Time appears to be Zulu (Greenwich Mean) but Excel doesn't seem to recognize and convert to local time.

- The option symbol is useful - but if you can additionally emit the strike, expiration, etc. that would save time having to look it up (or write a program to do so) and focus more on whether or not the backtest code is doing what it should.

- And what is the Status column?

Thanks!

Update Backtest








Thank you for your suggestions.
Status column is OrderStatus:

public enum OrderStatus
{
New = 0,
Submitted = 1,
PartiallyFilled = 2,
Filled = 3,
Canceled = 5,
None = 6,

// Order invalidated before it hit the market
//(e.g. insufficient capital)..
Invalid = 7,

CancelPending = 8
}

 

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Excellent. Thanks, Alexandre.

Do the libraries have any lookup functions that can take an option code and return its identifying components (strike, expiration, etc)?

 

0

The options code follows the OSI terminology. 
In Lean, this code is written by the SymbolRepresentation.GenerateOptionTickerOSI method.
Once we get issued to it, we don't need a decoder:

SPY 160219P00201500

SPY: underlying
160219: Expire date (yyMMdd)
P: Put Option
00201500: Strike (in $ multiplied by 1000)


 

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Ok. I think what I was looking for is to take the OSI code and generate the components - but the method right below GenerateOptionTickerOSI, ParseOptionTickerIQFeed, seems to do just what I need.

So you feed the code to latter and you get back an OptionTickerProperties that's filled out with these, no?

 

0

Unfortunatelly, no.
That method parses the IQFeed Options Symbology that is different from the OSI terminology we use in the CVS output. It looks like the old-school symbology that uses letters to represent expire dates. Here is the Wikipedia article that discuss it: Option naming convention.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Got it.

So *is there* a method that parses the OSI code into its components?

 

0

Unfortunatelly, there is not.
However, if we were to implement it, it could look like this:

private Symbol ParseOptionCode(string codeStr)
{
var code = codeStr.Split(' ');

return QuantConnect.Symbol.CreateOption(
underlyingSymbol: code[0],
market: Market.USA,
style: OptionStyle.American,
right: code[1].Substring(7, 1) == "C"
? OptionRight.Call
: OptionRight.Put,
strike: decimal.Parse(code[1].Substring(8)) / 1000m,
expiry: DateTime.ParseExact(
code[1].Substring(0, 6), DateFormat.SixCharacter, null));
}

 

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed