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

openfeed-client.1.0.16.source-code.openfeed_api.proto Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (C) 2011-2017 Barchart, Inc. 
 *
 * All rights reserved. Licensed under the OSI BSD License.
 *
 * http://www.opensource.org/licenses/bsd-license.php
 */

syntax = "proto3";

package org.openfeed;

option java_multiple_files = true;
option java_generate_equals_and_hash = true;
option optimize_for = SPEED;

import "openfeed_instrument.proto";
import "openfeed.proto";

// //////////////////
// Server API
// //////////////////

/// Openfeed Server request
message OpenfeedGatewayRequest {
  oneof data {
    LoginRequest loginRequest = 1;
    LogoutRequest logoutRequest = 2;
    SubscriptionRequest subscriptionRequest = 3;
    InstrumentRequest instrumentRequest = 4;
    InstrumentReferenceRequest instrumentReferenceRequest = 5;
    ExchangeRequest exchangeRequest = 6;
    ListSubscriptionsRequest listSubscriptionsRequest = 7;
  }
}
/// Openfeed Server Response
message OpenfeedGatewayMessage {
  oneof data {
    LoginResponse loginResponse = 1;
    LogoutResponse logoutResponse = 2;
    InstrumentResponse instrumentResponse = 3;
    InstrumentReferenceResponse instrumentReferenceResponse = 4;
    SubscriptionResponse subscriptionResponse = 5;

    MarketStatus marketStatus = 6;
    HeartBeat heartBeat = 7;
    InstrumentDefinition instrumentDefinition = 8;
    MarketSnapshot marketSnapshot = 9;
    MarketUpdate marketUpdate = 10;
    VolumeAtPrice volumeAtPrice = 11;
    Ohlc ohlc = 12;
    ExchangeResponse exchangeResponse = 13;
    InstrumentAction instrumentAction = 14;
    ListSubscriptionsResponse listSubscriptionsResponse = 15;
  }
}

// ///////////
// Enums
// //////////

enum Result {
  UNKNOWN_RESULT = 0;
  SUCCESS = 1;
  INSTRUMENTS_NOT_FOUND = 112;
  JWT_EXPIRED = 113;
  JWT_INVALID = 114;
  DUPLICATE_LOGIN = 115;
  INVALID_SYMBOL = 116;
  INVALID_MARKET_ID = 117;
  INVALID_EXCHANGE = 118;
  INVALID_CHANNEL_ID = 119;
  MALFORMED_MESSAGE = 120;
  UNEXPECTED_MESSAGE = 121;
  NOT_SUBSCRIBED = 122;
  DUPLICATE_SUBSCRIPTION = 123;
  INVALID_CREDENTIALS = 124;
  INSUFFICIENT_PRIVILEGES = 125;    
  AUTHENTICATION_REQUIRED = 126;    
  GENERIC_FAILURE = 127;
  INVALID_USERNAME = 128;
}
enum SubscriptionType {
	ALL = 0;
	QUOTE = 1;
	QUOTE_PARTICIPANT = 2;
	DEPTH_PRICE = 3;
	DEPTH_ORDER = 4;
	TRADES = 5;
	CUMULATIVE_VOLUME = 6;
	OHLC = 7;
	OHLC_NON_REGULAR = 8;
	SETTLEMENT = 9;
}

////////////////////
// Serivce Messages
///////////////////
message Status {
  Result result = 1;
  string message = 2;
  Service service = 3;
}

/// Login
message LoginRequest {
  sint64 correlationId = 1;
  string username = 2;
  string password = 3;
  string clientVersion = 4;
  sint32 protocolVersion = 5;
  /// JSON Web Token
  string jwt = 6;
}
message LoginResponse {
  sint64 correlationId = 1;
  Status status = 2;
  string token = 3;
}
/// Logout
message LogoutRequest  {
  sint64 correlationId = 1;
  string token = 3;
}
message LogoutResponse {
  sint64 correlationId = 1;
  Status status = 2;
}

/// Instrument Definition(s), will stream InstrumentDefinition(s)
message InstrumentRequest {
  sint64 correlationId = 1;
  string token = 2;
  /// Filter on these instrument types
  repeated InstrumentDefinition.InstrumentType instrumentType = 3;
  /// Filter on these spread types
  repeated string spreadType = 4;
  /// If version >= 1 then will send InstrumentDefinition in the InstrumentResponse
  sint32 version = 5;
  oneof request {
   string symbol = 10;
   sint64 marketId = 11;
   string exchange = 12;
   sint32 channelId = 13;
  }
}
message InstrumentResponse {
  sint64 correlationId = 1;
  Status status = 2;
  sint32 numberOfDefinitions = 3;
  //
  string symbol = 4;
  sint64 marketId = 5;
  string exchange = 6;
  sint32 channelId = 7;
  sint32 exchangeId = 8;
  /// Will be set if InstrumentRequest.version >= 1
  InstrumentDefinition instrumentDefinition = 15;
}

