Package com.barchart.util.values.api

Examples of com.barchart.util.values.api.PriceValue


  }

  protected final boolean isValidPrice(final PriceValue price) {

    //TODO Value Converter
    final PriceValue priceStep = ValueBuilder.newPrice(
        instrument.tickSize().mantissa(),
        instrument.tickSize().exponent());

    if (!price.equalsScale(priceStep)) {
      log.error("not normalized");
      return false;
    }

    final long count = price.count(priceStep);

    final PriceValue priceTest = priceStep.mult(count);

    if (!price.equals(priceTest)) {
      log.error("does not fit step");
      return false;
    }
View Full Code Here


        PRICE_TICK_INCREMENT, XML_STOP);

    final String pricePointString = xmlStringDecode(ats, PRICE_POINT_VALUE,
        XML_PASS);

    PriceValue pricePoint = ValueBuilder.newPrice(0);

    if (pricePointString != null) {

      try {
        pricePoint = ValueBuilder.newPrice(Double
            .valueOf(pricePointString));
      } catch (Exception e) {
      }

    }

    final PriceValue priceStep = newPrice(priceStepMantissa,
        frac.decimalExponent);

    /* GENERIC */

    set(InstrumentField.ID, newText(symbolUni));
View Full Code Here

        continue;
      }

      final int place = index + MarketBook.ENTRY_TOP;

      final PriceValue price = HelperDDF.newPriceDDF(
          priceBidArray[index], frac);

      final SizeValue size = HelperDDF.newSizeDDF(sizeBidArray[index]);

      final MarketDoBookEntry entry = new DefBookEntry(MODIFY, Book.Side.BID,
          Book.Type.DEFAULT, place, price, size);

      entries[entryIndex++] = entry;

    }

    for (int index = 0; index < countAsk; index++) {

      if (sizeAskArray[index] == 0) {
        continue;
      }

      final int place = index + 1;

      final PriceValue price = HelperDDF.newPriceDDF(
          priceAskArray[index], frac);

      final SizeValue size = HelperDDF.newSizeDDF(sizeAskArray[index]);

      final MarketDoBookEntry entry = new DefBookEntry(MODIFY, Book.Side.ASK,
View Full Code Here

   */
  @Override
  public final MarketDoBookEntry entry(final Instrument instrument,
      final Book.Side side) {

    final PriceValue price;
    final SizeValue size;

    switch (side) {
    case BID:
      price = getPriceBid();
View Full Code Here

        PRICE_TICK_INCREMENT, XML_STOP);

    final String pricePointString = xmlStringDecode(tag, PRICE_POINT_VALUE,
        XML_PASS);

    PriceValue pricePoint = ValueBuilder.newPrice(0);

    if (pricePointString != null) {

      try {
        pricePoint = ValueBuilder.newPrice(Double
            .valueOf(pricePointString));
      } catch (Exception e) {
      }

    }

    final PriceValue priceStep = newPrice(priceStepMantissa,
        frac.decimalExponent);

    /* GENERIC */

    set(InstrumentField.ID, newText(symbolUni));
View Full Code Here

    for (int index = 0; index < length; index++) {
      final long sizeValue = array[index];
      if (sizeValue > 0) {
        final int place = entryIndex + 1;
        final long mantissa = priceFirst + index * priceStep;
        final PriceValue price = ValueBuilder.newPrice(mantissa,
            exponent);
        final SizeValue size = ValueBuilder.newSize(sizeValue);
        final MarketDoCuvolEntry entry = new DefCuvolEntry(
            place, price, size);
        entries[entryIndex++] = entry;
View Full Code Here

  }

  @Override
  public final boolean equals(final Object thatValue) {
    if (thatValue instanceof PriceValue) {
      PriceValue that = (PriceValue) thatValue;
      return this.compareTo(that) == 0;
    }
    return false;
  }
View Full Code Here

  }

  public static final boolean isStrictMultiple(final PriceValue priceTest,
      final PriceValue priceStep) {
    final long count = priceTest.count(priceStep);
    final PriceValue priceBack = priceStep.mult(count);
    if (priceBack.equals(priceTest)) {
      return true;
    } else {
      return false;
    }
  }
View Full Code Here

TOP

Related Classes of com.barchart.util.values.api.PriceValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.