Format numbers before writing to json

Issue #544 new
Desrever Nu created an issue

or we risk ending up with default notation.

For instance now we have this in the default config :

"priceIncrement":3.0E-4,

I suggest the following :

Utils.formatNumber(<yournumber>,Settings.DEFAULT_PRECISION) 

Comments (10)

  1. Desrever Nu reporter

    I also tried a couple of solutions without success. Scientific notation is handled correctly when read from file to UI.

    The only case where this could create issues is when the user types a small number in the UI and then wants to edit the config manually.

    Its a very unlikely situation, we can postpone it

  2. Benjamin Cordes

    can be achieved like this. but currently I can't reproduce, since Json String output works correctly also. I assume this happens only when we post via the UI.

    GsonBuilder gson = new GsonBuilder().setPrettyPrinting();
     gson.setLongSerializationPolicy( LongSerializationPolicy.STRING );
    
  3. Log in to comment