/// Instrument References, returns InstrumentReferenceResponse(s)
message InstrumentReferenceRequest {
  sint64 correlationId = 1;
  string token = 2;
  oneof request {
   string symbol = 10;
   sint64 marketId = 11;
   string exchange = 12;
   sint32 channelId = 13;
  }
}
message InstrumentReferenceResponse {
  sint64 correlationId = 1;
  Status status = 2;
  sint32 numberOfDefinitions = 3;
  //
  sint32 channelId = 4;
  sint64 marketId = 5;
  string symbol = 6;
  string exchange = 7;
  string ddfSymbol = 8;
  string ddfExchange = 9; 
  string ddfBaseCode = 10; 
  string exchangeSymbol = 11;
  sint32 exchangeId = 12;
}

/// Exchange Request, returns ExchangeResponse.  Gives available exchanges.
message ExchangeRequest {
  sint64 correlationId = 1;
  string token = 2;
}
message ExchangeResponse {
  sint64 correlationId = 1;
  Status status = 2;
  repeated Exchange exchanges = 3;
  message Exchange {
    string code = 1;
    string description = 2;
    repeated string aliases = 3;
    sint32 exchangeId = 4;
  }
}

/// Symbol type for the subscription filter.
enum SymbolType {
  BARCHART = 0;
  EXCHANGE = 1;
}

/// Bulk subscription filter.
message BulkSubscriptionFilter {
  /// Type of the symbol: Barchart or Exchange. Barchart is the default.
  SymbolType symbolType = 1;
  /// regular expression pattern for the symbol
  string symbolPattern = 2;
}

/// Subscription Request
message SubscriptionRequest {
  /// Client-assigned id for this request.  Response will include same id
  sint64 correlationId = 1;
  string token = 2;
  /// Preferred service (realtime or delayed). REAL_TIME is the default.
  Service service = 3;
  bool unsubscribe = 4;
  repeated Request requests = 5;
  message Request {
    oneof data {
       string symbol = 1;
       sint64 marketId = 2;
       string exchange = 3;
       sint32 channelId = 4;
    }
    repeated SubscriptionType subscriptionType = 10;
    /// 0 = send only current snapshot once, else send at interval seconds 
    sint32 snapshotIntervalSeconds = 11;
    /// Spreads and Options must be explicitly requested.
    repeated InstrumentDefinition.InstrumentType instrumentType = 12;
    /// Filter for the exchange and channel subscriptions.
    repeated BulkSubscriptionFilter bulkSubscriptionFilter = 13;
    /// Filter for Spread Types
    repeated string spreadTypeFilter = 14;
    /// Do not send instrument(s) on successful subscription
    bool subscriptionDoNotSendInstruments = 15;
    /// Do not send market snapshot(s) on successful subscription
    bool subscriptionDoNotSendSnapshots = 16;
   }
}
message SubscriptionResponse {
  sint64 correlationId = 1;
  Status status = 2;
  string symbol = 3;
  sint64 marketId = 4;
  string exchange = 5;
  sint32 channelId = 6;
  sint32 numberOfDefinitions = 7;
  SubscriptionType subscriptionType = 8;
  bool unsubscribe = 9;
  sint32 snapshotIntervalSeconds = 10;
}

/// List Subscriptions for a user
message ListSubscriptionsRequest {
  sint64 correlationId = 1;
  string token = 2;
  string username = 3;
}

message ListSubscriptionsResponse {
  sint64 correlationId = 1;
  Status status = 2;
  string username = 3;
  repeated Session sessions = 10;

  message Session {
    /// Nano second unix epoch
    sint64 loginTime = 1;
    string token = 2;
    string clientVersion = 3;
    repeated Subscription marketSubscriptions = 10;
    repeated Subscription exchangeSubscriptions = 11;
  }
  message Subscription {
   string subscriptionId = 1;
   string symbolId = 2;
   sint64 marketId = 3;
   repeated SymbolCount symbolCounts = 4;
   string exchange = 10;
   string root = 11;
  }
  message SymbolCount {
    string symbol = 1;
    sint32 count = 2;
  }
}








© 2015 - 2025 Weber Informatics LLC | Privacy Policy