I am currently developing a software that needs to store stock prices and the amount of stocks (sold/purchased) of a given company. Now I am wondering which data types I need to use to store this data. The issue I have with that is that I don't know which numbers (how many decimals) can occur:

  1. Is there any standard on the precision of stock prices, e.g. how many decimals can there be?
  2. I know that there can be fractional shares due to stock splits, dividend reinvestments or just because your broker allows it. Same here: How many decimals can there be at maximum?

Is there any "broker / banking industry" standard on this?

  • $\begingroup$ Is this for accounting? That’s the only use where this matters. Otherwise use float and be done with this $\endgroup$ Jan 16, 2021 at 17:22
  • $\begingroup$ @Aksakalalmostsurelybinary A nitpick, but float is not a good choice for non-integer values that must have an exact decimal representation. You can't, for examlpe, represent 1.3 exactly with a floating-point variable. A "decimal" type is better suited for monetary values and exact decimal fractions. $\endgroup$
    – D Stanley
    Jan 16, 2021 at 22:59
  • 2
    $\begingroup$ @DStanley, true, but I'm saying the exactness is only needed for accounting. $\endgroup$ Jan 16, 2021 at 23:01
  • 2
    $\begingroup$ I’m voting to close this question because as Aksakal said, this seems a question in brokerage firm accounting practices, rather than Quant Finance. It should be addressed to an accountant, and the answer will probably depend on details of your business and operations. $\endgroup$
    – nbbo2
    Jan 17, 2021 at 17:23

3 Answers 3


Giving my 2 cents on your questions: I believe the amount of decimal places is dependent on (the exchange and) the type of financial product. However, an Investopedia article writes:

In 2005, the Securities and Exchange Commission introduced Rule 612, also known as the Sub-Penny Rule. Rule 612 requires the minimum price increments for stocks over \$1.00 to be \$0.01 while stocks under \$1.00 can be quoted in increments of \$0.0001.

This rule can also be found here. Trying to answer your second question, I don't believe there is any industry standard, since Fidelity writes that

Fractional share quantities can be entered out to 3 decimal places (.001 as long as the value of the order is at least $0.01).

But Robinhood and Interactive brokers allow the purchase of fractional shares as small as 0.000001 and 0.0001, respectively, as long as you satisfy the minimum purchase amount. I don't know if this helps.

  • $\begingroup$ thank you, while your 2 cents might not be a final reply (maybe there isn't one at all), the Robinhood sample is quite interesting for me: this won't fit the SQL Server MONEY datatype (4 decimals precisions, not rounding errors etc.) as Interactive Brokers still would have done ): So your answer is already helpful (besides that I am lost now, what's the best way to store such small fractions) $\endgroup$ Jan 16, 2021 at 15:13
  • 1
    $\begingroup$ Asking out of curiosity. I have no experience with SQL, but why not change the datatype to allow for more decimals? Why not change the datatype to DECIMAL(19,6), thus allowing for 6 decimals after the decimal place? $\endgroup$
    – Pleb
    Jan 16, 2021 at 15:26
  • $\begingroup$ Same for me, still new to this and already forgot about it. Guess using DECIMAL would be perfect for me. Thanks for reminding me of DECIMAL :-) I also think you are right that price precision in general depends on the exchange, so likely your answer is the final one, though one still has to figure out which exchange uses the highest precision for prices. $\endgroup$ Jan 16, 2021 at 17:19
  • 1
    $\begingroup$ Pro tip: If this is going to be anywhere near production code, please do read up on the pros and cons of DECIMAL or get in touch with DB pros... If this is for a little project, then don’t worry and just fire away. $\endgroup$ Jan 16, 2021 at 19:37
  • $\begingroup$ @Kermittfrog for now it's a private project. But I am curious. Can you provide more details / recommend specific resources? What could be an alternative? $\endgroup$ Jan 16, 2021 at 23:15

For listed US equities you will need to use a float for quantity and price. Fractional shares will often result from corporate actions (aquisitions, splits, etc).

The sub-penny rule mentioned above is for display purposes. You can't put an order onto a regulated US exchange at anything other than a penny increment. But, you can trade at virtually any price. You will sometimes find that your orders execute at points between two pennies (eg: $17.0025) as you get a price improvement from an executing broker.

NASDAQ will only give you fills with 4 decimal points of precision but it's quite legitimate to have more than that. I don't recall seing more than 6 - but you should always allow room for the unexpected.


I also believe that there is no industry standard that encompasses all cases you will encounter. I can only share some experience with the issue.

My broker E*Trade is showing me number of shares with up to 5 decimal places and prices per share with up to four (true for both last price and cost per share).

Trades are sometimes reported with prices with three decimal places (even though the prices are above $1).

There is SEC Rule 612 (Minimum Pricing Increment) of Regulation NMS requiring prices for securities below USD 1.00 to be quoted with four decimal places and above USD 1.00 with two decimal places. I do not understand how that reconciles with what my broker does.

These are just rules for national exchanges in the US. There are other exchanges in the US and exchanges in many other countries.

There are cryptocurrencies quoted to 8 decimal places in terms of both price and quantity.

Accounting software and financial software sometimes has to deal with historical prices after stock splits. It often adjusts the historical prices by dividing them by the split factors thus making smaller and smaller past prices that need greater and greater precision for representing their prices if you don't want to lose precision.

Very often a broker allows reinvesting of the dividend, where they add fractional shares to your whole number of shares based on the amount paid and price at the time of converting the cash dividend to shares.

Given all this, it may be hard to predict exactly how and in what context your software will be used, and therefore it seems prudent to use at least 4 or 5 or 6 decimal places for prices.

On the other hand, if you allow too much of a precision, you may end up with smaller and smaller so-called odd lots. For example, when selling all stocks in multiple orders, you may end up having a lot with 0.000000001 shares due to rounding. So you may want to introduce deliberate rounding when a number of shares becomes very small in absolute sense.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.