Java Code Examples for net.openhft.chronicle.bytes.BytesIn#readLong()

The following examples show how to use net.openhft.chronicle.bytes.BytesIn#readLong() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NewOrderSingle.java    From Chronicle-Queue-Demo with Apache License 2.0 6 votes vote down vote up
@Override
public void readMarshallable(BytesIn in) {
    super.readMarshallable(in);
    if (PREGENERATED_MARSHALLABLE) {
        int version = (int) in.readStopBit();
        if (version == MASHALLABLE_VERSION) {
            symbol = in.readLong();
            transactTime = in.readLong();
            orderQty = in.readDouble();
            price = in.readDouble();
            side = (BuySell) in.readObject(BuySell.class);
            ordType = (OrderType) in.readObject(OrderType.class);
            clOrdID = (String) in.readObject(String.class);
        }
    }
}
 
Example 2
Source File: ExecutionReport.java    From Chronicle-Queue-Demo with Apache License 2.0 6 votes vote down vote up
@Override
public void readMarshallable(BytesIn in) {
    super.readMarshallable(in);
    if (PREGENERATED_MARSHALLABLE) {
        int version = (int) in.readStopBit();
        if (version == MASHALLABLE_VERSION) {
            symbol = in.readLong();
            transactTime = in.readLong();
            orderQty = in.readDouble();
            price = in.readDouble();
            orderID = in.readLong();
            lastPx = in.readDouble();
            leavesQty = in.readDouble();
            cumQty = in.readDouble();
            avgPx = in.readDouble();
            side = (BuySell) in.readObject(BuySell.class);
            ordType = (OrderType) in.readObject(OrderType.class);
            clOrdID = (String) in.readObject(String.class);
            text = (String) in.readObject(String.class);
        } else {
            throw new IllegalStateException("Unknown version " + version);
        }
    }
}
 
Example 3
Source File: SymbolPositionRecord.java    From exchange-core with Apache License 2.0 5 votes vote down vote up
public SymbolPositionRecord(long uid, BytesIn bytes) {
    this.uid = uid;

    this.symbol = bytes.readInt();
    this.currency = bytes.readInt();

    this.direction = PositionDirection.of(bytes.readByte());
    this.openVolume = bytes.readLong();
    this.openPriceSum = bytes.readLong();
    this.profit = bytes.readLong();

    this.pendingSellSize = bytes.readLong();
    this.pendingBuySize = bytes.readLong();
}
 
Example 4
Source File: RollingCycleTest.java    From Chronicle-Queue with Apache License 2.0 5 votes vote down vote up
@Override
public void readMarshallable(@NotNull BytesIn bytes) throws IORuntimeException {
    _name = bytes.readUtf8();
    _value1 = bytes.readLong();
    _value2 = bytes.readLong();
    _value3 = bytes.readLong();
}
 
Example 5
Source File: CHMUseCasesTest.java    From Chronicle-Map with Apache License 2.0 5 votes vote down vote up
@Override
public void readMarshallable(@NotNull BytesIn in) throws IllegalStateException {
    long magic = in.readLong();
    if (magic != MAGIC)
        throw new AssertionError("Start " + Long.toHexString(magic));
    text = in.readUTFΔ();
    number = in.readInt();
    long magic2 = in.readLong();
    if (magic2 != MAGIC2)
        throw new AssertionError("End " + Long.toHexString(magic2));
}
 
Example 6
Source File: OrderCancelReject.java    From Chronicle-Queue-Demo with Apache License 2.0 5 votes vote down vote up
@Override
public void readMarshallable(BytesIn in) {
    super.readMarshallable(in);
    if (PREGENERATED_MARSHALLABLE) {
        int version = (int) in.readStopBit();
        if (version == MASHALLABLE_VERSION) {
            clOrdID = (String) in.readObject(String.class);
            symbol = in.readLong();
            reason = (String) in.readObject(String.class);
        } else {
            throw new IllegalStateException("Unknown version " + version);
        }
    }
}
 
Example 7
Source File: AbstractEvent.java    From Chronicle-Queue-Demo with Apache License 2.0 5 votes vote down vote up
@Override
public void readMarshallable(BytesIn in) {
    if (PREGENERATED_MARSHALLABLE) {
        int version = (int) in.readStopBit();
        if (version == MASHALLABLE_VERSION) {
            sender = in.readLong();
            target = in.readLong();
            sendingTime = in.readLong();
        } else {
            throw new IllegalStateException("Unknown version " + version);
        }
    } else {
        super.readMarshallable(in);
    }
}
 
Example 8
Source File: CancelOrderRequest.java    From Chronicle-Queue-Demo with Apache License 2.0 5 votes vote down vote up
@Override
public void readMarshallable(BytesIn in) {
    super.readMarshallable(in);
    if (PREGENERATED_MARSHALLABLE) {
        int version = (int) in.readStopBit();
        if (version == MASHALLABLE_VERSION) {
            clOrdID = (String) in.readObject(String.class);
            symbol = in.readLong();
        } else {
            throw new IllegalStateException("Unknown version " + version);
        }
    }
}
 
