Hi,
I was trying to find a way to get:
1) the smallest possible change of the instrument price (EURUSD pip size)
2) the instrument price precision (number of digits after the decimal point)
looking the TradeBar object i couldn't find those information, did I missing anything or am I looking onto the wrong place? Can anyone help me on this, the documentation doesn't say anything about it.
Thanks,
Gianluca
Michael H
decimal argument = 123.456m; int count = BitConverter.GetBytes(decimal.GetBits(argument)[3])[2]; Assert.AreEqual(3, count);
You can calculate the pip size if you have the instrument price precision using a method like this or this. Here's a function that can get all of the significant digits of a decimal type.public static int ComputeSignificantDigits(decimal value) { // get digits before decimal place int before; if (value >= 1) { before = (int) Math.Log10((int) value) + 1; } else { before = 0; } // get digits after decimal place int after = BitConverter.GetBytes(decimal.GetBits(value)[3])[2]; return after + before; } // can be verified with these tests: Assert.AreEqual(0, ComputeSignificantDigits(0m)); Assert.AreEqual(1, ComputeSignificantDigits(1m)); Assert.AreEqual(2, ComputeSignificantDigits(1.0m)); Assert.AreEqual(3, ComputeSignificantDigits(123m)); Assert.AreEqual(4, ComputeSignificantDigits(12.34m)); Assert.AreEqual(5, ComputeSignificantDigits(0.01234m)); Assert.AreEqual(6, ComputeSignificantDigits(00.012345m)); Assert.AreEqual(7, ComputeSignificantDigits(01234560m)); Assert.AreEqual(8, ComputeSignificantDigits(0.00123000m)); Assert.AreEqual(9, ComputeSignificantDigits(123456789m)); // 1234567890 Assert.AreEqual(10, ComputeSignificantDigits(0.0000000000m));
Jared Broad
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.
GianlucaCiocci
GianlucaCiocci
Jared Broad
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.
Michael H
GianlucaCiocci
Winston Smith
Michael H. I beleave base points ( 1/100% ) and pips are different animals... For example 1.8541 - 1.8542 = 1 pip. This is a 5 base points change.
GianlucaCiocci
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!