Dear QuantConnect Community,

We hope this message finds you well and filled with excitement for the latest enhancements we've added to our platform. We are thrilled to introduce the new property, TradingDaysPerYear, which promises to elevate the quality of statistics in your algorithms.

In the past, we used a fixed value of 252 for all brokerages, but with the continuous growth of our community and the increasing number of brokerages, we realized the need for a more dynamic approach. Enter TradingDaysPerYear – a property that adapts to the nature of your brokerage, making our statistics even more accurate.

Now, depending on your brokerage type, this property allows for customization. While typical brokerages continue to use 252 as their value, crypto brokerages, which operate 24/7, benefit from a value of 365. This adjustment ensures that our statistics align with the unique trading hours of different brokerages, providing you with more precise insights into your algorithm's performance.

To seamlessly integrate this improvement into your algorithms, you have two convenient ways to set up the TradingDaysPerYear property.

SetBrokerageModel Method (C# Example):

  • This method automatically configures the TradingDaysPerYear property to 365 days when dealing with crypto-type exchanges.
  • Use the SetBrokerageModel method to specify your brokerage and account type:
SetBrokerageModel(BrokerageName.Coinbase, AccountType.Cash);

Settings Property (C# Example):

  • This approach allows you to use a custom value, ensuring flexibility in adapting to the specific needs of your algorithm or when testing with a particular trading day count.
  • Alternatively, you can directly set the TradingDaysPerYear property using the Settings class:
Settings.TradingDaysPerYear = 200; // Custom value for a specific brokerage or testing purposes

 

The impact of this update is significant, especially on key statistics such as Annual Variance, Annual Standard Deviation, Alpha, Sharpe Ratio, Sortino Ratio, Tracking Error, Information Ratio, Treynor Ratio, and Probabilistic Sharpe Ratio. These values now reflect the specific working days of your brokerage, providing a more accurate representation of your algorithm's performance.

For those eager to delve deeper into the technical details, you can find a comprehensive overview of the changes in our GitHub pull request: GitHub Pull Request #7690.

We're committed to continually improving the QuantConnect experience, and this update is a testament to our dedication. Thank you for being a part of our vibrant community, and we look forward to seeing the positive impact this enhancement will have on your algorithmic trading journey.

Happy coding!

Best regards,

Roman

The QuantConnect Team