Example 9
Source File: CoreSymbolSpecification.java    From exchange-core with Apache License 2.0 5 votes vote down vote up
public CoreSymbolSpecification(BytesIn bytes) {
    this.symbolId = bytes.readInt();
    this.type = SymbolType.of(bytes.readByte());
    this.baseCurrency = bytes.readInt();
    this.quoteCurrency = bytes.readInt();
    this.baseScaleK = bytes.readLong();
    this.quoteScaleK = bytes.readLong();
    this.takerFee = bytes.readLong();
    this.makerFee = bytes.readLong();
    this.marginBuy = bytes.readLong();
    this.marginSell = bytes.readLong();
}
 
Example 10
Source File: SingleUserReportResult.java    From exchange-core with Apache License 2.0 5 votes vote down vote up
private Position(BytesIn bytes) {

            this.quoteCurrency = bytes.readInt();

            this.direction = PositionDirection.of(bytes.readByte());
            this.openVolume = bytes.readLong();
            this.openPriceSum = bytes.readLong();
            this.profit = bytes.readLong();

            this.pendingSellSize = bytes.readLong();
            this.pendingBuySize = bytes.readLong();
        }
 
Example 11
Source File: SingleUserReportResult.java    From exchange-core with Apache License 2.0 5 votes vote down vote up
private SingleUserReportResult(final BytesIn bytesIn) {
        this.uid = bytesIn.readLong();
//        this.userProfile = bytesIn.readBoolean() ? new UserProfile(bytesIn) : null;
        this.userStatus = bytesIn.readBoolean() ? UserStatus.of(bytesIn.readByte()) : null;
        this.accounts = bytesIn.readBoolean() ? SerializationUtils.readIntLongHashMap(bytesIn) : null;
        this.positions = bytesIn.readBoolean() ? SerializationUtils.readIntHashMap(bytesIn, Position::new) : null;
        this.orders = bytesIn.readBoolean() ? SerializationUtils.readIntHashMap(bytesIn, b -> SerializationUtils.readList(b, Order::new)) : null;
        this.queryExecutionStatus = QueryExecutionStatus.of(bytesIn.readInt());
    }
 
Example 12
Source File: Order.java    From exchange-core with Apache License 2.0 5 votes vote down vote up
public Order(BytesIn bytes) {


        this.orderId = bytes.readLong(); // orderId
        this.price = bytes.readLong();  // price
        this.size = bytes.readLong(); // size
        this.filled = bytes.readLong(); // filled
        this.reserveBidPrice = bytes.readLong(); // price2
        this.action = OrderAction.of(bytes.readByte());
        this.uid = bytes.readLong(); // uid
        this.timestamp = bytes.readLong(); // timestamp
//        this.userCookie = bytes.readInt();  // userCookie

    }
 
Example 13
Source File: OrderBookDirectImpl.java    From exchange-core with Apache License 2.0 5 votes vote down vote up
public DirectOrder(BytesIn bytes) {


            this.orderId = bytes.readLong(); // orderId
            this.price = bytes.readLong();  // price
            this.size = bytes.readLong(); // size
            this.filled = bytes.readLong(); // filled
            this.reserveBidPrice = bytes.readLong(); // price2
            this.action = OrderAction.of(bytes.readByte());
            this.uid = bytes.readLong(); // uid
            this.timestamp = bytes.readLong(); // timestamp
            // this.userCookie = bytes.readInt();  // userCookie

            // TODO
        }
 
Example 14
Source File: UserProfile.java    From exchange-core with Apache License 2.0 4 votes vote down vote up
public UserProfile(BytesIn bytesIn) {

        this.uid = bytesIn.readLong();

        // positions
        this.positions = SerializationUtils.readIntHashMap(bytesIn, b -> new SymbolPositionRecord(uid, b));

        // adjustmentsCounter
        this.adjustmentsCounter = bytesIn.readLong();

        // account balances
        this.accounts = SerializationUtils.readIntLongHashMap(bytesIn);

        // suspended
        this.userStatus = UserStatus.of(bytesIn.readByte());
    }
 
Example 15
Source File: OrdersBucketNaive.java    From exchange-core with Apache License 2.0 4 votes vote down vote up
public OrdersBucketNaive(BytesIn bytes) {
    this.price = bytes.readLong();
    this.entries = SerializationUtils.readLongMap(bytes, LinkedHashMap::new, Order::new);
    this.totalVolume = bytes.readLong();
}
 
Example 16
Source File: SingleUserReportQuery.java    From exchange-core with Apache License 2.0 4 votes vote down vote up
public SingleUserReportQuery(final BytesIn bytesIn) {
    this.uid = bytesIn.readLong();
}
 
Example 17
Source File: RiskEngine.java    From exchange-core with Apache License 2.0 4 votes vote down vote up
public LastPriceCacheRecord(BytesIn bytes) {
    this.askPrice = bytes.readLong();
    this.bidPrice = bytes.readLong();
}
 
Example 18
Source File: QueueMultiThreadedJLBHBenchmark.java    From Chronicle-Queue with Apache License 2.0 4 votes vote down vote up
@Override
public void readMarshallable(BytesIn bytes) throws IORuntimeException {
    ts = bytes.readLong();
    bytes.read(filler);
}