Package com.barchart.util.values.api

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


  }
 
  @Override
  public PriceValue priceGap() {

    final PriceValue priceBid = priceTop(Book.Side.BID);
    if (priceBid.isNull()) {
      return ValueConst.NULL_PRICE;
    }

    final PriceValue priceAsk = priceTop(Book.Side.ASK);
    if (priceAsk.isNull()) {
      return ValueConst.NULL_PRICE;
    }

    return priceAsk.sub(priceBid);

  }
View Full Code Here


    MarketCuvol cuvol = get(CUVOL);

    if (cuvol.isFrozen()) {

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

      final VarCuvol varCuvol = new VarCuvol(instrument, priceStep);
      final VarCuvolLast varCuvolLast = new VarCuvolLast(varCuvol);
View Full Code Here

      }

      final SizeValue size = LIMIT; // inst.get(BOOK_SIZE);
     
      // ValueConverter
      final PriceValue step = ValueBuilder.newPrice(
          instrument.tickSize().mantissa(),
          instrument.tickSize().exponent());

      final VarBook varBook = new VarBook(instrument, type, size, step);
      final VarBookLast varBookLast = new VarBookLast(varBook);
View Full Code Here

      builder.setExchangeCode(inst.get(EXCHANGE_CODE).toString());
    }

    /* price step / increment size / tick size */
    if (inst.contains(TICK_SIZE)) {
      final PriceValue step = inst.get(TICK_SIZE).norm();
      builder.setMinimumPriceIncrement(build(step));
    }

    /* value of a future contract / stock share */
    if (inst.contains(POINT_VALUE)) {
      final PriceValue val = inst.get(POINT_VALUE).norm();
      builder.setContractPointValue(build(val));
    }

    /* display fraction base : decimal(10) vs binary(2), etc. */
    if (inst.contains(DISPLAY_FRACTION)) {
View Full Code Here

    return get(InstrumentField.EXCHANGE_CODE).toString();
  }

  @Override
  public Price tickSize() {
    final PriceValue temp = get(InstrumentField.TICK_SIZE);
    return factory.newPrice(temp.mantissa(), temp.exponent());
  }
View Full Code Here

    return factory.newPrice(temp.mantissa(), temp.exponent());
  }

  @Override
  public Price pointValue() {
    final PriceValue temp = get(InstrumentField.POINT_VALUE);
    return factory.newPrice(temp.mantissa(), temp.exponent());
  }
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

    final long priceStepMantissa = xmlDecimalDecode(frac, tag,
        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);
   
    /* Build Lifetime, currently only have last month/year of instrument from ddf.extras */
    TimeInterval lifetime;
    if(expire == null || expire == Time.NULL) { // Was isNull()
View Full Code Here

    final long priceStepMantissa = xmlDecimalDecode(frac, ats,
        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);
   
    /* Build Lifetime, currently only have last month/year of instrument from ddf.extras */
    TimeInterval lifetime;
    if(expire == null || expire == com.barchart.util.value.impl.ValueConst.NULL_TIME) { // Was isNull()
View Full Code Here

    /* value of a future contract / stock share */
    final String pricePointString = xmlStringDecode(ats, PRICE_POINT_VALUE,  XML_PASS);
    if(pricePointString == null) {
      builder.setContractPointValue(buildDecimal(0,0));
    } else {
      PriceValue pricePoint = ValueBuilder.newPrice(Double
          .valueOf(pricePointString));
      builder.setContractPointValue(buildDecimal(
          pricePoint.mantissa(), pricePoint.exponent()));
    }
   
    /* display fraction base : decimal(10) vs binary(2), etc. */
    builder.setDisplayBase((int)frac.fraction.base());
    builder.setDisplayExponent(frac.fraction.exponent());
 
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.