All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.barchart.feed.ddf.message.provider.DF_21_Snap Maven / Gradle / Ivy

/**
 * Copyright (C) 2011-2012 Barchart, Inc. 
 *
 * All rights reserved. Licensed under the OSI BSD License.
 *
 * http://www.opensource.org/licenses/bsd-license.php
 */
package com.barchart.feed.ddf.message.provider;

import static com.barchart.util.common.ascii.ASCII.COMMA;

import java.nio.ByteBuffer;

import com.barchart.feed.base.values.api.PriceValue;
import com.barchart.feed.base.values.api.SizeValue;
import com.barchart.feed.ddf.message.api.DDF_MarketSnapshot;
import com.barchart.feed.ddf.message.api.DDF_MessageVisitor;
import com.barchart.feed.ddf.message.enums.DDF_MessageType;
import com.barchart.feed.ddf.util.HelperDDF;
import com.barchart.feed.ddf.util.enums.DDF_Fraction;

class DF_21_Snap extends BaseMarket implements DDF_MarketSnapshot {

	@Override
	public  Result accept(
			final DDF_MessageVisitor visitor, final Param param) {
		return visitor.visit(this, param);
	}

	DF_21_Snap() {
		super(DDF_MessageType.SNAP_FORE_EXCH); // 21
	}

	DF_21_Snap(final DDF_MessageType messageType) {
		super(messageType);
	}

	// //////////////////////////////////////

	protected long priceAsk = HelperDDF.DDF_EMPTY;
	protected long priceBid = HelperDDF.DDF_EMPTY;

	protected long priceOpen = HelperDDF.DDF_EMPTY;
	protected long priceOpen2 = HelperDDF.DDF_EMPTY;

	protected long priceHigh = HelperDDF.DDF_EMPTY;
	protected long priceLow = HelperDDF.DDF_EMPTY;

	protected long priceClose = HelperDDF.DDF_EMPTY;
	protected long priceClose2 = HelperDDF.DDF_EMPTY;

	protected long priceSettle = HelperDDF.DDF_EMPTY;

	/** last trade price for this day */
	protected long priceLast = HelperDDF.DDF_EMPTY;

	/** last trade price for past day */
	protected long priceLastPrevious = HelperDDF.DDF_EMPTY;

	protected long sizeInterest = HelperDDF.DDF_EMPTY;

	protected long sizeVolume = HelperDDF.DDF_EMPTY;
	protected long sizeVolumePrevious = HelperDDF.DDF_EMPTY;
	
	/** last VWAP price */
	protected long vwap = HelperDDF.DDF_EMPTY;

	// //////////////////////////////////////

	@Override
	public PriceValue getPriceAsk() {
		return HelperDDF.newPriceDDF(priceAsk, getFraction());
	}

	@Override
	public PriceValue getPriceBid() {
		return HelperDDF.newPriceDDF(priceBid, getFraction());
	}

	@Override
	public PriceValue getPriceClose2() {
		return HelperDDF.newPriceDDF(priceClose2, getFraction());
	}

	@Override
	public PriceValue getPriceLast() {
		return HelperDDF.newPriceDDF(priceLast, getFraction());
	}

	@Override
	public PriceValue getPriceLastPrevious() {
		return HelperDDF.newPriceDDF(priceLastPrevious, getFraction());
	}

	@Override
	public PriceValue getPriceOpen2() {
		return HelperDDF.newPriceDDF(priceOpen2, getFraction());
	}

	@Override
	public PriceValue getPriceSettle() {
		return HelperDDF.newPriceDDF(priceSettle, getFraction());
	}

	@Override
	public SizeValue getSizeVolumePrevious() {
		return HelperDDF.newSizeDDF(sizeVolumePrevious);
	}

	@Override
	public PriceValue getPriceClose() {
		return HelperDDF.newPriceDDF(priceClose, getFraction());
	}

	@Override
	public PriceValue getPriceHigh() {
		return HelperDDF.newPriceDDF(priceHigh, getFraction());
	}

	@Override
	public SizeValue getSizeInterest() {
		return HelperDDF.newSizeDDF(sizeInterest);
	}

	@Override
	public PriceValue getPriceLow() {
		return HelperDDF.newPriceDDF(priceLow, getFraction());
	}

	@Override
	public PriceValue getPriceOpen() {
		return HelperDDF.newPriceDDF(priceOpen, getFraction());
	}

	@Override
	public SizeValue getSizeVolume() {
		return HelperDDF.newSizeDDF(sizeVolume);
	}
	
	@Override
	public final PriceValue getVWAP() {
		return HelperDDF.newPriceDDF(vwap, getFraction());
	}

	/*
	 * ,(,)()||
	 * 
	 * ,,,,,,
	 * 
	 * ,,,,,
	 * 
	 * ,,,
	 * 
	 * ||||




© 2015 - 2024 Weber Informatics LLC | Privacy Policy