Java Code Examples for com.paritytrading.foundation.ASCII#putLongRight()
The following examples show how to use
com.paritytrading.foundation.ASCII#putLongRight() .
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: CboeFXBookFormatter.java From juncture with Apache License 2.0 | 6 votes |
public void reset() { ASCII.putLongRight(lengthOfMessage, 0); ASCII.putLongRight(numberOfItems, 0); lengthOfMessagePosition = -1; numberOfCurrencyPairsPosition = -1; numberOfPricesPosition = -1; numberOfOrdersPosition = -1; currencyPairs = 0; prices = 0; orders = 0; ASCII.putLeft(currencyPair, " "); buyOrSellIndicator = ' '; ASCII.putLeft(price, " "); }
Example 2
Source File: ITCHSessionTest.java From juncture with Apache License 2.0 | 6 votes |
@Test public void loginRequest() throws Exception { ASCII.putLeft(loginRequest.loginName, "foo"); ASCII.putLeft(loginRequest.password, "bar"); loginRequest.marketDataUnsubscribe = ITCH.TRUE; ASCII.putLongRight(loginRequest.reserved, 0); client.login(loginRequest); while (serverEvents.collect().size() != 1) server.receive(); assertEquals(asList(new LoginRequest( "foo ", "bar ", ITCH.TRUE, 0)), serverEvents.collect()); }
Example 3
Source File: TerminalClient.java From parity with Apache License 2.0 | 6 votes |
static TerminalClient open(InetSocketAddress address, String username, String password, Instruments instruments) throws IOException { Events events = new Events(); OrderEntry orderEntry = OrderEntry.open(address, events); SoupBinTCP.LoginRequest loginRequest = new SoupBinTCP.LoginRequest(); ASCII.putLeft(loginRequest.username, username); ASCII.putLeft(loginRequest.password, password); ASCII.putRight(loginRequest.requestedSession, ""); ASCII.putLongRight(loginRequest.requestedSequenceNumber, 0); orderEntry.getTransport().login(loginRequest); return new TerminalClient(events, orderEntry, instruments); }
Example 4
Source File: Session.java From parity with Apache License 2.0 | 6 votes |
@Override public void logon(FIXConnection connection, FIXMessage message) throws IOException { FIXValue username = message.valueOf(Username); FIXValue password = message.valueOf(Password); if (requiredTagMissing(message, username, "Username(553)")) return; if (requiredTagMissing(message, password, "Password(554)")) return; fix.updateCompID(message); ASCII.putLeft(loginRequest.username, username.asString()); ASCII.putLeft(loginRequest.password, password.asString()); ASCII.putRight(loginRequest.requestedSession, ""); ASCII.putLongRight(loginRequest.requestedSequenceNumber, 0); orderEntry.login(loginRequest); }
Example 5
Source File: OrderEntry.java From parity-extras with Apache License 2.0 | 5 votes |
public void login(String username, String password) throws IOException { SoupBinTCP.LoginRequest request = new SoupBinTCP.LoginRequest(); ASCII.putLeft(request.username, username); ASCII.putLeft(request.password, password); ASCII.putRight(request.requestedSession, ""); ASCII.putLongRight(request.requestedSequenceNumber, 0); transport.login(request); }
Example 6
Source File: CboeFXBookFormatter.java From juncture with Apache License 2.0 | 5 votes |
/** * Start a Market Snapshot message. * * @param buffer a buffer */ public void marketSnapshotStart(ByteBuffer buffer) { state.reset(); // Message Type buffer.put(MESSAGE_TYPE_MARKET_SNAPSHOT); state.lengthOfMessagePosition = buffer.position(); // Length of Message ASCII.putLongRight(state.lengthOfMessage, 0); buffer.put(state.lengthOfMessage); state.numberOfCurrencyPairsPosition = buffer.position(); }
Example 7
Source File: CboeFXBookFormatter.java From juncture with Apache License 2.0 | 5 votes |
/** * End a Market Snapshot message. * * @param buffer a buffer */ public void marketSnapshotEnd(ByteBuffer buffer) { if (state.currencyPairs > 0) { // Number of Currency Pairs ASCII.putLongRight(state.numberOfItems, state.currencyPairs); put(buffer, state.numberOfItems, state.numberOfCurrencyPairsPosition); } if (state.buyOrSellIndicator == BUY) { // Number Of Offer Prices ASCII.putLongRight(state.numberOfItems, 0); buffer.put(state.numberOfItems); } if (state.prices > 0) { // Number of Bid/Offer Prices ASCII.putLongRight(state.numberOfItems, state.prices); put(buffer, state.numberOfItems, state.numberOfPricesPosition); } if (state.orders > 0) { // Number of Bid/Offer Orders ASCII.putLongRight(state.numberOfItems, state.orders); put(buffer, state.numberOfItems, state.numberOfOrdersPosition); } int endPosition = buffer.position(); int lengthOfMessage = endPosition - state.numberOfCurrencyPairsPosition; // Length of Message ASCII.putLongRight(state.lengthOfMessage, lengthOfMessage); put(buffer, state.lengthOfMessage, state.lengthOfMessagePosition); }
Example 8
Source File: ITCHSessionTest.java From juncture with Apache License 2.0 | 5 votes |
@Test public void loginAccepted() throws Exception { ASCII.putLongRight(loginAccepted.sequenceNumber, 1); server.accept(loginAccepted); while (clientEvents.collect().size() != 1) client.receive(); assertEquals(asList(new LoginAccepted(1)), clientEvents.collect()); }
Example 9
Source File: ITCHSessionTest.java From juncture with Apache License 2.0 | 5 votes |
@Test public void instrumentDirectory() throws Exception { ASCII.putLongRight(instrumentDirectory.numberOfCurrencyPairs, 3); ASCII.putLeft(instrumentDirectory.currencyPair[0], "FOO/BAR"); ASCII.putLeft(instrumentDirectory.currencyPair[1], "BAR/BAZ"); ASCII.putLeft(instrumentDirectory.currencyPair[2], "BAZ/FOO"); server.instrumentDirectory(instrumentDirectory); while (clientEvents.collect().size() != 1) client.receive(); assertEquals(asList(new InstrumentDirectory(asList("FOO/BAR", "BAR/BAZ", "BAZ/FOO"))), clientEvents.collect()); }