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

com.paritytrading.parity.client.event.Error Maven / Gradle / Ivy

There is a newer version: 0.5.0
Show newest version
package com.paritytrading.parity.client.event;

import com.paritytrading.parity.net.poe.POE;

public class Error {

    public static final String HEADER = "" +
        "Order ID         Reason\n" +
        "---------------- ------------------";

    private String orderId;
    private byte   reason;

    public Error(Event.OrderRejected event) {
        orderId = event.orderId;
        reason  = event.reason;
    }

    private String describe(byte reason) {
        switch (reason) {
        case POE.ORDER_REJECT_REASON_UNKNOWN_INSTRUMENT:
            return "Unknown instrument";
        default:
            return "";
        }
    }

    public String format() {
        return String.format("%16s %-18s", orderId, describe(reason));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy