## Price precision & pip size

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

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.

You could try using something like this to compute the number of digits after the decimal point:

``` 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)); ```
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.

@GianlucaCiocci - I think perhaps you're looking for Tick data? I put a new template for this in the QC University this morning.

TradeBar values are midpoints between the bid and ask prices. The Tick data contains the actual bid and ask prices.
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.

Hi Michael,
thanks a lot for your help. About getting price digits, what you suggested it's more or less what I have implemented and I will have a look on how to calculate the pip size onto the documentation. Great!

Will those those functions be part of the TradeBars object in future? What do you reckon? Is it the right place to put them?

Gianluca
0

Hi Jared,
thanks for this new template, Tick data is not what I was looking for. Talking about "pip price", I meant to get the price value for a single pip change of a currency pair. A tick is the smallest unit of change in a quote.

Wikipedia comes to help here
if a trader buys 5 standard lots (i.e. 5 Ã— 100,000 = 500,000) of EUR/USD, paying USD 650,000 and closes the position after the 10 pips' appreciation, the trader will receive USD 650,500 with a profit of USD 500 (i.e. 500,000 (5 standard lots) Ã— 0.0010 = USD 500)

The pip price in this example is USD 50 and this is what I was looking for into the TradeBar object.

Thanks,
Gianluca
0

Understood, if I understand correctly the real sig-fig's would be delta of the bid or ask values - I think its 5sf for FXCM. The "price" value is a manufactured midpoint by QuantConnect and would show more resolution than actually happens. i.e. For forex tick/TradeBar Price = bid + (ask-bid)/2;

For stocks ticks are the actual trades; but because FX is too liquid we never get the trades - just the changes in bid and ask. Check out the Lean demo data: https://github.com/QuantConnect/Lean/tree/master/Data/forex/tick/eurusd
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.

@GianlucaCiocci

I believe in the example the pip price would be\$10, which it always is for instruments priced in USD, assuming a \$100k lot size. A pip is a percentage in point, which is 1/100 %. So for a lot size of 100,000 * 0.0001 = \$10. In the example they're looking at 5 lots, so it was \$50 on the trade.
1

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

Correct! :)
1

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.

0

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.