How to convert QuoteBar to float

Hello ,

I am new to the platform and I have trying to implement some ideas for trading. At the moment my ideas require to be able to read the values of the instruments as floats but when Iog them the type is QuoteBar so I was wondering if there is a way to cast it into float. I have tried kind of the two obvious ones numpy.array(.) and float(.) but no luck. Any pointers would be appreciated.

Update Backtest

Hi Carlos,


Welcome to QC, I'm also relatively new here. Are you working with Forex securities? Since a QuoteBar is comprised of a whole lot of information, you'll need to specify what part of the QuoteBar you want to manipulate. Take a look at the LEAN API documentation, do a search for 'QuoteBar' to see what its properties are:

For example, specifying 'QuoteBar.Close' would give you the close price (midpoint between the Ask and Bid OHLC bars for that time period I think?). Specifying 'QuoteBar.Ask' would return the ask bar only, for which you could then get the close. Hope that helps you. 


Hi Joel,

Thanks for the prompt input that should give me enough information to continue. 




Update Backtest


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.


This discussion is closed