code.vegaprotocol.io/vega@v0.79.0/protos/sources/vega/vega.proto (about)

     1  syntax = "proto3";
     2  
     3  package vega;
     4  
     5  import "vega/markets.proto";
     6  
     7  option go_package = "code.vegaprotocol.io/vega/protos/vega";
     8  
     9  // Holds metadata associated to a party.
    10  message PartyProfile {
    11    // Party ID associated to the profile.
    12    string party_id = 1;
    13    // Alias given to the party.
    14    string alias = 2;
    15    // Metadata to associate to a party, in a key/value format where the key
    16    // describes the type of metadata in the value field.
    17    repeated vega.Metadata metadata = 3;
    18    // Derived keys for the party.
    19    repeated string derived_keys = 4;
    20  }
    21  
    22  // Generic structure holding a key/value pair.
    23  message Metadata {
    24    // Key of the metadata.
    25    string key = 1;
    26    // Value of the metadata.
    27    string value = 2;
    28  }
    29  
    30  message StopOrder {
    31    message SizeOverrideValue {
    32      // Scaling percentage of the current position’s size
    33      string percentage = 1;
    34    }
    35  
    36    enum SizeOverrideSetting {
    37      // Never valid
    38      SIZE_OVERRIDE_SETTING_UNSPECIFIED = 0;
    39      // No override, the size within the contained normal order submission will be used
    40      SIZE_OVERRIDE_SETTING_NONE = 1;
    41      // Use the total position of the trader
    42      SIZE_OVERRIDE_SETTING_POSITION = 2;
    43    }
    44  
    45    enum ExpiryStrategy {
    46      // Never valid
    47      EXPIRY_STRATEGY_UNSPECIFIED = 0;
    48      // Stop order should be cancelled if the expiry time is reached.
    49      EXPIRY_STRATEGY_CANCELS = 1;
    50      // Order should be submitted if the expiry time is reached.
    51      EXPIRY_STRATEGY_SUBMIT = 2;
    52    }
    53  
    54    enum TriggerDirection {
    55      // Never valid
    56      TRIGGER_DIRECTION_UNSPECIFIED = 0;
    57      // Stop order is triggered once the price rises above a certain level
    58      TRIGGER_DIRECTION_RISES_ABOVE = 1;
    59      // Stop order is triggered once the price falls below a certain level
    60      TRIGGER_DIRECTION_FALLS_BELOW = 2;
    61    }
    62  
    63    enum Status {
    64      // Never valid
    65      STATUS_UNSPECIFIED = 0;
    66      // Pending to be executed once the trigger is breached
    67      STATUS_PENDING = 1;
    68      // Cancelled by the user
    69      STATUS_CANCELLED = 2;
    70      // Stopped by the network, e.g: OCO on the other side has been triggered
    71      STATUS_STOPPED = 3;
    72      // Stop order has been triggered and generated an order
    73      STATUS_TRIGGERED = 4;
    74      // Stop order has expired
    75      STATUS_EXPIRED = 5;
    76      // Stop order was rejected at submission
    77      STATUS_REJECTED = 6;
    78    }
    79  
    80    enum RejectionReason {
    81      // Never valid
    82      REJECTION_REASON_UNSPECIFIED = 0;
    83      // Trading is not allowed yet
    84      REJECTION_REASON_TRADING_NOT_ALLOWED = 1;
    85      // Expiry of the stop order is in the past
    86      REJECTION_REASON_EXPIRY_IN_THE_PAST = 2;
    87      // Stop orders submission must be reduce only
    88      REJECTION_REASON_MUST_BE_REDUCE_ONLY = 3;
    89      // Party has reached the maximum stop orders allowed for this market
    90      REJECTION_REASON_MAX_STOP_ORDERS_PER_PARTY_REACHED = 4;
    91      // Stop orders are not allowed if there is no open position
    92      REJECTION_REASON_STOP_ORDER_NOT_ALLOWED_WITHOUT_A_POSITION = 5;
    93      // This stop order does not close the position
    94      REJECTION_REASON_STOP_ORDER_NOT_CLOSING_THE_POSITION = 6;
    95      // The percentage value for the linked stop order is invalid
    96      REJECTION_REASON_STOP_ORDER_LINKED_PERCENTAGE_INVALID = 7;
    97      // Stop orders are not allowed during the opening auction
    98      REJECTION_REASON_STOP_ORDER_NOT_ALLOWED_DURING_OPENING_AUCTION = 8;
    99      // Stop OCO orders cannot have the same expiry timestamp
   100      REJECTION_REASON_STOP_ORDER_CANNOT_MATCH_OCO_EXPIRY_TIMES = 9;
   101      // Stop orders with a position size override are not supported for spot markets
   102      REJECTION_REASON_STOP_ORDER_SIZE_OVERRIDE_UNSUPPORTED_FOR_SPOT = 10;
   103      // Stop orders containing sell order submissions are not allowed for this market
   104      REJECTION_REASON_SELL_ORDER_NOT_ALLOWED = 11;
   105    }
   106  
   107    // ID of this stop order
   108    // also the ID of the associated order if it is ever triggered
   109    string id = 1;
   110    // The ID of the 'other' part of the OCO if 2 stop orders were submitted at once
   111    optional string oco_link_id = 2;
   112    // Optional expiry timestamp.
   113    optional int64 expires_at = 3;
   114    // Strategy to adopt if the expiry time is reached.
   115    optional ExpiryStrategy expiry_strategy = 4;
   116    // Trigger direction for this stop order.
   117    TriggerDirection trigger_direction = 5;
   118    // Status of the stop order.
   119    Status status = 6;
   120    // Creation time of the stop order.
   121    int64 created_at = 7;
   122    // Last update of this stop order.
   123    optional int64 updated_at = 8;
   124    // ID of the order created once the trigger is hit.
   125    string order_id = 9;
   126    // ID of the party that submitted this stop order.
   127    string party_id = 10;
   128    // ID of the market the stop order is submitted to.
   129    string market_id = 11;
   130    // An optional reason for why a stop order was rejected
   131    optional RejectionReason rejection_reason = 12;
   132    // Size override setting
   133    SizeOverrideSetting size_override_setting = 13;
   134    // Size override value
   135    optional SizeOverrideValue size_override_value = 14;
   136  
   137    // Trigger that will need to be breached for the order
   138    // to be submitted to the book.
   139    oneof trigger {
   140      // Fixed price at which the order will be submitted.
   141      string price = 100;
   142      // Trailing percentage at which the order will be submitted.
   143      // This should be expressed as a decimal value between 0 and 1, e.g. 0.01 for 1%
   144      string trailing_percent_offset = 101;
   145    }
   146  }
   147  
   148  // Side relates to the direction of an order, to Buy, or Sell
   149  enum Side {
   150    // Default value, always invalid
   151    SIDE_UNSPECIFIED = 0;
   152    // Buy order
   153    SIDE_BUY = 1;
   154    // Sell order
   155    SIDE_SELL = 2;
   156  
   157    // Note: If adding an enum value, add a matching entry in:
   158    //       - gateway/graphql/helpers_enum.go
   159    //       - gateway/graphql/schema.graphql (enum Interval)
   160  }
   161  
   162  // Represents a set of time intervals that are used when querying for candle-stick data
   163  enum Interval {
   164    // Default value, always invalid
   165    INTERVAL_UNSPECIFIED = 0;
   166    // Block interval is not a fixed amount of time, rather it is used to indicate grouping of events that occur in a single block. It is usually about a second.
   167    INTERVAL_BLOCK = -1;
   168    // 1 minute.
   169    INTERVAL_I1M = 60;
   170    // 5 minutes.
   171    INTERVAL_I5M = 300;
   172    // 15 minutes.
   173    INTERVAL_I15M = 900;
   174    // 30 minutes.
   175    INTERVAL_I30M = 1800;
   176    // 1 hour.
   177    INTERVAL_I1H = 3600;
   178    // 4 hours.
   179    INTERVAL_I4H = 14400;
   180    // 6 hours.
   181    INTERVAL_I6H = 21600;
   182    // 8 hours.
   183    INTERVAL_I8H = 28800;
   184    // 12 hours.
   185    INTERVAL_I12H = 43200;
   186    // 1 day.
   187    INTERVAL_I1D = 86400;
   188    // 7 days.
   189    INTERVAL_I7D = 604800;
   190  
   191    // Note: If adding an enum value, add a matching entry in:
   192    //       - gateway/graphql/helpers_enum.go
   193    //       - gateway/graphql/schema.graphql (enum Interval)
   194  }
   195  
   196  // Represents the status of a position
   197  enum PositionStatus {
   198    POSITION_STATUS_UNSPECIFIED = 0;
   199    POSITION_STATUS_ORDERS_CLOSED = 1;
   200    POSITION_STATUS_CLOSED_OUT = 2;
   201    POSITION_STATUS_DISTRESSED = 4;
   202  }
   203  
   204  // Party represents an entity who wishes to trade on or query a Vega network
   205  message Party {
   206    // Unique ID for the party, typically represented by a public key.
   207    string id = 1;
   208    // Alias given to the party.
   209    string alias = 2;
   210    // Metadata to associate to a party, in a key/value format where the key
   211    // describes the type of metadata in the value field.
   212    repeated vega.Metadata metadata = 3;
   213  }
   214  
   215  // Risk factors are used to calculate the current risk associated with orders trading on a given market
   216  message RiskFactor {
   217    // Market ID that relates to this risk factor.
   218    string market = 1;
   219    // Short Risk factor value.
   220    string short = 2;
   221    // Long Risk factor value.
   222    string long = 3;
   223  }
   224  
   225  // Auction triggers indicate what condition triggered an auction (if market is in auction mode)
   226  enum AuctionTrigger {
   227    // Default value for AuctionTrigger, no auction triggered
   228    AUCTION_TRIGGER_UNSPECIFIED = 0;
   229    // Batch auction
   230    AUCTION_TRIGGER_BATCH = 1;
   231    // Opening auction
   232    AUCTION_TRIGGER_OPENING = 2;
   233    // Price monitoring trigger
   234    AUCTION_TRIGGER_PRICE = 3;
   235    // Deprecated
   236    AUCTION_TRIGGER_LIQUIDITY = 4;
   237    // Liquidity auction due to not enough committed liquidity
   238    AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET = 5;
   239    // Deprecated
   240    AUCTION_TRIGGER_UNABLE_TO_DEPLOY_LP_ORDERS = 6 [deprecated = true];
   241    // Market is suspended and put into auction via governance
   242    AUCTION_TRIGGER_GOVERNANCE_SUSPENSION = 7;
   243    // Market is suspended in response to a long block
   244    AUCTION_TRIGGER_LONG_BLOCK = 8;
   245    // Market is in auction for automated purchase.
   246    AUCTION_TRIGGER_PROTOCOL_AUTOMATED_PURCHASE = 9;
   247  }
   248  
   249  // Pegged reference defines which price point a pegged order is linked to - meaning
   250  // the price for a pegged order is calculated from the value of the reference price point
   251  enum PeggedReference {
   252    // Default value for PeggedReference, no reference given
   253    PEGGED_REFERENCE_UNSPECIFIED = 0;
   254    // Mid price reference
   255    PEGGED_REFERENCE_MID = 1;
   256    // Best bid price reference
   257    PEGGED_REFERENCE_BEST_BID = 2;
   258    // Best ask price reference
   259    PEGGED_REFERENCE_BEST_ASK = 3;
   260  }
   261  
   262  // Pegged orders are limit orders where the price is specified in the form REFERENCE +/- OFFSET
   263  // They can be used for any limit order that is valid during continuous trading
   264  message PeggedOrder {
   265    // Price point the order is linked to.
   266    PeggedReference reference = 1;
   267    // Offset from the price reference.
   268    string offset = 2;
   269  }
   270  
   271  // Details of an iceberg order
   272  message IcebergOrder {
   273    // Size of the order that will be made visible if the iceberg order is replenished after trading.
   274    uint64 peak_size = 1;
   275    // If the visible size of the order falls below this value, it will be replenished back to the peak size using the reserved amount.
   276    uint64 minimum_visible_size = 2;
   277    // Size of the order that is reserved and used to restore the iceberg's peak when it is refreshed.
   278    uint64 reserved_remaining = 3;
   279  }
   280  
   281  // Orders can be submitted, amended and cancelled on Vega in an attempt to make trades with other parties
   282  message Order {
   283    // Time In Force for an order
   284    enum TimeInForce {
   285      // Default value for TimeInForce, can be valid for an amend
   286      TIME_IN_FORCE_UNSPECIFIED = 0;
   287      // Good until cancelled, the order trades any amount and as much as possible
   288      // and remains on the book until it either trades completely or is cancelled
   289      TIME_IN_FORCE_GTC = 1;
   290      // Good until specified time, this order type trades any amount and as much as possible
   291      // and remains on the book until it either trades completely, is cancelled, or expires at a set time
   292      // NOTE: this may in future be multiple types or have sub types for orders that provide different ways of specifying expiry
   293      TIME_IN_FORCE_GTT = 2;
   294      // Immediate or cancel, the order trades any amount and as much as possible
   295      // but does not remain on the book (whether it trades or not)
   296      TIME_IN_FORCE_IOC = 3;
   297      // Fill or kill, the order either trades completely i.e. remainingSize == 0 after adding,
   298      // or not at all, and does not remain on the book if it doesn't trade
   299      TIME_IN_FORCE_FOK = 4;
   300      // Good for auction, this order is only accepted during an auction period
   301      TIME_IN_FORCE_GFA = 5;
   302      // Good for normal, this order is only accepted during normal trading (that can be continuous trading or frequent batched auctions)
   303      TIME_IN_FORCE_GFN = 6;
   304  
   305      // Note: If adding an enum value, add a matching entry in:
   306      //       - gateway/graphql/helpers_enum.go
   307      //       - gateway/graphql/schema.graphql (enum OrderTimeInForce)
   308    }
   309  
   310    // Type values for an order
   311    enum Type {
   312      // Default value, always invalid
   313      TYPE_UNSPECIFIED = 0;
   314      // Used for Limit orders
   315      TYPE_LIMIT = 1;
   316      // Used for Market orders
   317      TYPE_MARKET = 2;
   318      // Used for orders where the initiating party is the network (with distressed parties)
   319      TYPE_NETWORK = 3;
   320  
   321      // Note: If adding an enum value, add a matching entry in:
   322      //       - gateway/graphql/helpers_enum.go
   323      //       - gateway/graphql/schema.graphql (enum OrderType)
   324    }
   325  
   326    // Status values for an order
   327    enum Status {
   328      // Default value, always invalid
   329      STATUS_UNSPECIFIED = 0;
   330      // Used for active unfilled or partially filled orders
   331      STATUS_ACTIVE = 1;
   332      // Used for expired GTT orders
   333      STATUS_EXPIRED = 2;
   334      // Used for orders cancelled by the party that created the order
   335      STATUS_CANCELLED = 3;
   336      // Used for unfilled FOK or IOC orders, and for orders that were stopped by the network
   337      STATUS_STOPPED = 4;
   338      // Used for closed fully filled orders
   339      STATUS_FILLED = 5;
   340      // Used for orders when not enough collateral was available to fill the margin requirements
   341      STATUS_REJECTED = 6;
   342      // Used for closed partially filled IOC orders
   343      STATUS_PARTIALLY_FILLED = 7;
   344      // Order has been removed from the order book and has been parked,
   345      // this applies to pegged orders and liquidity orders (orders created from a liquidity provision shape)
   346      STATUS_PARKED = 8;
   347  
   348      // Note: If adding an enum value, add a matching entry in:
   349      //       - gateway/graphql/helpers_enum.go
   350      //       - gateway/graphql/schema.graphql (enum OrderStatus)
   351    }
   352  
   353    // Unique ID generated for the order.
   354    string id = 1;
   355    // Market ID for the order.
   356    string market_id = 2;
   357    // Party ID for the order.
   358    string party_id = 3;
   359    // Side for the order, e.g. SIDE_BUY or SIDE_SELL.
   360    Side side = 4;
   361    // Price for the order, the price is an integer, for example `123456` is a correctly
   362    // formatted price of `1.23456` assuming market configured to 5 decimal places.
   363    string price = 5;
   364    // Size for the order, for example, in a futures market the size equals the number of contracts.
   365    uint64 size = 6;
   366    // Size remaining, when this reaches 0 then the order is fully filled and status becomes STATUS_FILLED.
   367    uint64 remaining = 7;
   368    // Time in force indicates how long an order will remain active before it is executed or expires.
   369    // - See OrderTimeInForce
   370    TimeInForce time_in_force = 8;
   371    // Type for the order.
   372    Type type = 9;
   373    // Timestamp for when the order was created at, in nanoseconds.
   374    int64 created_at = 10;
   375    // Current status of the order.
   376    Status status = 11;
   377    // Timestamp in Unix nanoseconds for when the order will expire.
   378    int64 expires_at = 12;
   379    // Reference given for the order.
   380    string reference = 13;
   381    // Futher details for why an order with status `STATUS_REJECTED` was rejected.
   382    optional OrderError reason = 14;
   383    // Timestamp in Unix nanoseconds for when the order was last updated.
   384    int64 updated_at = 15;
   385    // Version for the order, initial value is version 1 and is incremented after each successful amend.
   386    uint64 version = 16;
   387    // Batch ID for the order, used internally for orders submitted during auctions
   388    // to keep track of the auction batch this order falls under. Required for fees calculation.
   389    uint64 batch_id = 17;
   390    // Pegged order details, used only if the order represents a pegged order.
   391    PeggedOrder pegged_order = 18;
   392    // Set if the order was created as part of a liquidity provision, will be empty if not.
   393    string liquidity_provision_id = 19;
   394    // Only valid for Limit orders. Cannot be True at the same time as Reduce-Only.
   395    bool post_only = 20;
   396    // Only valid for Non-Persistent orders. Cannot be True at the same time as Post-Only.
   397    // If set, order will only be executed if the outcome of the trade moves the trader's position closer to 0.
   398    bool reduce_only = 21;
   399    // Details of an iceberg order
   400    optional IcebergOrder iceberg_order = 22;
   401  }
   402  
   403  // Used when cancelling an order
   404  message OrderCancellationConfirmation {
   405    // Order that was cancelled.
   406    Order order = 1;
   407  }
   408  
   409  // Used when confirming an order
   410  message OrderConfirmation {
   411    // Order that was confirmed.
   412    Order order = 1;
   413    // 0 or more trades that were emitted.
   414    repeated Trade trades = 2;
   415    // 0 or more passive orders that were affected.
   416    repeated Order passive_orders_affected = 3;
   417  }
   418  
   419  // AuctionIndicativeState is used to emit an event with the indicative price/volume per market during an auction
   420  message AuctionIndicativeState {
   421    // Market ID for which this state relates to.
   422    string market_id = 1;
   423    // Indicative uncrossing price is the price at which all trades would occur if the auction uncrossed now.
   424    string indicative_price = 2;
   425    // Indicative uncrossing volume is the volume available at the indicative crossing price if the auction uncrossed now.
   426    uint64 indicative_volume = 3;
   427    // Timestamp at which the auction started.
   428    int64 auction_start = 4;
   429    // Timestamp at which the auction is meant to stop.
   430    int64 auction_end = 5;
   431  }
   432  
   433  // OrderError codes are returned in the Order.reason field - If there is an issue
   434  // with an order during its life-cycle, it will be marked with `status.ORDER_STATUS_REJECTED`
   435  enum OrderError {
   436    reserved 38, 39;
   437  
   438    // Default value, no error reported
   439    ORDER_ERROR_UNSPECIFIED = 0;
   440    // Order was submitted for a market that does not exist
   441    ORDER_ERROR_INVALID_MARKET_ID = 1;
   442    // Order was submitted with an invalid ID
   443    ORDER_ERROR_INVALID_ORDER_ID = 2;
   444    // Order was amended with a sequence number that was not previous version + 1
   445    ORDER_ERROR_OUT_OF_SEQUENCE = 3;
   446    // Order was amended with an invalid remaining size (e.g. remaining greater than total size)
   447    ORDER_ERROR_INVALID_REMAINING_SIZE = 4;
   448    // Node was unable to get Vega (blockchain) time
   449    ORDER_ERROR_TIME_FAILURE = 5;
   450    // Failed to remove an order from the book
   451    ORDER_ERROR_REMOVAL_FAILURE = 6;
   452    // Order with `TimeInForce.TIME_IN_FORCE_GTT` was submitted or amended
   453    // with an expiration that was badly formatted or otherwise invalid
   454    ORDER_ERROR_INVALID_EXPIRATION_DATETIME = 7;
   455    // Order was submitted or amended with an invalid reference field
   456    ORDER_ERROR_INVALID_ORDER_REFERENCE = 8;
   457    // Order amend was submitted for an order field that cannot not be amended (e.g. order ID)
   458    ORDER_ERROR_EDIT_NOT_ALLOWED = 9;
   459    // Amend failure because amend details do not match original order
   460    ORDER_ERROR_AMEND_FAILURE = 10;
   461    // Order not found in an order book or store
   462    ORDER_ERROR_NOT_FOUND = 11;
   463    // Order was submitted with an invalid or missing party ID
   464    ORDER_ERROR_INVALID_PARTY_ID = 12;
   465    // Order was submitted for a market that has closed
   466    ORDER_ERROR_MARKET_CLOSED = 13;
   467    // Order was submitted, but the party did not have enough collateral to cover the order
   468    ORDER_ERROR_MARGIN_CHECK_FAILED = 14;
   469    // Order was submitted, but the party did not have an account for this asset
   470    ORDER_ERROR_MISSING_GENERAL_ACCOUNT = 15;
   471    // Unspecified internal error
   472    ORDER_ERROR_INTERNAL_ERROR = 16;
   473    // Order was submitted with an invalid or missing size (e.g. 0)
   474    ORDER_ERROR_INVALID_SIZE = 17;
   475    // Order was submitted with an invalid persistence for its type
   476    ORDER_ERROR_INVALID_PERSISTENCE = 18;
   477    // Order was submitted with an invalid type field
   478    ORDER_ERROR_INVALID_TYPE = 19;
   479    // Order was stopped as it would have traded with another order submitted from the same party
   480    ORDER_ERROR_SELF_TRADING = 20;
   481    // Order was submitted, but the party did not have enough collateral to cover the fees for the order
   482    ORDER_ERROR_INSUFFICIENT_FUNDS_TO_PAY_FEES = 21;
   483    // Order was submitted with an incorrect or invalid market type
   484    ORDER_ERROR_INCORRECT_MARKET_TYPE = 22;
   485    // Order was submitted with invalid time in force
   486    ORDER_ERROR_INVALID_TIME_IN_FORCE = 23;
   487    // Good For Normal order has reached the market when it is in auction mode
   488    ORDER_ERROR_CANNOT_SEND_GFN_ORDER_DURING_AN_AUCTION = 24;
   489    // Good For Auction order has reached the market when it is in continuous trading mode
   490    ORDER_ERROR_CANNOT_SEND_GFA_ORDER_DURING_CONTINUOUS_TRADING = 25;
   491    // Attempt to amend order to GTT without ExpiryAt
   492    ORDER_ERROR_CANNOT_AMEND_TO_GTT_WITHOUT_EXPIRYAT = 26;
   493    // Attempt to amend ExpiryAt to a value before CreatedAt
   494    ORDER_ERROR_EXPIRYAT_BEFORE_CREATEDAT = 27;
   495    // Attempt to amend to GTC without an ExpiryAt value
   496    ORDER_ERROR_CANNOT_HAVE_GTC_AND_EXPIRYAT = 28;
   497    // Amending to FOK or IOC is invalid
   498    ORDER_ERROR_CANNOT_AMEND_TO_FOK_OR_IOC = 29;
   499    // Amending to GFA or GFN is invalid
   500    ORDER_ERROR_CANNOT_AMEND_TO_GFA_OR_GFN = 30;
   501    // Amending from GFA or GFN is invalid
   502    ORDER_ERROR_CANNOT_AMEND_FROM_GFA_OR_GFN = 31;
   503    // IOC orders are not allowed during auction
   504    ORDER_ERROR_CANNOT_SEND_IOC_ORDER_DURING_AUCTION = 32;
   505    // FOK orders are not allowed during auction
   506    ORDER_ERROR_CANNOT_SEND_FOK_ORDER_DURING_AUCTION = 33;
   507    // Pegged orders must be LIMIT orders
   508    ORDER_ERROR_MUST_BE_LIMIT_ORDER = 34;
   509    // Pegged orders can only have TIF GTC or GTT
   510    ORDER_ERROR_MUST_BE_GTT_OR_GTC = 35;
   511    // Pegged order must have a reference price
   512    ORDER_ERROR_WITHOUT_REFERENCE_PRICE = 36;
   513    // Buy pegged order cannot reference best ask price
   514    ORDER_ERROR_BUY_CANNOT_REFERENCE_BEST_ASK_PRICE = 37;
   515    // Pegged order offset must be >= 0
   516    ORDER_ERROR_OFFSET_MUST_BE_GREATER_OR_EQUAL_TO_ZERO = 40;
   517    // Sell pegged order cannot reference best bid price
   518    ORDER_ERROR_SELL_CANNOT_REFERENCE_BEST_BID_PRICE = 41;
   519    // Pegged order offset must be > zero
   520    ORDER_ERROR_OFFSET_MUST_BE_GREATER_THAN_ZERO = 42;
   521    // Party has an insufficient balance, or does not have
   522    // a general account to submit the order (no deposits made
   523    // for the required asset)
   524    ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE = 43;
   525    // Cannot amend details of a non pegged details
   526    ORDER_ERROR_CANNOT_AMEND_PEGGED_ORDER_DETAILS_ON_NON_PEGGED_ORDER = 44;
   527    // Could not re-price a pegged order because a market price is unavailable
   528    ORDER_ERROR_UNABLE_TO_REPRICE_PEGGED_ORDER = 45;
   529    // It is not possible to amend the price of an existing pegged order
   530    ORDER_ERROR_UNABLE_TO_AMEND_PRICE_ON_PEGGED_ORDER = 46;
   531    // FOK, IOC, or GFN order was rejected because it resulted in trades outside the price bounds
   532    ORDER_ERROR_NON_PERSISTENT_ORDER_OUT_OF_PRICE_BOUNDS = 47;
   533    // Unable to submit pegged order, temporarily too many pegged orders across all markets
   534    ORDER_ERROR_TOO_MANY_PEGGED_ORDERS = 48;
   535    // Post order would trade
   536    ORDER_ERROR_POST_ONLY_ORDER_WOULD_TRADE = 49;
   537    // Post order would trade
   538    ORDER_ERROR_REDUCE_ONLY_ORDER_WOULD_NOT_REDUCE_POSITION = 50;
   539    // Isolated margin check failed
   540    ORDER_ERROR_ISOLATED_MARGIN_CHECK_FAILED = 51;
   541    // In isolated margin pegged orders are rejected
   542    ORDER_ERROR_PEGGED_ORDERS_NOT_ALLOWED_IN_ISOLATED_MARGIN_MODE = 52;
   543    // Order price does not respect market's required tick size
   544    ORDER_ERROR_PRICE_NOT_IN_TICK_SIZE = 53;
   545    // Order price exceeds the max price of the capped future market
   546    ORDER_ERROR_PRICE_MUST_BE_LESS_THAN_OR_EQUAL_TO_MAX_PRICE = 54;
   547    // Sell orders are not allowed in this market
   548    ORDER_ERROR_SELL_ORDER_NOT_ALLOWED = 55;
   549    // Note: If adding an enum value, add a matching entry in:
   550    //       - proto/errors.go (func Error)
   551    //       - gateway/graphql/schema.graphql (enum RejectionReason)
   552    //       - gateway/graphql/helpers_enum.go
   553  }
   554  
   555  // A trade occurs when an aggressive order crosses one or more passive orders on the order book for a market on Vega
   556  message Trade {
   557    // Type values for a trade
   558    enum Type {
   559      // Default value, always invalid
   560      TYPE_UNSPECIFIED = 0;
   561      // Normal trading between two parties
   562      TYPE_DEFAULT = 1;
   563      // Trading initiated by the network with another party on the book,
   564      // which helps to zero-out the positions of one or more distressed parties
   565      TYPE_NETWORK_CLOSE_OUT_GOOD = 2;
   566      // Trading initiated by the network with another party off the book,
   567      // with a distressed party in order to zero-out the position of the party
   568      TYPE_NETWORK_CLOSE_OUT_BAD = 3;
   569  
   570      // Note: If adding an enum value, add a matching entry in:
   571      //       - gateway/graphql/helpers_enum.go
   572      //       - gateway/graphql/schema.graphql (enum TradeType)
   573    }
   574  
   575    // Unique ID for the trade.
   576    string id = 1;
   577    // Market ID on which the trade occurred.
   578    string market_id = 2;
   579    // Price for the trade, the price is an integer, for example `123456` is a correctly
   580    // formatted price of `1.23456` assuming market configured to 5 decimal places.
   581    string price = 3;
   582    // Size filled for the trade.
   583    uint64 size = 4;
   584    // Unique party ID for the buyer.
   585    string buyer = 5;
   586    // Unique party ID for the seller.
   587    string seller = 6;
   588    // Direction of the aggressive party e.g. SIDE_BUY or SIDE_SELL.
   589    Side aggressor = 7;
   590    // Identifier of the order from the buy side.
   591    string buy_order = 8;
   592    // Identifier of the order from the sell side.
   593    string sell_order = 9;
   594    // Timestamp in Unix nanoseconds for when the trade occurred.
   595    int64 timestamp = 10;
   596    // Type for the trade.
   597    Type type = 11;
   598    // Fee amount charged to the buyer party for the trade.
   599    Fee buyer_fee = 12;
   600    // Fee amount charged to the seller party for the trade.
   601    Fee seller_fee = 13;
   602    // Auction batch number that the buy side order was placed in.
   603    uint64 buyer_auction_batch = 14;
   604    // Auction batch number that the sell side order was placed in.
   605    uint64 seller_auction_batch = 15;
   606    // Price for the trade using asset decimals, as opposed to market decimals used
   607    // in the price field. This is only used in trade events for position updates.
   608    string asset_price = 16;
   609  }
   610  
   611  // Represents any fees paid by a party, resulting from a trade
   612  message Fee {
   613    // Fee amount paid to the non-aggressive party of the trade. This field is an unsigned integer scaled to the asset's decimal places.
   614    string maker_fee = 1;
   615    // Fee amount paid for maintaining the Vega infrastructure. This field is an unsigned integer scaled using the asset's decimal places.
   616    string infrastructure_fee = 2;
   617    // Fee amount paid to market makers. This field is an unsigned integer scaled to the asset's decimal places.
   618    string liquidity_fee = 3;
   619  
   620    // Volume discounts.
   621    // Discount on maker fee based on the taker volume.
   622    string maker_fee_volume_discount = 4;
   623    // Discount on infrastructure fee based on the taker volume.
   624    string infrastructure_fee_volume_discount = 5;
   625    // Discount on liquidity fee basedo on taker volume.
   626    string liquidity_fee_volume_discount = 6;
   627  
   628    // Referrer discounts.
   629    // Discount on maker fee for eligible referrer.
   630    string maker_fee_referrer_discount = 7;
   631    // Discount on infrastructure fee for eligible referrer.
   632    string infrastructure_fee_referrer_discount = 8;
   633    // Discount on liquidity fee for eligible referrer.
   634    string liquidity_fee_referrer_discount = 9;
   635    // Fee amount sent to network treasury for later use based on governance actions (network wide).
   636    string treasury_fee = 10;
   637    // Fee amount used to purchase governance tokens via regular auctions (network wide).
   638    string buy_back_fee = 11;
   639    // Fee paid by the taker to the maker if the maker is eligible.
   640    string high_volume_maker_fee = 12;
   641  }
   642  
   643  message TradeSet {
   644    // Set of one or more trades.
   645    repeated Trade trades = 1;
   646  }
   647  
   648  // Represents the high, low, open, and closing prices for an interval of trading,
   649  // referred to commonly as a candlestick or candle
   650  message Candle {
   651    // Timestamp in Unix nanoseconds for the point in time when the candle was initially created/opened.
   652    int64 timestamp = 1;
   653    // ISO-8601 datetime with nanosecond precision for when the candle was last updated.
   654    string datetime = 2;
   655    // Highest price for trading during the candle interval. This field is an unsigned integer scaled to the market's decimal places.
   656    string high = 3;
   657    // Lowest price for trading during the candle interval. This field is an unsigned integer scaled to the market's decimal places.
   658    string low = 4;
   659    // Open trade price. This field is an unsigned integer scaled to the market's decimal places.
   660    string open = 5;
   661    // Closing trade price. This field is an unsigned integer scaled to the market's decimal places.
   662    string close = 6;
   663    // Total trading volume during the candle interval.
   664    uint64 volume = 7;
   665    // Time interval for the candle.
   666    Interval interval = 8;
   667    // Total notional value traded during the candle interval.
   668    uint64 notional = 9;
   669  }
   670  
   671  // Represents a price level from market depth or order book data
   672  message PriceLevel {
   673    // Price for the price level, the price is an integer, for example `123456` is a correctly
   674    // formatted price of `1.23456` assuming market configured to 5 decimal places. This field
   675    // is an unsigned integer passed as a string and needs to be scaled using the market's decimal places.
   676    string price = 1;
   677    // Number of orders at the price level.
   678    uint64 number_of_orders = 2;
   679    // Volume at the price level.
   680    uint64 volume = 3;
   681    // Volume of AMM's at the price level.
   682    uint64 amm_volume = 4;
   683    // Estimated AMM volume at the price level.
   684    uint64 amm_volume_estimated = 5;
   685  }
   686  
   687  // Represents market depth or order book data for the specified market on Vega
   688  message MarketDepth {
   689    // Market ID for which the depth levels apply.
   690    string market_id = 1;
   691    // Collection of price levels for the buy side of the book.
   692    repeated PriceLevel buy = 2;
   693    // Collection of price levels for the sell side of the book.
   694    repeated PriceLevel sell = 3;
   695    // Sequence number for the market depth data returned.
   696    uint64 sequence_number = 4;
   697  }
   698  
   699  // Represents the changed market depth since the last update
   700  message MarketDepthUpdate {
   701    // Market ID for which the market depth updates are for.
   702    string market_id = 1;
   703    // Collection of updated price levels for the buy side of the book.
   704    repeated PriceLevel buy = 2;
   705    // Collection of updated price levels for the sell side of the book.
   706    repeated PriceLevel sell = 3;
   707    // Sequence number for the market depth update data returned. It is increasing but not monotonic.
   708    uint64 sequence_number = 4;
   709    // Sequence number of the previous market depth update, for checking there are no gaps.
   710    uint64 previous_sequence_number = 5;
   711  }
   712  
   713  // Represents position data for a party on the specified market on Vega
   714  message Position {
   715    // Market ID in which the position is held.
   716    string market_id = 1;
   717    // Party ID holding the position.
   718    string party_id = 2;
   719    // Open volume for the position, value is signed +ve for long and -ve for short.
   720    int64 open_volume = 3;
   721    // Realised profit and loss for the position, value is signed +ve for long and -ve for short.
   722    // This field is a signed integer scaled to the market's decimal places.
   723    string realised_pnl = 4;
   724    // Unrealised profit and loss for the position, value is signed +ve for long and -ve for short.
   725    // This field is a signed integer scaled to the market's decimal places.
   726    string unrealised_pnl = 5;
   727    // Average entry price for the position, the price is an integer, for example `123456` is a correctly
   728    // formatted price of `1.23456` assuming market configured to 5 decimal places.
   729    string average_entry_price = 6;
   730    // Timestamp for the latest time the position was updated.
   731    int64 updated_at = 7;
   732    // Sum of profit that could not be paid due to loss socialisation.
   733    string loss_socialisation_amount = 8;
   734    // Position status, indicating whether the party was distressed and had orders cancelled or was closed out.
   735    PositionStatus position_status = 9;
   736    // Total taker fees paid by a party on a market.
   737    string taker_fees_paid = 10;
   738    // Total maker fees received by a party on a market.
   739    string maker_fees_received = 11;
   740    // Total fees paid by a party on a market (liquidity, infrastructure, treasury, buy-back, high volume maker fee).
   741    string fees_paid = 12;
   742    // Taker fees paid by party on a market since opening their current position.
   743    // The current position is counted whenever the party changed sides (long <=> short), or a position was opened.
   744    string taker_fees_paid_since = 13;
   745    // Maker fees received since opening the current position.
   746    string maker_fees_received_since = 14;
   747    // Fees paid since opening the current position.
   748    string fees_paid_since = 15;
   749    // Total funding payment amounts received or paid by a party on a market.
   750    string funding_payment_amount = 16;
   751    // Funding payments received or paid since opening the current position.
   752    string funding_payment_amount_since = 17;
   753  }
   754  
   755  message PositionTrade {
   756    // Volume for the position trade, value is signed +ve for long and -ve for short.
   757    int64 volume = 1;
   758    // Price for the position trade, the price is an integer, for example `123456` is a correctly
   759    // formatted price of `1.23456` assuming market configured to 5 decimal places.
   760    string price = 2;
   761  }
   762  
   763  // Vega blockchain status as reported by the node the caller is connected to
   764  enum ChainStatus {
   765    // Default value, always invalid
   766    CHAIN_STATUS_UNSPECIFIED = 0;
   767    // Blockchain is disconnected
   768    CHAIN_STATUS_DISCONNECTED = 1;
   769    // Blockchain is replaying historic transactions
   770    CHAIN_STATUS_REPLAYING = 2;
   771    // Blockchain is connected and receiving transactions
   772    CHAIN_STATUS_CONNECTED = 3;
   773  
   774    // Note: ChainStatus does not exist in GraphQL
   775  }
   776  
   777  // Deposit on to the Vega network
   778  message Deposit {
   779    // Status of the deposit
   780    enum Status {
   781      // Default value, always invalid
   782      STATUS_UNSPECIFIED = 0;
   783      // Deposit is being processed by the network
   784      STATUS_OPEN = 1;
   785      // Deposit has been cancelled or failed to be verified by the network
   786      STATUS_CANCELLED = 2;
   787      // Deposit has been finalised and accounts have been updated
   788      STATUS_FINALIZED = 3;
   789      // Deposit has been rejected as a duplicate transaction.
   790      STATUS_DUPLICATE_REJECTED = 4;
   791    }
   792  
   793    // Unique ID for the deposit.
   794    string id = 1;
   795    // Status of the deposit.
   796    Status status = 2;
   797    // Party ID of the user initiating the deposit.
   798    string party_id = 3;
   799    // Vega asset targeted by this deposit.
   800    string asset = 4;
   801    // Amount to be deposited. This field is an unsigned integer scaled to the asset's decimal places.
   802    string amount = 5;
   803    // Hash of the transaction from the foreign chain.
   804    string tx_hash = 6;
   805    // Timestamp for when the Vega account was updated with the deposit.
   806    int64 credited_timestamp = 7;
   807    // Timestamp for when the deposit was created on the Vega network.
   808    int64 created_timestamp = 8;
   809  }
   810  
   811  // Withdrawal from the Vega network
   812  message Withdrawal {
   813    reserved 7;
   814  
   815    // Status of the withdrawal
   816    enum Status {
   817      // Default value, always invalid
   818      STATUS_UNSPECIFIED = 0;
   819      // Withdrawal is open and being processed by the network
   820      STATUS_OPEN = 1;
   821      // Withdrawal have been cancelled
   822      STATUS_REJECTED = 2;
   823      // Withdrawal went through and is fully finalised, the funds are removed from the
   824      // Vega network and are unlocked on the foreign chain bridge, for example, on the Ethereum network
   825      STATUS_FINALIZED = 3;
   826    }
   827  
   828    // Unique ID for the withdrawal.
   829    string id = 1;
   830    // Unique party ID of the user initiating the withdrawal.
   831    string party_id = 2;
   832    // Amount to be withdrawn. This field is an unsigned integer scaled to the asset's decimal places.
   833    string amount = 3;
   834    // Asset to withdraw funds from.
   835    string asset = 4;
   836    // Status of the withdrawal.
   837    Status status = 5;
   838    // Reference which is used by the foreign chain
   839    // to refer to this withdrawal.
   840    string ref = 6;
   841    // Hash of the foreign chain for this transaction.
   842    string tx_hash = 8;
   843    // Timestamp for when the network started to process this withdrawal.
   844    int64 created_timestamp = 9;
   845    // Timestamp for when the withdrawal was finalised by the network.
   846    int64 withdrawn_timestamp = 10;
   847    // Foreign chain specifics.
   848    WithdrawExt ext = 11;
   849  }
   850  
   851  // Withdrawal external details
   852  message WithdrawExt {
   853    // Foreign chain specifics.
   854    oneof ext {
   855      // ERC20 withdrawal details.
   856      Erc20WithdrawExt erc20 = 1;
   857    }
   858  }
   859  
   860  // Extension of data required for the withdraw submissions
   861  message Erc20WithdrawExt {
   862    // Address into which the bridge will release the funds.
   863    string receiver_address = 1;
   864  }
   865  
   866  // Various collateral/account types as used by Vega
   867  enum AccountType {
   868    reserved 8;
   869    // Default value
   870    ACCOUNT_TYPE_UNSPECIFIED = 0;
   871    // Insurance pool accounts contain insurance pool funds for a market
   872    ACCOUNT_TYPE_INSURANCE = 1;
   873    // Settlement accounts exist only during settlement or mark-to-market
   874    ACCOUNT_TYPE_SETTLEMENT = 2;
   875    // Margin accounts contain funds set aside for the margin needed to support a party's open positions.
   876    // Each party will have a margin account for each market they have traded in.
   877    // Required initial margin is allocated to each market from user's general account.
   878    // Collateral in the margin account can't be withdrawn or used as margin on another market until
   879    // it is released back to the general account.
   880    // Vega protocol uses an internal accounting system to segregate funds held as
   881    // margin from other funds to ensure they are never lost or 'double spent'
   882    //
   883    // Margin account funds will vary as margin requirements on positions change
   884    ACCOUNT_TYPE_MARGIN = 3;
   885    // General accounts contain the collateral for a party that is not otherwise allocated. A party will
   886    // have multiple general accounts, one for each asset they want
   887    // to trade with
   888    //
   889    // General accounts are where funds are initially deposited or withdrawn from,
   890    // it is also the account where funds are taken to fulfil fees and initial margin requirements
   891    ACCOUNT_TYPE_GENERAL = 4;
   892    // Infrastructure accounts contain fees earned by providing infrastructure on Vega
   893    ACCOUNT_TYPE_FEES_INFRASTRUCTURE = 5;
   894    // Liquidity accounts contain fees earned by providing liquidity on Vega markets
   895    ACCOUNT_TYPE_FEES_LIQUIDITY = 6;
   896    // This account is created to hold fees earned by placing orders that sit on the book
   897    // and are then matched with an incoming order to create a trade - These fees reward parties
   898    // who provide the best priced liquidity that actually allows trading to take place
   899    ACCOUNT_TYPE_FEES_MAKER = 7;
   900    // This account is created to maintain liquidity providers funds commitments
   901    ACCOUNT_TYPE_BOND = 9;
   902  
   903    // External account represents an external source (deposit/withdrawal)
   904    ACCOUNT_TYPE_EXTERNAL = 10;
   905  
   906    // Global insurance account for the asset
   907    ACCOUNT_TYPE_GLOBAL_INSURANCE = 11;
   908  
   909    // Global reward account for the asset
   910    ACCOUNT_TYPE_GLOBAL_REWARD = 12;
   911  
   912    // Per asset account used to store pending transfers (if any)
   913    ACCOUNT_TYPE_PENDING_TRANSFERS = 13;
   914  
   915    // Per asset reward account for fees paid to makers
   916    ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES = 14;
   917  
   918    // Per asset reward account for fees received by makers
   919    ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES = 15;
   920  
   921    // Per asset reward account for fees received by liquidity providers
   922    ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES = 16;
   923  
   924    // Per asset reward account for market proposers when the market goes above some trading threshold
   925    ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS = 17;
   926  
   927    // Per asset account for holding in-flight unfilled orders' funds
   928    ACCOUNT_TYPE_HOLDING = 18;
   929  
   930    // Network controlled liquidity provider's account, per market, to hold accrued liquidity fees.
   931    ACCOUNT_TYPE_LP_LIQUIDITY_FEES = 19;
   932  
   933    // Network controlled liquidity fees bonus distribution account, per market.
   934    ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION = 20;
   935  
   936    // Network controlled treasury
   937    ACCOUNT_TYPE_NETWORK_TREASURY = 21;
   938  
   939    // Account holding user's rewards for the vesting period
   940    ACCOUNT_TYPE_VESTING_REWARDS = 22;
   941  
   942    // Account holding user's rewards after the vesting period
   943    ACCOUNT_TYPE_VESTED_REWARDS = 23;
   944  
   945    reserved 24;
   946  
   947    // Per asset market reward account given for relative return
   948    ACCOUNT_TYPE_REWARD_RELATIVE_RETURN = 25;
   949  
   950    // Per asset market reward account given for return volatility
   951    ACCOUNT_TYPE_REWARD_RETURN_VOLATILITY = 26;
   952  
   953    // Per asset market reward account given to validators by their ranking
   954    ACCOUNT_TYPE_REWARD_VALIDATOR_RANKING = 27;
   955  
   956    // Per asset account for pending fee referral reward payouts
   957    ACCOUNT_TYPE_PENDING_FEE_REFERRAL_REWARD = 28;
   958  
   959    // Per asset market account for party in isolated margin mode
   960    ACCOUNT_TYPE_ORDER_MARGIN = 29;
   961  
   962    // Per asset market reward account for realised return
   963    ACCOUNT_TYPE_REWARD_REALISED_RETURN = 30;
   964  
   965    // Per asset account for paid buy-back fees
   966    ACCOUNT_TYPE_BUY_BACK_FEES = 31;
   967  
   968    // Per asset market reward account given for average notional
   969    ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL = 32;
   970  
   971    // Reward account for the eligible entities metric.
   972    ACCOUNT_TYPE_REWARD_ELIGIBLE_ENTITIES = 33;
   973  
   974    // Account for assets that are locked for staking.
   975    ACCOUNT_TYPE_LOCKED_FOR_STAKING = 34;
   976  
   977    // Note: If adding an enum value, add a matching entry in:
   978    //       - gateway/graphql/helpers_enum.go
   979    //       - gateway/graphql/schema.graphql (enum AccountType)
   980  }
   981  
   982  // Represents an account for an asset on Vega for a particular owner or party
   983  message Account {
   984    // Unique account ID, used internally by Vega.
   985    string id = 1;
   986    // Party that the account belongs to, special values include `network`, which represents the Vega network and is
   987    // most commonly seen during liquidation of distressed trading positions.
   988    string owner = 2;
   989    // Balance of the asset, the balance is an integer, for example `123456` is a correctly
   990    // formatted price of `1.23456` assuming market configured to 5 decimal places
   991    // and importantly balances cannot be negative.
   992    string balance = 3;
   993    // Asset ID for the account.
   994    string asset = 4;
   995    // Market ID for the account, if `AccountType.ACCOUNT_TYPE_GENERAL` this will be empty.
   996    string market_id = 5;
   997    // Account type related to this account.
   998    AccountType type = 6;
   999  }
  1000  
  1001  // Asset value information used within a transfer
  1002  message FinancialAmount {
  1003    // Unsigned integer amount of asset scaled to the asset's decimal places.
  1004    string amount = 1;
  1005    // Asset ID the amount applies to.
  1006    string asset = 2;
  1007  }
  1008  
  1009  // Transfers can occur between parties on Vega, these are the types that indicate why a transfer took place
  1010  enum TransferType {
  1011    reserved 3, 17;
  1012    // Default value, always invalid
  1013    TRANSFER_TYPE_UNSPECIFIED = 0;
  1014    // Funds deducted after final settlement loss
  1015    TRANSFER_TYPE_LOSS = 1;
  1016    // Funds added to general account after final settlement gain
  1017    TRANSFER_TYPE_WIN = 2;
  1018    // Funds deducted from margin account after mark to market loss
  1019    TRANSFER_TYPE_MTM_LOSS = 4;
  1020    // Funds added to margin account after mark to market gain
  1021    TRANSFER_TYPE_MTM_WIN = 5;
  1022    // Funds transferred from general account to meet margin requirement
  1023    TRANSFER_TYPE_MARGIN_LOW = 6;
  1024    // Excess margin amount returned to general account
  1025    TRANSFER_TYPE_MARGIN_HIGH = 7;
  1026    // Margin confiscated from margin account to fulfil closeout
  1027    TRANSFER_TYPE_MARGIN_CONFISCATED = 8;
  1028    // Maker fee paid from general account
  1029    TRANSFER_TYPE_MAKER_FEE_PAY = 9;
  1030    // Maker fee received into general account
  1031    TRANSFER_TYPE_MAKER_FEE_RECEIVE = 10;
  1032    // Infrastructure fee paid from general account
  1033    TRANSFER_TYPE_INFRASTRUCTURE_FEE_PAY = 11;
  1034    // Infrastructure fee received into general account
  1035    TRANSFER_TYPE_INFRASTRUCTURE_FEE_DISTRIBUTE = 12;
  1036    // Liquidity fee paid from general account
  1037    TRANSFER_TYPE_LIQUIDITY_FEE_PAY = 13;
  1038    // Liquidity fee received into general account
  1039    TRANSFER_TYPE_LIQUIDITY_FEE_DISTRIBUTE = 14;
  1040    // Bond account funded from general account to meet required bond amount
  1041    TRANSFER_TYPE_BOND_LOW = 15;
  1042    // Bond returned to general account after liquidity commitment was reduced
  1043    TRANSFER_TYPE_BOND_HIGH = 16;
  1044    // Funds withdrawn from general account
  1045    TRANSFER_TYPE_WITHDRAW = 18;
  1046    // Funds deposited to general account
  1047    TRANSFER_TYPE_DEPOSIT = 19;
  1048    // Bond account penalised when liquidity commitment not met
  1049    TRANSFER_TYPE_BOND_SLASHING = 20;
  1050    // Reward payout received
  1051    TRANSFER_TYPE_REWARD_PAYOUT = 21;
  1052    // Internal Vega network instruction for the collateral engine to move funds from a user's general account into the pending transfers pool
  1053    TRANSFER_TYPE_TRANSFER_FUNDS_SEND = 22;
  1054    // Internal Vega network instruction for the collateral engine to move funds from the pending transfers pool account into the destination account
  1055    TRANSFER_TYPE_TRANSFER_FUNDS_DISTRIBUTE = 23;
  1056    // Market-related accounts emptied because market has closed
  1057    TRANSFER_TYPE_CLEAR_ACCOUNT = 24;
  1058    // Balances restored after network restart
  1059    TRANSFER_TYPE_CHECKPOINT_BALANCE_RESTORE = 25;
  1060    // Spot trade delivery
  1061    TRANSFER_TYPE_SPOT = 26;
  1062    // An internal instruction to transfer a quantity corresponding to an active spot order from a general account into a party holding account.
  1063    TRANSFER_TYPE_HOLDING_LOCK = 27;
  1064    // An internal instruction to transfer an excess quantity corresponding to an active spot order from a holding account into a party general account.
  1065    TRANSFER_TYPE_HOLDING_RELEASE = 28;
  1066    // Insurance pool fraction transfer from parent to successor market.
  1067    TRANSFER_TYPE_SUCCESSOR_INSURANCE_FRACTION = 29;
  1068    // Allocates liquidity fee earnings to each liquidity provider's network controlled liquidity fee account.
  1069    TRANSFER_TYPE_LIQUIDITY_FEE_ALLOCATE = 30;
  1070    // Distributes net fee earnings from liquidity provider's fee account to their general account.
  1071    TRANSFER_TYPE_LIQUIDITY_FEE_NET_DISTRIBUTE = 31;
  1072    // Applies SLA penalty by moving funds from party's bond account to market's insurance pool.
  1073    TRANSFER_TYPE_SLA_PENALTY_BOND_APPLY = 32;
  1074    // Applies SLA penalty by moving funds from the liquidity provider's fee account to market insurance pool.
  1075    TRANSFER_TYPE_SLA_PENALTY_LP_FEE_APPLY = 33;
  1076    // Collects penalties from the liquidity provider's fee account before the fee revenue is paid, and transfers it to the market's bonus distribution account.
  1077    TRANSFER_TYPE_LIQUIDITY_FEE_UNPAID_COLLECT = 34;
  1078    // Distributes performance bonus from market bonus to liquidity provider's general account.
  1079    TRANSFER_TYPE_SLA_PERFORMANCE_BONUS_DISTRIBUTE = 35;
  1080    // Funds deducted from margin account after a perpetuals funding loss.
  1081    TRANSFER_TYPE_PERPETUALS_FUNDING_LOSS = 36;
  1082    // Funds added to margin account after a perpetuals funding gain.
  1083    TRANSFER_TYPE_PERPETUALS_FUNDING_WIN = 37;
  1084    // Funds moved from the vesting account to the vested account once the vesting period is reached.
  1085    TRANSFER_TYPE_REWARDS_VESTED = 38;
  1086    // Fee referrer reward paid from general account.
  1087    TRANSFER_TYPE_FEE_REFERRER_REWARD_PAY = 39;
  1088    // Fee referrer reward received into general account of the referrer.
  1089    TRANSFER_TYPE_FEE_REFERRER_REWARD_DISTRIBUTE = 44;
  1090    // Funds transferred from general account to meet order margin requirement in isolated margin mode.
  1091    TRANSFER_TYPE_ORDER_MARGIN_LOW = 45;
  1092    // Excess order margin amount returned to general account.
  1093    TRANSFER_TYPE_ORDER_MARGIN_HIGH = 46;
  1094    // Transfer from order margin account to margin account due to increase of position.
  1095    TRANSFER_TYPE_ISOLATED_MARGIN_LOW = 47;
  1096    // Transfer from excess order margin account to general account.
  1097    TRANSFER_TYPE_ISOLATED_MARGIN_HIGH = 48;
  1098    // Transfer from a party's general account to their AMM's general account.
  1099    TRANSFER_TYPE_AMM_LOW = 49;
  1100    // Transfer from an AMM's general account to their owner's general account.
  1101    TRANSFER_TYPE_AMM_HIGH = 50;
  1102    // Transfer releasing an AMM's general account upon closure.
  1103    TRANSFER_TYPE_AMM_RELEASE = 51;
  1104    // Treasury fee paid from party's general account.
  1105    TRANSFER_TYPE_TREASURY_FEE_PAY = 52;
  1106    // Buy-back fee paid into network buy-back account.
  1107    TRANSFER_TYPE_BUY_BACK_FEE_PAY = 53;
  1108    // High-volume maker fee paid from general account
  1109    TRANSFER_TYPE_HIGH_MAKER_FEE_REBATE_PAY = 54;
  1110    // Maker fee received into general account
  1111    TRANSFER_TYPE_HIGH_MAKER_FEE_REBATE_RECEIVE = 55;
  1112  }
  1113  
  1114  // Represents a financial transfer within Vega
  1115  message Transfer {
  1116    // Party ID for the owner of the transfer.
  1117    string owner = 1;
  1118    // Financial amount of an asset to transfer.
  1119    FinancialAmount amount = 2;
  1120    // Type of transfer, gives the reason for the transfer.
  1121    TransferType type = 3;
  1122    // Minimum amount. This field is an unsigned integer scaled to the asset's decimal places.
  1123    string min_amount = 4;
  1124    // Market ID the transfer is for
  1125    string market_id = 5;
  1126  }
  1127  
  1128  enum DispatchMetric {
  1129    DISPATCH_METRIC_UNSPECIFIED = 0;
  1130    // Dispatch metric that uses the total maker fees paid in the market
  1131    DISPATCH_METRIC_MAKER_FEES_PAID = 1;
  1132    // Dispatch metric that uses the total maker fees received in the market
  1133    DISPATCH_METRIC_MAKER_FEES_RECEIVED = 2;
  1134    // Dispatch metric that uses the total LP fees received in the market
  1135    DISPATCH_METRIC_LP_FEES_RECEIVED = 3;
  1136    // Dispatch metric that uses total value of the market if above the required threshold and not paid given proposer bonus yet
  1137    DISPATCH_METRIC_MARKET_VALUE = 4;
  1138    reserved 5;
  1139    // Dispatch metric that uses the relative PNL of the party in the market
  1140    DISPATCH_METRIC_RELATIVE_RETURN = 6;
  1141    // Dispatch metric that uses return volatility of the party in the market
  1142    DISPATCH_METRIC_RETURN_VOLATILITY = 7;
  1143    // Dispatch metric that uses the validator ranking of the validator as metric
  1144    DISPATCH_METRIC_VALIDATOR_RANKING = 8;
  1145    // Dispatch metric that uses the realised return of the party in a market
  1146    DISPATCH_METRIC_REALISED_RETURN = 9;
  1147    // Dispatch metric that uses the time weighted average notional
  1148    DISPATCH_METRIC_AVERAGE_NOTIONAL = 10;
  1149    // Dispatch metric that uses the eligibility criteria of entities
  1150    DISPATCH_METRIC_ELIGIBLE_ENTITIES = 11;
  1151  }
  1152  
  1153  enum EntityScope {
  1154    ENTITY_SCOPE_UNSPECIFIED = 0;
  1155    // Rewards must be distributed directly to eligible parties.
  1156    ENTITY_SCOPE_INDIVIDUALS = 1;
  1157    // Rewards must be distributed to directly eligible teams, and then amongst team members
  1158    ENTITY_SCOPE_TEAMS = 2;
  1159  }
  1160  
  1161  enum IndividualScope {
  1162    INDIVIDUAL_SCOPE_UNSPECIFIED = 0;
  1163    // All parties on the network are within the scope of this reward.
  1164    INDIVIDUAL_SCOPE_ALL = 1;
  1165    // All parties that are part of a team are within the scope of this reward.
  1166    INDIVIDUAL_SCOPE_IN_TEAM = 2;
  1167    // All parties that are not part of a team are within the scope of this reward.
  1168    INDIVIDUAL_SCOPE_NOT_IN_TEAM = 3;
  1169    // All keys representing AMMs are within the scope of this reward.
  1170    INDIVIDUAL_SCOPE_AMM = 4;
  1171  }
  1172  
  1173  enum DistributionStrategy {
  1174    DISTRIBUTION_STRATEGY_UNSPECIFIED = 0;
  1175    // Rewards funded using the pro-rata strategy should be distributed pro-rata by each entity's reward metric, scaled by any active multipliers that party has.
  1176    DISTRIBUTION_STRATEGY_PRO_RATA = 1;
  1177    // Rewards funded using the party rank.
  1178    DISTRIBUTION_STRATEGY_RANK = 2;
  1179    // Rewards funded using the ranked lottery.
  1180    DISTRIBUTION_STRATEGY_RANK_LOTTERY = 3;
  1181  }
  1182  
  1183  message DispatchStrategy {
  1184    // Asset to use for metric.
  1185    string asset_for_metric = 1;
  1186    // Metric to apply.
  1187    DispatchMetric metric = 2;
  1188    // Optional markets in scope.
  1189    repeated string markets = 3;
  1190    // Mandatory enum that defines the entities within scope.
  1191    EntityScope entity_scope = 4;
  1192    // Optional enum if the entity scope defined is for individuals, which determines the subset of individuals that are eligible to be rewarded.
  1193    IndividualScope individual_scope = 5;
  1194    // Optional list applicable if the reward type has a scope of teams, which allows the funder to define a list of team IDs that are eligible to be rewarded from this transfer
  1195    repeated string team_scope = 6;
  1196    // The proportion of the top performers in the team for a given metric to be averaged for the metric calculation if the scope is team
  1197    string n_top_performers = 7;
  1198    // Minimum number of governance (e.g. VEGA) tokens staked for a party to be considered eligible. Defaults to 0
  1199    string staking_requirement = 8;
  1200    // Minimum notional time-weighted averaged position required for a party to be considered eligible. Defaults to 0
  1201    string notional_time_weighted_average_position_requirement = 9;
  1202    // Number of epochs to evaluate the metric on
  1203    uint64 window_length = 10;
  1204    // Number of epochs after distribution to delay vesting of rewards by
  1205    uint64 lock_period = 11;
  1206    // Controls how the reward is distributed between qualifying parties
  1207    DistributionStrategy distribution_strategy = 12;
  1208    // Ordered list, using start rank, defining the rank bands and share ratio for each band. Mandatory for the rank and rank lottery distribution strategies.
  1209    repeated Rank rank_table = 13;
  1210    // If set, the actual amount of rewards transferred to each public key during distribution for this transfer will be `min(calculated_reward_in_quantum, cap_reward_fee_multiple Ă— fees_paid_this_epoch_in_quantum).
  1211    optional string cap_reward_fee_multiple = 14;
  1212    // Number of epochs between transfers, i.e. when 4, funds will be transferred every 4 epochs with the first transfer occurring 4 epochs after the transaction is processed.
  1213    optional int32 transfer_interval = 15;
  1214    // If set, the target notional factor used to scale the amount to be taken from the source account
  1215    optional string target_notional_volume = 16;
  1216    // A list of party keys to constrain the potential receivers of a reward transfer.
  1217    repeated string eligible_keys = 17;
  1218  }
  1219  
  1220  message Rank {
  1221    uint32 start_rank = 1;
  1222    uint32 share_ratio = 2;
  1223  }
  1224  
  1225  // Represents a request to transfer from one set of accounts to another
  1226  message TransferRequest {
  1227    // One or more accounts to transfer from.
  1228    repeated Account from_account = 1;
  1229    // One or more accounts to transfer to.
  1230    repeated Account to_account = 2;
  1231    // Amount to transfer for the asset. This field is an unsigned integer scaled to the asset's decimal places.
  1232    string amount = 3;
  1233    // Minimum amount that needs to be transferred for the transfer request. If this minimum isn't reached, it will error.
  1234    // This field is an unsigned integer scaled to the asset's decimal places.
  1235    string min_amount = 4;
  1236    // Asset ID of the asset being transferred.
  1237    string asset = 5;
  1238    // Type of the request for transfer.
  1239    TransferType type = 7;
  1240  }
  1241  
  1242  message AccountDetails {
  1243    // Asset ID of the asset for this account.
  1244    string asset_id = 1;
  1245    // Type of the account.
  1246    AccountType type = 2;
  1247    // Not specified if network account.
  1248    optional string owner = 3;
  1249    // Not specified if account is not related to a market.
  1250    optional string market_id = 4;
  1251  }
  1252  
  1253  // Represents a ledger entry on Vega
  1254  message LedgerEntry {
  1255    // One or more accounts to transfer from.
  1256    AccountDetails from_account = 1;
  1257    // One or more accounts to transfer to.
  1258    AccountDetails to_account = 2;
  1259    // Amount to transfer. This field is an unsigned integer scaled to the asset's decimal places.
  1260    string amount = 3;
  1261    // Transfer type for this entry.
  1262    TransferType type = 4;
  1263    // Timestamp in nanoseconds of when the ledger entry was created.
  1264    int64 timestamp = 5;
  1265    // Sender account balance after the transfer. This field is an unsigned integer scaled to the asset's decimal places.
  1266    string from_account_balance = 6;
  1267    // Receiver account balance after the transfer. This field is an unsigned integer scaled to the asset's decimal places.
  1268    string to_account_balance = 7;
  1269    // Transfer ID the ledger entry relates to.
  1270    optional string transfer_id = 8;
  1271  }
  1272  
  1273  // Represents the balance for an account during a transfer
  1274  message PostTransferBalance {
  1275    // Account relating to the transfer.
  1276    AccountDetails account = 1;
  1277    // Balance relating to the transfer. This field is an unsigned integer scaled to the asset's decimal places.
  1278    string balance = 2;
  1279  }
  1280  
  1281  message LedgerMovement {
  1282    // All the entries for these ledger movements.
  1283    repeated LedgerEntry entries = 1;
  1284    // Resulting balances once the ledger movement are applied.
  1285    repeated PostTransferBalance balances = 2;
  1286  }
  1287  
  1288  // Represents the margin levels for a party on a market at a given time
  1289  message MarginLevels {
  1290    // Maintenance margin value. This field is an unsigned integer scaled to the asset's decimal places.
  1291    string maintenance_margin = 1;
  1292    // Margin search level value. This field is an unsigned integer scaled to the asset's decimal places.
  1293    string search_level = 2;
  1294    // Initial margin value. This field is an unsigned integer scaled to the asset's decimal places.
  1295    string initial_margin = 3;
  1296    // Collateral release level value. This field is an unsigned integer scaled to the asset's decimal places.
  1297    string collateral_release_level = 4;
  1298    // Party ID for whom the margin levels apply.
  1299    string party_id = 5;
  1300    // Market ID for which the margin levels apply.
  1301    string market_id = 6;
  1302    // Asset ID for which the margin levels apply.
  1303    string asset = 7;
  1304    // Timestamp in Unix nanoseconds for when the ledger entry was created.
  1305    int64 timestamp = 8;
  1306    // Margin required to cover orders in isolated margin mode.
  1307    string order_margin = 9;
  1308    // Margin mode for the party, cross margin or isolated margin.
  1309    MarginMode margin_mode = 10;
  1310    // Margin factor, relevant only for isolated margin, 0 otherwise.
  1311    string margin_factor = 11;
  1312  }
  1313  
  1314  // Represents market data specific to a perpetual market.
  1315  message PerpetualData {
  1316    // Current funding payment for the in-progress funding period.
  1317    string funding_payment = 1;
  1318    // Current funding rate for the in-progress funding period.
  1319    string funding_rate = 2;
  1320    // Time-weighted-average the internal data-points for the in-progress funding period.
  1321    string internal_twap = 3;
  1322    // Time-weighted-average the external data points for the in-progress funding period.
  1323    string external_twap = 4;
  1324    // Funding period sequence number
  1325    uint64 seq_num = 5;
  1326    // Funding period start time
  1327    int64 start_time = 6;
  1328    // The internal composite price used for perpetual markets.
  1329    string internal_composite_price = 7;
  1330    // The next time the internal composite price is calculated for the perpetual market, in Unix nanoseconds.
  1331    int64 next_internal_composite_price_calc = 8;
  1332    // The method used for calculating the internal composite price, for perpetual markets only.
  1333    CompositePriceType internal_composite_price_type = 9;
  1334    // Last seen value of the settlement oracle.
  1335    string underlying_index_price = 10;
  1336    // State of the internal composite price.
  1337    CompositePriceState internal_composite_price_state = 11;
  1338  }
  1339  
  1340  // Represents market data specific to a particular product type.
  1341  message ProductData {
  1342    oneof data {
  1343      PerpetualData perpetual_data = 31;
  1344    }
  1345  }
  1346  
  1347  message ProtocolAutomatedPurchaseData {
  1348    // Identifier of the active protocol automated purchase
  1349    string id = 1;
  1350    // Identifier of the active order for protocol automated purchase if any
  1351    optional string order_id = 2;
  1352  }
  1353  
  1354  // Represents data generated by a market when open
  1355  message MarketData {
  1356    // Mark price, as an unsigned integer, for example `123456` is a correctly
  1357    // formatted price of `1.23456` assuming market configured to 5 decimal places.
  1358    string mark_price = 1;
  1359    // Highest price level on an order book for buy orders, as an unsigned integer, for example `123456` is a correctly
  1360    // formatted price of `1.23456` assuming market configured to 5 decimal places.
  1361    string best_bid_price = 2;
  1362    // Aggregated volume being bid at the best bid price, as an integer, for example `123456` is a correctly
  1363    // formatted price of `1.23456` assuming market is configured to 5 decimal places.
  1364    uint64 best_bid_volume = 3;
  1365    // Lowest price level on an order book for offer orders. This field is an unsigned integer scaled to the market's decimal places.
  1366    string best_offer_price = 4;
  1367    // Aggregated volume being offered at the best offer price, as an integer, for example `123456` is a correctly
  1368    // formatted price of `1.23456` assuming market is configured to 5 decimal places.
  1369    uint64 best_offer_volume = 5;
  1370    // Highest price on the order book for buy orders not including pegged orders.
  1371    // This field is an unsigned integer scaled to the market's decimal places.
  1372    string best_static_bid_price = 6;
  1373    // Total volume at the best static bid price excluding pegged orders.
  1374    uint64 best_static_bid_volume = 7;
  1375    // Lowest price on the order book for sell orders not including pegged orders.
  1376    // This field is an unsigned integer scaled to the market's decimal places.
  1377    string best_static_offer_price = 8;
  1378    // Total volume at the best static offer price, excluding pegged orders.
  1379    uint64 best_static_offer_volume = 9;
  1380    // Arithmetic average of the best bid price and best offer price, as an integer, for example `123456` is a correctly
  1381    // formatted price of `1.23456` assuming market configured to 5 decimal places.
  1382    string mid_price = 10;
  1383    // Arithmetic average of the best static bid price and best static offer price.
  1384    // This field is an unsigned integer scaled to the market's decimal places.
  1385    string static_mid_price = 11;
  1386    // Market ID for the data
  1387    string market = 12;
  1388    // Timestamp in Unix nanoseconds at which this mark price was relevant.
  1389    int64 timestamp = 13;
  1390    // Sum of the size of all positions greater than zero on the market.
  1391    uint64 open_interest = 14;
  1392    // Time in seconds until the end of the auction (zero if currently not in auction period).
  1393    int64 auction_end = 15;
  1394    // Time until next auction, or start time of the current auction if market is in auction period.
  1395    int64 auction_start = 16;
  1396    // Indicative price (zero if not in auction). This field is an unsigned scaled to the market's decimal places.
  1397    string indicative_price = 17;
  1398    // Indicative volume (zero if not in auction).
  1399    uint64 indicative_volume = 18;
  1400    // Current trading mode for the market.
  1401    Market.TradingMode market_trading_mode = 19;
  1402    // When a market is in an auction trading mode, this field indicates what triggered the auction.
  1403    AuctionTrigger trigger = 20;
  1404    // When a market auction is extended, this field indicates what caused the extension.
  1405    AuctionTrigger extension_trigger = 21;
  1406    // Targeted stake for the given market. This field is an unsigned integer scaled to the settlement asset's decimal places.
  1407    string target_stake = 22;
  1408    // Available stake for the given market. This field is an unsigned integer scaled to the settlement asset's decimal places.
  1409    string supplied_stake = 23;
  1410    // One or more price monitoring bounds for the current timestamp.
  1411    repeated PriceMonitoringBounds price_monitoring_bounds = 24;
  1412    // Market value proxy.
  1413    string market_value_proxy = 25;
  1414    // Equity-like share of liquidity fee for each liquidity provider.
  1415    repeated LiquidityProviderFeeShare liquidity_provider_fee_share = 26;
  1416    // Current state of the market.
  1417    Market.State market_state = 27;
  1418    // Time in Unix nanoseconds when the next mark-to-market calculation will occur.
  1419    int64 next_mark_to_market = 28;
  1420    // Last traded price of the market. This field is an unsigned integer scaled to the market's decimal places.
  1421    string last_traded_price = 29;
  1422    // Market growth at the last market time window.
  1423    string market_growth = 30;
  1424    // Data related to the particular product type of the market.
  1425    optional ProductData product_data = 31;
  1426    // SLA performance for each liquidity provider.
  1427    repeated LiquidityProviderSLA liquidity_provider_sla = 32;
  1428    // Time in Unix nanoseconds when the market will next submit a trade to reduce its position.
  1429    int64 next_network_closeout = 33;
  1430    // The method used for calculating the mark price.
  1431    CompositePriceType mark_price_type = 34;
  1432    // State of the internal composite price.
  1433    CompositePriceState mark_price_state = 35;
  1434    // Optional information on the active protocol automated purchase for the market - only applies to spot markets.
  1435    optional ProtocolAutomatedPurchaseData active_protocol_automated_purchase = 36;
  1436  }
  1437  
  1438  message CompositePriceSource {
  1439    // Source of the price.
  1440    string price_source = 1;
  1441    // Current value of the composite source price.
  1442    string price = 2;
  1443    // Timestamp in Unix nanoseconds when the price source was last updated.
  1444    int64 last_updated = 3;
  1445  }
  1446  
  1447  // Underlying state of the composite price..
  1448  message CompositePriceState {
  1449    repeated CompositePriceSource price_sources = 1;
  1450  }
  1451  
  1452  // Equity-like share of liquidity fee for each liquidity provider
  1453  message LiquidityProviderFeeShare {
  1454    // Liquidity provider party ID.
  1455    string party = 1;
  1456    // Share own by this liquidity provider.
  1457    string equity_like_share = 2;
  1458    // Average entry valuation of the liquidity provider for the market.
  1459    string average_entry_valuation = 3;
  1460    // Average liquidity score.
  1461    string average_score = 4;
  1462    // The virtual stake of this liquidity provider.
  1463    string virtual_stake = 5;
  1464  }
  1465  
  1466  // SLA performance for each liquidity provider
  1467  message LiquidityProviderSLA {
  1468    // Liquidity provider party ID.
  1469    string party = 1;
  1470    // Indicates how often LP meets the commitment during the current epoch.
  1471    string current_epoch_fraction_of_time_on_book = 2;
  1472    // Indicates how often LP met the commitment in the previous epoch.
  1473    string last_epoch_fraction_of_time_on_book = 3;
  1474    // Indicates the fee penalty amount applied in the previous epoch.
  1475    string last_epoch_fee_penalty = 4;
  1476    // Shows the bond penalties from past epochs.
  1477    string last_epoch_bond_penalty = 5;
  1478    // Determines how the fee penalties from past epochs affect future fee revenue.
  1479    repeated string hysteresis_period_fee_penalties = 6;
  1480    // Represents the total amount of funds LP must supply. The amount to be supplied is in the market’s
  1481    // settlement currency, spread on both buy and sell sides of the order book within a defined range.
  1482    string required_liquidity = 7;
  1483    // Notional volume of orders within the range provided on the buy side of the book.
  1484    string notional_volume_buys = 8;
  1485    // Notional volume of orders within the range provided on the sell side of the book.
  1486    string notional_volume_sells = 9;
  1487  }
  1488  
  1489  // Represents a list of valid (at the current timestamp) price ranges per associated trigger
  1490  message PriceMonitoringBounds {
  1491    // Minimum price that isn't currently breaching the specified price monitoring trigger.
  1492    // This field is an unsigned integer scaled to the market's decimal places.
  1493    string min_valid_price = 1;
  1494    // Maximum price that isn't currently breaching the specified price monitoring trigger.
  1495    // This field is an unsigned integer scaled to the market's decimal places.
  1496    string max_valid_price = 2;
  1497    // Price monitoring trigger associated with the bounds.
  1498    PriceMonitoringTrigger trigger = 3;
  1499    // Reference price used to calculate the valid price range. This field is an unsigned integer scaled to the market's decimal places.
  1500    string reference_price = 4;
  1501    // Has this bound been triggered yet or is it still active.
  1502    bool active = 5;
  1503  }
  1504  
  1505  // Represents Vega domain specific error information over gRPC/Protobuf
  1506  message ErrorDetail {
  1507    // Vega API domain specific unique error code, useful for client side mappings, e.g. 10004.
  1508    int32 code = 1;
  1509    // Message that describes the error in more detail, should describe the problem encountered.
  1510    string message = 2;
  1511    // Any inner error information that could add more context, or be helpful for error reporting.
  1512    string inner = 3;
  1513  }
  1514  
  1515  // Represents a network parameter on Vega
  1516  message NetworkParameter {
  1517    // Unique key of the network parameter.
  1518    string key = 1;
  1519    // Value for the network parameter.
  1520    string value = 2;
  1521  }
  1522  
  1523  // Network limits, defined in the genesis file
  1524  message NetworkLimits {
  1525    reserved 3, 6;
  1526  
  1527    // Are market proposals allowed at this point in time.
  1528    bool can_propose_market = 1;
  1529    // Are asset proposals allowed at this point in time.
  1530    bool can_propose_asset = 2;
  1531    // Are market proposals enabled on this chain.
  1532    bool propose_market_enabled = 4;
  1533    // Are asset proposals enabled on this chain.
  1534    bool propose_asset_enabled = 5;
  1535    // True once the genesis file is loaded.
  1536    bool genesis_loaded = 7;
  1537    // Timestamp in Unix nanoseconds at which market proposals will be enabled (0 indicates not set).
  1538    int64 propose_market_enabled_from = 8;
  1539    // Timestamp in Unix nanoseconds at which asset proposals will be enabled (0 indicates not set).
  1540    int64 propose_asset_enabled_from = 9;
  1541    // Are spot market proposals allowed at this point in time.
  1542    bool can_propose_spot_market = 10;
  1543    // Are perpetual market proposals allowed at this point in time.
  1544    bool can_propose_perpetual_market = 11;
  1545    // Can parties use AMM related transactions.
  1546    bool can_use_amm = 12;
  1547  }
  1548  
  1549  // Represents a liquidity order
  1550  message LiquidityOrder {
  1551    // Pegged reference point for the order.
  1552    PeggedReference reference = 1;
  1553    // Relative proportion of the commitment to be allocated at a price level.
  1554    uint32 proportion = 2;
  1555    // Offset/amount of units away for the order. This field is an unsigned integer scaled using the market's decimal places.
  1556    string offset = 3;
  1557  }
  1558  
  1559  // Pair of a liquidity order and the ID of the generated order
  1560  message LiquidityOrderReference {
  1561    // Unique ID of the pegged order generated to fulfil this liquidity order.
  1562    string order_id = 1;
  1563    // Liquidity order from the original submission.
  1564    LiquidityOrder liquidity_order = 2;
  1565  }
  1566  
  1567  // Liquidity provider commitment
  1568  message LiquidityProvision {
  1569    // Status of a liquidity provision.
  1570    enum Status {
  1571      // Always invalid
  1572      STATUS_UNSPECIFIED = 0;
  1573      // Liquidity provision is active
  1574      STATUS_ACTIVE = 1;
  1575      // Liquidity provision was stopped by the network
  1576      STATUS_STOPPED = 2;
  1577      // Liquidity provision was cancelled by the liquidity provider
  1578      STATUS_CANCELLED = 3;
  1579      // Liquidity provision was invalid and got rejected
  1580      STATUS_REJECTED = 4;
  1581      // Liquidity provision is valid and accepted by network, but orders aren't deployed
  1582      STATUS_UNDEPLOYED = 5;
  1583      // Liquidity provision is valid and accepted by network
  1584      // but has never been deployed. If when it's possible to deploy the orders for the first time
  1585      // margin check fails, then they will be cancelled without any penalties.
  1586      STATUS_PENDING = 6;
  1587    }
  1588  
  1589    // Unique ID for the liquidity provision.
  1590    string id = 1;
  1591    // Unique party ID for the creator of the provision.
  1592    string party_id = 2;
  1593    // Timestamp in Unix nanoseconds for when the liquidity provision was created.
  1594    int64 created_at = 3;
  1595    // Timestamp in Unix nanoseconds for when the liquidity provision was updated.
  1596    int64 updated_at = 4;
  1597    // Market ID for the liquidity provision.
  1598    string market_id = 5;
  1599    // Specified as a unitless number that represents the amount of settlement asset of the market.
  1600    // This field is an unsigned integer scaled to the asset's decimal places.
  1601    string commitment_amount = 6;
  1602    // Nominated liquidity fee factor, which is an input to the calculation of taker fees on the market, as per setting fees and rewarding liquidity providers.
  1603    string fee = 7;
  1604    // Set of liquidity sell orders to meet the liquidity provision obligation.
  1605    repeated LiquidityOrderReference sells = 8;
  1606    // Set of liquidity buy orders to meet the liquidity provision obligation.
  1607    repeated LiquidityOrderReference buys = 9;
  1608    // Version of this liquidity provision.
  1609    uint64 version = 10;
  1610    // Status of this liquidity provision.
  1611    Status status = 11;
  1612    // Reference shared between this liquidity provision and all its orders.
  1613    string reference = 12;
  1614  }
  1615  
  1616  message EthereumL2Config {
  1617    // Network ID of this Ethereum layer 2 network.
  1618    string network_id = 1;
  1619    // Chain ID of this Ethereum layer 2 network.
  1620    string chain_id = 2;
  1621    // Number of block confirmations to wait to consider an Ethereum transaction trusted.
  1622    // An Ethereum block is trusted when there are at least "n" blocks confirmed by the
  1623    // network, "n" being the number of `confirmations` required. If `confirmations` was set to `3`,
  1624    // and the current block to be forged, or mined, on the L2 is block 14, block
  1625    // 10 would be considered as trusted, but not block 11.
  1626    uint32 confirmations = 3;
  1627    // Display name of this network
  1628    string name = 4;
  1629    // Polling interval for the internal engine, needs to be adapted
  1630    // to the source chain depending on its block production rate.
  1631    uint64 block_interval = 5;
  1632  }
  1633  
  1634  message EthereumL2Configs {
  1635    repeated EthereumL2Config configs = 1;
  1636  }
  1637  
  1638  // Ethereum configuration details.
  1639  message EthereumConfig {
  1640    // Network ID of this Ethereum network.
  1641    string network_id = 1;
  1642    // Chain ID of this Ethereum network.
  1643    string chain_id = 2;
  1644    // Contract configuration of the collateral bridge contract for this Ethereum network.
  1645    EthereumContractConfig collateral_bridge_contract = 3;
  1646    // Number of block confirmations to wait to consider an Ethereum transaction trusted.
  1647    // An Ethereum block is trusted when there are at least "n" blocks confirmed by the
  1648    // network, "n" being the number of `confirmations` required. If `confirmations` was set to `3`,
  1649    // and the current block to be forged (or mined) on Ethereum is block 14, block
  1650    // 10 would be considered as trusted, but not block 11.
  1651    uint32 confirmations = 4;
  1652    // Contract configuration of the stacking bridge contract for this Ethereum network.
  1653    EthereumContractConfig staking_bridge_contract = 5;
  1654    // Contract configuration of the token vesting contract for this Ethereum network.
  1655    EthereumContractConfig token_vesting_contract = 6;
  1656    // Contract configuration of the multisig control contract for this Ethereum network.
  1657    EthereumContractConfig multisig_control_contract = 7;
  1658    // Approximate block time of the EVM chain as a duration e.g. 12s, 250ms.
  1659    string block_time = 8;
  1660  }
  1661  
  1662  // EVM Chain configuration details.
  1663  message EVMBridgeConfig {
  1664    // Network ID of this EVM compatible network.
  1665    string network_id = 1;
  1666    // Chain ID of this EVM compatible network.
  1667    string chain_id = 2;
  1668    // Contract configuration of the collateral bridge contract for this EVM compatible network.
  1669    EthereumContractConfig collateral_bridge_contract = 3;
  1670    // Number of block confirmations to wait to consider an EVM compatible chain transaction trusted.
  1671    // An EVM compatible chain block is trusted when there are at least "n" blocks confirmed by the
  1672    // network, "n" being the number of `confirmations` required. If `confirmations` was set to `3`,
  1673    // and the current block to be forged (or mined) on the EVM compatible chain is block 14, block
  1674    // 10 would be considered as trusted, but not block 11.
  1675    uint32 confirmations = 4;
  1676    // Contract configuration of the multisig control contract for this EVM compatible network.
  1677    EthereumContractConfig multisig_control_contract = 5;
  1678    // Approximate block time of the EVM chain as a duration e.g. 12s, 250ms.
  1679    string block_time = 6;
  1680    // Display name of this network.
  1681    string name = 7;
  1682  }
  1683  
  1684  // A list of EVM bridge configurations
  1685  message EVMBridgeConfigs {
  1686    // The EVM configurations
  1687    repeated EVMBridgeConfig configs = 1;
  1688  }
  1689  
  1690  message EthereumContractConfig {
  1691    // Address of the contract for this EVM compatible network. The address should start with "0x".
  1692    string address = 1;
  1693    // Block height at which the stacking contract has been deployed for this Ethereum network.
  1694    uint64 deployment_block_height = 6;
  1695  }
  1696  
  1697  // Node status type
  1698  enum NodeStatus {
  1699    NODE_STATUS_UNSPECIFIED = 0;
  1700    // Node is a validating node
  1701    NODE_STATUS_VALIDATOR = 1;
  1702    // Node is a non-validating node
  1703    NODE_STATUS_NON_VALIDATOR = 2;
  1704  }
  1705  
  1706  // Describes in both human readable and block time when an epoch spans
  1707  message EpochTimestamps {
  1708    // Timestamp in Unix nanoseconds for when epoch started.
  1709    int64 start_time = 1;
  1710    // Timestamp in Unix nanoseconds for the epoch's expiry.
  1711    int64 expiry_time = 2;
  1712    // Timestamp in Unix nanoseconds for when the epoch ended, empty if not ended.
  1713    int64 end_time = 3;
  1714    // Height of first block in the epoch.
  1715    uint64 first_block = 4;
  1716    // Height of last block in the epoch, empty if not ended.
  1717    uint64 last_block = 5;
  1718  }
  1719  
  1720  // What epoch action has occurred
  1721  enum EpochAction {
  1722    EPOCH_ACTION_UNSPECIFIED = 0;
  1723    // Epoch update is for a new epoch.
  1724    EPOCH_ACTION_START = 1;
  1725    // Epoch update is for the end of an epoch.
  1726    EPOCH_ACTION_END = 2;
  1727  }
  1728  
  1729  message Epoch {
  1730    // Sequence is used as epoch ID.
  1731    uint64 seq = 1;
  1732    // Timestamps for start/end etc.
  1733    EpochTimestamps timestamps = 2;
  1734    // Validators that participated in this epoch.
  1735    repeated Node validators = 3;
  1736    // List of all delegations in epoch.
  1737    repeated Delegation delegations = 4;
  1738  }
  1739  
  1740  message EpochParticipation {
  1741    Epoch epoch = 1;
  1742    uint64 offline = 2;
  1743    uint64 online = 3;
  1744    double total_rewards = 4;
  1745  }
  1746  
  1747  message EpochData {
  1748    // Total number of epochs since node was created.
  1749    int32 total = 1;
  1750    // Total number of offline epochs since node was created.
  1751    int32 offline = 2;
  1752    // Total number of online epochs since node was created.
  1753    int32 online = 3;
  1754  }
  1755  
  1756  // Validation status of the node
  1757  enum ValidatorNodeStatus {
  1758    VALIDATOR_NODE_STATUS_UNSPECIFIED = 0;
  1759    // Node is a tendermint validator
  1760    VALIDATOR_NODE_STATUS_TENDERMINT = 1;
  1761    // Node is an ersatz validator
  1762    VALIDATOR_NODE_STATUS_ERSATZ = 2;
  1763    // Node is a pending validator
  1764    VALIDATOR_NODE_STATUS_PENDING = 3;
  1765  }
  1766  
  1767  message RankingScore {
  1768    // Stake based score - no anti-whaling.
  1769    string stake_score = 1;
  1770    // Performance based score.
  1771    string performance_score = 2;
  1772    // Status of the validator in the previous epoch.
  1773    ValidatorNodeStatus previous_status = 3;
  1774    // Status of the validator in the current epoch.
  1775    ValidatorNodeStatus status = 4;
  1776    // Tendermint voting power of the validator.
  1777    uint32 voting_power = 5;
  1778    // Final score.
  1779    string ranking_score = 6;
  1780  }
  1781  
  1782  message RewardScore {
  1783    // Stake based score - with anti-whaling.
  1784    string raw_validator_score = 1;
  1785    // Performance based score.
  1786    string performance_score = 2;
  1787    // Multisig score.
  1788    string multisig_score = 3;
  1789    // Un-normalised score.
  1790    string validator_score = 4;
  1791    // Normalised validator score for rewards.
  1792    string normalised_score = 5;
  1793    // Status of the validator for reward.
  1794    ValidatorNodeStatus validator_status = 6;
  1795  }
  1796  
  1797  message Node {
  1798    // Node ID i.e. the node's wallet ID.
  1799    string id = 1;
  1800    // Public key of the node operator.
  1801    string pub_key = 2;
  1802    // Public key of Tendermint.
  1803    string tm_pub_key = 3;
  1804    // Ethereum public key of the node.
  1805    string ethereum_address = 4;
  1806    // URL where users can find out more information on the node.
  1807    string info_url = 5;
  1808    // Country code for the location of the node.
  1809    string location = 6;
  1810    // Amount the node operator has put up themselves. This field is an unsigned integer scaled to the asset's decimal places.
  1811    string staked_by_operator = 7;
  1812    // Amount of stake that has been delegated by token holders. This field is an unsigned integer scaled to the asset's decimal places.
  1813    string staked_by_delegates = 8;
  1814    // Total amount staked on node. This field is an unsigned integer scaled to the asset's decimal places.
  1815    string staked_total = 9;
  1816    // Max amount of (wanted) stake. This field is an unsigned integer scaled to the asset's decimal places.
  1817    string max_intended_stake = 10;
  1818    // Amount of stake on the next epoch. This field is an unsigned integer scaled to the asset's decimal places.
  1819    string pending_stake = 11;
  1820    // Information about epoch.
  1821    EpochData epoch_data = 12;
  1822    // Node status.
  1823    NodeStatus status = 13;
  1824    // Node's delegations.
  1825    repeated Delegation delegations = 14;
  1826    // Node reward score.
  1827    RewardScore reward_score = 15;
  1828    // Node ranking information.
  1829    RankingScore ranking_score = 16;
  1830    // Node name.
  1831    string name = 17;
  1832    // Avatar url.
  1833    string avatar_url = 18;
  1834  }
  1835  
  1836  // Details on the collection of nodes for a particular validator status
  1837  message NodeSet {
  1838    // Total number of nodes in the node set.
  1839    uint32 total = 1;
  1840    // Number of nodes in the node set that had a performance score of 0 at the end of the last epoch.
  1841    uint32 inactive = 2;
  1842    // IDs of nodes that were promoted into this node set at the start of the epoch.
  1843    repeated string promoted = 3;
  1844    // IDs of nodes that were demoted into this node set at the start of the epoch.
  1845    repeated string demoted = 4;
  1846    // Total number of nodes allowed in the node set.
  1847    optional uint32 maximum = 5;
  1848  }
  1849  
  1850  message NodeData {
  1851    // Total staked amount across all nodes. This field is an unsigned integer scaled to the asset's decimal places.
  1852    string staked_total = 1;
  1853    // Total number of nodes across all node sets.
  1854    uint32 total_nodes = 2;
  1855    // Total number of nodes that had a performance score of 0 at the end of the last epoch.
  1856    uint32 inactive_nodes = 3;
  1857    // Details on the set of consensus nodes in the network.
  1858    NodeSet tendermint_nodes = 4;
  1859    // Details on the set of ersatz (standby) nodes in the network.
  1860    NodeSet ersatz_nodes = 5;
  1861    // Details on the set of pending nodes in the network.
  1862    NodeSet pending_nodes = 6;
  1863    // Total uptime for all epochs across all nodes.
  1864    float uptime = 7;
  1865  }
  1866  
  1867  message Delegation {
  1868    // Party which is delegating.
  1869    string party = 1;
  1870    // Node ID to delegate to.
  1871    string node_id = 2;
  1872    // Amount delegated. This field is an unsigned integer scaled to the asset's decimal places.
  1873    string amount = 3;
  1874    // Epoch of delegation.
  1875    string epoch_seq = 4;
  1876  }
  1877  
  1878  // Details for a single reward payment
  1879  message Reward {
  1880    // Asset ID in which the reward is being paid.
  1881    string asset_id = 1;
  1882    // Party ID to whom the reward is being paid.
  1883    string party_id = 2;
  1884    // Epoch in which the reward is being paid.
  1885    uint64 epoch = 3;
  1886    // Amount paid as a reward. This field is an unsigned integer scaled to the asset's decimal places.
  1887    string amount = 4;
  1888    // Percentage of total rewards paid in the epoch.
  1889    string percentage_of_total = 5;
  1890    // Timestamp at which the reward was paid as Unix nano time.
  1891    int64 received_at = 6;
  1892    // Market ID in which the reward is being paid.
  1893    string market_id = 7;
  1894    // Type of reward being paid.
  1895    string reward_type = 8;
  1896    // The epoch when the reward is being released.
  1897    uint64 locked_until_epoch = 9;
  1898    // Amount paid as a reward, expressed in asset's quantum unit.
  1899    string quantum_amount = 10;
  1900    // ID of the game the reward payment was made for if the payment was made for participation in a game.
  1901    optional string game_id = 11;
  1902    // ID of the team the party is a member of, if the party is a member of a participating team,
  1903    // and the reward payment was made for participation in a game.
  1904    // This field is currently only populated by the rewards API.
  1905    optional string team_id = 12;
  1906  }
  1907  
  1908  // Details for rewards for a single asset
  1909  message RewardSummary {
  1910    // Asset ID in which the reward is being paid.
  1911    string asset_id = 1;
  1912    // Party ID to whom the reward is being paid.
  1913    string party_id = 2;
  1914    // Total amount of rewards paid in the asset. This field is an unsigned integer scaled to the asset's decimal places.
  1915    string amount = 3;
  1916  }
  1917  
  1918  // Details for rewards for a combination of asset, market, and reward type in a given epoch
  1919  message EpochRewardSummary {
  1920    // Epoch in which the reward is being paid.
  1921    uint64 epoch = 1;
  1922    // Asset ID in which the reward is being paid.
  1923    string asset_id = 2;
  1924    // Market ID in which the reward is being paid.
  1925    string market_id = 3;
  1926    // Type of reward being paid.
  1927    string reward_type = 4;
  1928    // Amount distributed. This field is an unsigned integer scaled to the asset's decimal places.
  1929    string amount = 5;
  1930  }
  1931  
  1932  message StateValueProposal {
  1933    // State variable ID.
  1934    string state_var_id = 1;
  1935    // Event ID.
  1936    string event_id = 2;
  1937    // Key value tolerance triplets.
  1938    repeated KeyValueBundle kvb = 3;
  1939  }
  1940  
  1941  message KeyValueBundle {
  1942    string key = 1;
  1943    string tolerance = 2;
  1944    StateVarValue value = 3;
  1945  }
  1946  
  1947  message StateVarValue {
  1948    oneof value {
  1949      ScalarValue scalar_val = 1;
  1950      VectorValue vector_val = 2;
  1951      MatrixValue matrix_val = 3;
  1952    }
  1953  }
  1954  
  1955  message ScalarValue {
  1956    string value = 1;
  1957  }
  1958  
  1959  message VectorValue {
  1960    repeated string value = 1;
  1961  }
  1962  
  1963  message MatrixValue {
  1964    repeated VectorValue value = 1;
  1965  }
  1966  
  1967  message ReferralProgram {
  1968    // Incremental version of the program. It is incremented after each program
  1969    // update.
  1970    uint64 version = 1;
  1971    // Unique ID generated from the proposal that created this program.
  1972    string id = 2;
  1973    // Defined benefit tiers ordered by increasing discounts.
  1974    repeated BenefitTier benefit_tiers = 3;
  1975    // Timestamp in Unix nanoseconds, after which when the current epoch ends,
  1976    // the program will end and benefits will be disabled.
  1977    int64 end_of_program_timestamp = 4;
  1978    // Number of epochs over which the referral set's running volume is evaluated.
  1979    uint64 window_length = 5;
  1980    // Defined benefit tiers ordered by increasing reward multiplier. Determines the level of
  1981    // benefit a party can expect based on their staking.
  1982    repeated StakingTier staking_tiers = 6;
  1983  }
  1984  
  1985  message VolumeBenefitTier {
  1986    // Required running notional taker volume in quantum units for parties
  1987    // to access this tier.
  1988    string minimum_running_notional_taker_volume = 1;
  1989    // deprecated
  1990    string volume_discount_factor = 2;
  1991    // Proportion of the taker fees to be discounted.
  1992    DiscountFactors volume_discount_factors = 3;
  1993    // The tier number. It's set by the core, and used in the party fee stats API.
  1994    optional uint64 tier_number = 4;
  1995  }
  1996  
  1997  message BenefitTier {
  1998    // Required running notional taker volume in quantum units for parties
  1999    // to access this tier.
  2000    string minimum_running_notional_taker_volume = 1;
  2001    // Required number of epochs a party must have been in a referral set to
  2002    // access this tier.
  2003    string minimum_epochs = 2;
  2004  
  2005    // deprecated
  2006    string referral_reward_factor = 3;
  2007  
  2008    // deprecated
  2009    string referral_discount_factor = 4;
  2010  
  2011    // Proportion of the referee's fees to be rewarded to the referrer.
  2012    RewardFactors referral_reward_factors = 5;
  2013  
  2014    // Referral discount factors for the various fees.
  2015    DiscountFactors referral_discount_factors = 6;
  2016  
  2017    // The tier number. It's set by the core, and used in the party fee stats API.
  2018    optional uint64 tier_number = 7;
  2019  }
  2020  
  2021  message RewardFactors {
  2022    // Proportion of the referee's infrastructure fees to be rewarded to the referrer.
  2023    string infrastructure_reward_factor = 1;
  2024    // Proportion of the referee's liquidity fees to be rewarded to the referrer.
  2025    string liquidity_reward_factor = 2;
  2026    // Proportion of the maker fees to be rewarded.
  2027    string maker_reward_factor = 3;
  2028  }
  2029  
  2030  message DiscountFactors {
  2031    // Proportion of the referee's infrastructure fee to be discounted.
  2032    string infrastructure_discount_factor = 1;
  2033    // Proportion of the referee's liquidity fee to be discounted.
  2034    string liquidity_discount_factor = 2;
  2035    // Proportion of the referee's maker fee to be discounted.
  2036    string maker_discount_factor = 3;
  2037  }
  2038  
  2039  message VestingBenefitTiers {
  2040    repeated VestingBenefitTier tiers = 1;
  2041  }
  2042  
  2043  message VestingBenefitTier {
  2044    string minimum_quantum_balance = 1;
  2045    string reward_multiplier = 2;
  2046  }
  2047  
  2048  message StakingTier {
  2049    // Required number of governance tokens ($VEGA) a referrer must have staked to
  2050    // receive the multiplier.
  2051    string minimum_staked_tokens = 1;
  2052    // Multiplier applied to the referral reward factor when calculating referral
  2053    // rewards due to the referrer.
  2054    string referral_reward_multiplier = 2;
  2055  }
  2056  
  2057  message VolumeDiscountProgram {
  2058    // Incremental version of the program. It is incremented after each program
  2059    // update.
  2060    uint64 version = 1;
  2061    // Unique ID generated from the proposal that created this program.
  2062    string id = 2;
  2063    // Defined benefit tiers ordered by increasing discounts.
  2064    repeated VolumeBenefitTier benefit_tiers = 3;
  2065    // Timestamp in Unix seconds, after which when the current epoch
  2066    // ends, the program will end and benefits will be disabled.
  2067    int64 end_of_program_timestamp = 4;
  2068    // Number of epochs over which a referral set's running volume is evaluated.
  2069    uint64 window_length = 5;
  2070  }
  2071  
  2072  // A list of activity streak benefit tiers
  2073  message ActivityStreakBenefitTiers {
  2074    // Defined benefit tiers ordered by increasing reward multipliers.
  2075    repeated ActivityStreakBenefitTier tiers = 1;
  2076  }
  2077  
  2078  // An activity streak benefit tier
  2079  message ActivityStreakBenefitTier {
  2080    // Number of epochs a party must be active to receive the multiplier.
  2081    uint64 minimum_activity_streak = 1;
  2082    // Reward multiplier applicable to this tier.
  2083    string reward_multiplier = 2;
  2084    // Vesting bonus applicable to this tier.
  2085    string vesting_multiplier = 3;
  2086  }
  2087  
  2088  enum MarginMode {
  2089    // Never valid.
  2090    MARGIN_MODE_UNSPECIFIED = 0;
  2091    // Cross margin mode - margin is dynamically acquired and released as a position is marked to market
  2092    MARGIN_MODE_CROSS_MARGIN = 1;
  2093    // Isolated margin mode - margin for any newly opened position volume is transferred to the margin account when the trade is executed
  2094    MARGIN_MODE_ISOLATED_MARGIN = 2;
  2095  }
  2096  
  2097  message LongBlockAuction {
  2098    // Threshold for a long block.
  2099    string threshold = 1;
  2100    // Auction duration for the given threshold.
  2101    string duration = 2;
  2102  }
  2103  
  2104  message LongBlockAuctionDurationTable {
  2105    // Slice of thresholds and durations for corresponding auctions.
  2106    repeated LongBlockAuction threshold_and_duration = 1;
  2107  }
  2108  
  2109  message VolumeRebateBenefitTier {
  2110    // Fraction of a party's maker volume required for a party to access this tier.
  2111    string minimum_party_maker_volume_fraction = 1;
  2112    // Additional rebate factor, based on the 'trade value for fee purposes', that a party at this tier will receive when they are the maker side of a trade.
  2113    string additional_maker_rebate = 2;
  2114    // The tier number. It's set by the core, and used in the party fee stats API.
  2115    optional uint64 tier_number = 3;
  2116  }
  2117  
  2118  message VolumeRebateProgram {
  2119    // Incremental version of the program. It is incremented after each program
  2120    // update.
  2121    uint64 version = 1;
  2122    // Unique ID generated from the proposal that created this program.
  2123    string id = 2;
  2124    // Defined benefit tiers ordered by increasing rebates.
  2125    repeated VolumeRebateBenefitTier benefit_tiers = 3;
  2126    // Timestamp in Unix seconds, after which when the current epoch
  2127    // ends, the program will end and benefits will be disabled.
  2128    int64 end_of_program_timestamp = 4;
  2129    // Number of epochs over which a referral set's running volume is evaluated.
  2130    uint64 window_length = 5;
  2131  }