github.com/InjectiveLabs/sdk-go@v1.53.0/exchange/derivative_exchange_rpc/pb/injective_derivative_exchange_rpc.proto (about) 1 // Code generated with goa v3.7.0, DO NOT EDIT. 2 // 3 // InjectiveDerivativeExchangeRPC protocol buffer definition 4 // 5 // Command: 6 // $ goa gen github.com/InjectiveLabs/injective-indexer/api/design -o ../ 7 8 syntax = "proto3"; 9 10 package injective_derivative_exchange_rpc; 11 12 option go_package = "/injective_derivative_exchange_rpcpb"; 13 14 // InjectiveDerivativeExchangeRPC defines gRPC API of Derivative Markets 15 // provider. 16 service InjectiveDerivativeExchangeRPC { 17 // Markets gets a list of Derivative Markets 18 rpc Markets (MarketsRequest) returns (MarketsResponse); 19 // Market gets details of a single derivative market 20 rpc Market (MarketRequest) returns (MarketResponse); 21 // StreamMarket streams live updates of selected derivative markets 22 rpc StreamMarket (StreamMarketRequest) returns (stream StreamMarketResponse); 23 // BinaryOptionsMarkets gets a list of Binary Options Markets 24 rpc BinaryOptionsMarkets (BinaryOptionsMarketsRequest) returns (BinaryOptionsMarketsResponse); 25 // BinaryOptionMarket gets details of a single binary options market 26 rpc BinaryOptionsMarket (BinaryOptionsMarketRequest) returns (BinaryOptionsMarketResponse); 27 // Orderbook gets the Orderbook of a Derivative Market 28 rpc OrderbookV2 (OrderbookV2Request) returns (OrderbookV2Response); 29 // Orderbooks gets the Orderbooks of requested derivative markets 30 rpc OrderbooksV2 (OrderbooksV2Request) returns (OrderbooksV2Response); 31 // Stream live snapshot updates of selected derivative market orderbook 32 rpc StreamOrderbookV2 (StreamOrderbookV2Request) returns (stream StreamOrderbookV2Response); 33 // Stream live level updates of selected derivative market orderbook 34 rpc StreamOrderbookUpdate (StreamOrderbookUpdateRequest) returns (stream StreamOrderbookUpdateResponse); 35 // DerivativeLimitOrders gets the limit orders of a derivative Market. 36 rpc Orders (OrdersRequest) returns (OrdersResponse); 37 // Positions gets the positions for a trader. 38 rpc Positions (PositionsRequest) returns (PositionsResponse); 39 // Positions gets the positions for a trader. V2 removed some redundant fields 40 // and had performance improvements 41 rpc PositionsV2 (PositionsV2Request) returns (PositionsV2Response); 42 // LiquidablePositions gets all the liquidable positions. 43 rpc LiquidablePositions (LiquidablePositionsRequest) returns (LiquidablePositionsResponse); 44 // FundingPayments gets the funding payments for a trader. 45 rpc FundingPayments (FundingPaymentsRequest) returns (FundingPaymentsResponse); 46 // FundingRates gets the historical funding rates for a market. 47 rpc FundingRates (FundingRatesRequest) returns (FundingRatesResponse); 48 // StreamPositions streams derivatives position updates. 49 rpc StreamPositions (StreamPositionsRequest) returns (stream StreamPositionsResponse); 50 // StreamOrders streams updates to individual orders of a Derivative Market. 51 rpc StreamOrders (StreamOrdersRequest) returns (stream StreamOrdersResponse); 52 // Trades gets the trades of a Derivative Market. 53 rpc Trades (TradesRequest) returns (TradesResponse); 54 // Trades gets the trades of a Derivative Market. 55 rpc TradesV2 (TradesV2Request) returns (TradesV2Response); 56 // StreamTrades streams newly executed trades from Derivative Market. 57 rpc StreamTrades (StreamTradesRequest) returns (stream StreamTradesResponse); 58 // StreamTrades streams newly executed trades from Derivative Market. 59 rpc StreamTradesV2 (StreamTradesV2Request) returns (stream StreamTradesV2Response); 60 // SubaccountOrdersList lists orders posted from this subaccount. 61 rpc SubaccountOrdersList (SubaccountOrdersListRequest) returns (SubaccountOrdersListResponse); 62 // SubaccountTradesList gets a list of derivatives trades executed by this 63 // subaccount. 64 rpc SubaccountTradesList (SubaccountTradesListRequest) returns (SubaccountTradesListResponse); 65 // Lists history orders posted from a subaccount 66 rpc OrdersHistory (OrdersHistoryRequest) returns (OrdersHistoryResponse); 67 // Stream updates to historical orders of a derivative Market 68 rpc StreamOrdersHistory (StreamOrdersHistoryRequest) returns (stream StreamOrdersHistoryResponse); 69 } 70 71 message MarketsRequest { 72 // Filter by market status 73 string market_status = 1; 74 // Filter by the Coin denomination of the quote currency 75 string quote_denom = 2; 76 repeated string market_statuses = 3; 77 } 78 79 message MarketsResponse { 80 // Derivative Markets list 81 repeated DerivativeMarketInfo markets = 1; 82 } 83 84 message DerivativeMarketInfo { 85 // DerivativeMarket ID is crypto.Keccak256Hash([]byte((oracleType.String() + 86 // ticker + quoteDenom + oracleBase + oracleQuote))) for perpetual markets and 87 // crypto.Keccak256Hash([]byte((oracleType.String() + ticker + quoteDenom + 88 // oracleBase + oracleQuote + strconv.Itoa(int(expiry))))) for expiry futures 89 // markets 90 string market_id = 1; 91 // The status of the market 92 string market_status = 2; 93 // A name of the pair in format AAA/BBB, where AAA is base asset, BBB is quote 94 // asset. 95 string ticker = 3; 96 // Oracle base currency 97 string oracle_base = 4; 98 // Oracle quote currency 99 string oracle_quote = 5; 100 // Oracle Type 101 string oracle_type = 6; 102 // OracleScaleFactor 103 uint32 oracle_scale_factor = 7; 104 // Defines the initial margin ratio of a derivative market 105 string initial_margin_ratio = 8; 106 // Defines the maintenance margin ratio of a derivative market 107 string maintenance_margin_ratio = 9; 108 // Coin denom used for the quote asset. 109 string quote_denom = 10; 110 // Token metadata for quote asset, only for Ethereum-based assets 111 TokenMeta quote_token_meta = 11; 112 // Defines the fee percentage makers pay when trading (in quote asset) 113 string maker_fee_rate = 12; 114 // Defines the fee percentage takers pay when trading (in quote asset) 115 string taker_fee_rate = 13; 116 // Percentage of the transaction fee shared with the service provider 117 string service_provider_fee = 14; 118 // True if the market is a perpetual swap market 119 bool is_perpetual = 15; 120 // Defines the minimum required tick size for the order's price 121 string min_price_tick_size = 16; 122 // Defines the minimum required tick size for the order's quantity 123 string min_quantity_tick_size = 17; 124 PerpetualMarketInfo perpetual_market_info = 18; 125 PerpetualMarketFunding perpetual_market_funding = 19; 126 ExpiryFuturesMarketInfo expiry_futures_market_info = 20; 127 // Minimum notional value for the order 128 string min_notional = 21; 129 } 130 131 message TokenMeta { 132 // Token full name 133 string name = 1; 134 // Token Ethereum contract address 135 string address = 2; 136 // Token symbol short name 137 string symbol = 3; 138 // URL to the logo image 139 string logo = 4; 140 // Token decimals 141 sint32 decimals = 5; 142 // Token metadata fetched timestamp in UNIX millis. 143 sint64 updated_at = 6; 144 } 145 146 message PerpetualMarketInfo { 147 // Defines the default maximum absolute value of the hourly funding rate of the 148 // perpetual market. 149 string hourly_funding_rate_cap = 1; 150 // Defines the hourly interest rate of the perpetual market. 151 string hourly_interest_rate = 2; 152 // Defines the next funding timestamp in seconds of a perpetual market in UNIX 153 // seconds. 154 sint64 next_funding_timestamp = 3; 155 // Defines the funding interval in seconds of a perpetual market in seconds. 156 sint64 funding_interval = 4; 157 } 158 159 message PerpetualMarketFunding { 160 // Defines the cumulative funding of a perpetual market. 161 string cumulative_funding = 1; 162 // Defines defines the cumulative price for the current hour up to the last 163 // timestamp. 164 string cumulative_price = 2; 165 // Defines the last funding timestamp in seconds of a perpetual market in UNIX 166 // seconds. 167 sint64 last_timestamp = 3; 168 } 169 170 message ExpiryFuturesMarketInfo { 171 // Defines the expiration time for a time expiry futures market in UNIX seconds. 172 sint64 expiration_timestamp = 1; 173 // Defines the settlement price for a time expiry futures market. 174 string settlement_price = 2; 175 } 176 177 message MarketRequest { 178 // MarketId of the market we want to fetch 179 string market_id = 1; 180 } 181 182 message MarketResponse { 183 // Info about particular derivative market 184 DerivativeMarketInfo market = 1; 185 } 186 187 message StreamMarketRequest { 188 // List of market IDs for updates streaming, empty means 'ALL' derivative 189 // markets 190 repeated string market_ids = 1; 191 } 192 193 message StreamMarketResponse { 194 // Info about particular derivative market 195 DerivativeMarketInfo market = 1; 196 // Update type 197 string operation_type = 2; 198 // Operation timestamp in UNIX millis. 199 sint64 timestamp = 3; 200 } 201 202 message BinaryOptionsMarketsRequest { 203 // Filter by market status 204 string market_status = 1; 205 // Filter by the Coin denomination of the quote currency 206 string quote_denom = 2; 207 // Skip will skip the first n item from the result 208 uint64 skip = 3; 209 // Limit is used to specify the maximum number of items to be returned. 210 sint32 limit = 4; 211 } 212 213 message BinaryOptionsMarketsResponse { 214 // Binary Options Markets list 215 repeated BinaryOptionsMarketInfo markets = 1; 216 Paging paging = 2; 217 } 218 219 message BinaryOptionsMarketInfo { 220 // Binary Options Market ID is crypto.Keccak256Hash([]byte((oracleType.String() 221 // + ticker + quoteDenom + oracleSymbol + oracleProvider))) 222 string market_id = 1; 223 // The status of the market 224 string market_status = 2; 225 // A name of the binary options market. 226 string ticker = 3; 227 // Oracle symbol 228 string oracle_symbol = 4; 229 // Oracle provider 230 string oracle_provider = 5; 231 // Oracle Type 232 string oracle_type = 6; 233 // OracleScaleFactor 234 uint32 oracle_scale_factor = 7; 235 // Defines the expiration time for the market in UNIX seconds. 236 sint64 expiration_timestamp = 8; 237 // Defines the settlement time for the market in UNIX seconds. 238 sint64 settlement_timestamp = 9; 239 // Coin denom used for the quote asset. 240 string quote_denom = 10; 241 // Token metadata for quote asset, only for Ethereum-based assets 242 TokenMeta quote_token_meta = 11; 243 // Defines the fee percentage makers pay when trading (in quote asset) 244 string maker_fee_rate = 12; 245 // Defines the fee percentage takers pay when trading (in quote asset) 246 string taker_fee_rate = 13; 247 // Percentage of the transaction fee shared with the service provider 248 string service_provider_fee = 14; 249 // Defines the minimum required tick size for the order's price 250 string min_price_tick_size = 15; 251 // Defines the minimum required tick size for the order's quantity 252 string min_quantity_tick_size = 16; 253 // Defines the settlement price of the market 254 string settlement_price = 17; 255 // Defines the minimum notional value for the market 256 string min_notional = 18; 257 } 258 // Paging defines the structure for required params for handling pagination 259 message Paging { 260 // total number of txs saved in database 261 sint64 total = 1; 262 // can be either block height or index num 263 sint32 from = 2; 264 // can be either block height or index num 265 sint32 to = 3; 266 // count entries by subaccount, serving some places on helix 267 sint64 count_by_subaccount = 4; 268 // array of tokens to navigate to the next pages 269 repeated string next = 5; 270 } 271 272 message BinaryOptionsMarketRequest { 273 // MarketId of the market we want to fetch 274 string market_id = 1; 275 } 276 277 message BinaryOptionsMarketResponse { 278 // Info about particular derivative market 279 BinaryOptionsMarketInfo market = 1; 280 } 281 282 message OrderbookV2Request { 283 // MarketId of the market's orderbook we want to fetch 284 string market_id = 1; 285 } 286 287 message OrderbookV2Response { 288 // Orderbook of a particular derivative market 289 DerivativeLimitOrderbookV2 orderbook = 1; 290 } 291 292 message DerivativeLimitOrderbookV2 { 293 // Array of price levels for buys 294 repeated PriceLevel buys = 1; 295 // Array of price levels for sells 296 repeated PriceLevel sells = 2; 297 // market orderbook sequence 298 uint64 sequence = 3; 299 // Last update timestamp in UNIX millis. 300 sint64 timestamp = 4; 301 } 302 303 message PriceLevel { 304 // Price number of the price level. 305 string price = 1; 306 // Quantity of the price level. 307 string quantity = 2; 308 // Price level last updated timestamp in UNIX millis. 309 sint64 timestamp = 3; 310 } 311 312 message OrderbooksV2Request { 313 // MarketIds of the markets 314 repeated string market_ids = 1; 315 } 316 317 message OrderbooksV2Response { 318 repeated SingleDerivativeLimitOrderbookV2 orderbooks = 1; 319 } 320 321 message SingleDerivativeLimitOrderbookV2 { 322 // market's ID 323 string market_id = 1; 324 // Orderbook of the market 325 DerivativeLimitOrderbookV2 orderbook = 2; 326 } 327 328 message StreamOrderbookV2Request { 329 // List of market IDs for orderbook streaming, empty means 'ALL' derivative 330 // markets 331 repeated string market_ids = 1; 332 } 333 334 message StreamOrderbookV2Response { 335 // Orderbook of a Derivative Market 336 DerivativeLimitOrderbookV2 orderbook = 1; 337 // Order update type 338 string operation_type = 2; 339 // Operation timestamp in UNIX millis. 340 sint64 timestamp = 3; 341 // MarketId of the market's orderbook 342 string market_id = 4; 343 } 344 345 message StreamOrderbookUpdateRequest { 346 // List of market IDs for orderbook streaming, empty means 'ALL' derivative 347 // markets 348 repeated string market_ids = 1; 349 } 350 351 message StreamOrderbookUpdateResponse { 352 // Orderbook level updates of a Derivative Market 353 OrderbookLevelUpdates orderbook_level_updates = 1; 354 // Order update type 355 string operation_type = 2; 356 // Operation timestamp in UNIX millis. 357 sint64 timestamp = 3; 358 // MarketId of the market's orderbook 359 string market_id = 4; 360 } 361 362 message OrderbookLevelUpdates { 363 // market's ID 364 string market_id = 1; 365 // orderbook update sequence 366 uint64 sequence = 2; 367 // buy levels 368 repeated PriceLevelUpdate buys = 3; 369 // sell levels 370 repeated PriceLevelUpdate sells = 4; 371 // updates timestamp 372 sint64 updated_at = 5; 373 } 374 375 message PriceLevelUpdate { 376 // Price number of the price level. 377 string price = 1; 378 // Quantity of the price level. 379 string quantity = 2; 380 // Price level status. 381 bool is_active = 3; 382 // Price level last updated timestamp in UNIX millis. 383 sint64 timestamp = 4; 384 } 385 386 message OrdersRequest { 387 // MarketId of market we want to fetch orders from. Using this field for one 388 // single marketId 389 string market_id = 1; 390 // Look for specific order side 391 string order_side = 2; 392 // Look for specific subaccountId of an order 393 string subaccount_id = 3; 394 // Skip will skip the first n item from the result 395 uint64 skip = 4; 396 // Limit is used to specify the maximum number of items to be returned 397 sint32 limit = 5; 398 // The starting timestamp in UNIX milliseconds that the trades must be equal or 399 // older than 400 sint64 start_time = 6; 401 // The ending timestamp in UNIX milliseconds that the trades must be equal or 402 // younger than 403 sint64 end_time = 7; 404 // MarketIds of the markets of which we want to get order from, use this field 405 // for fetching orders from multiple markets 406 repeated string market_ids = 8; 407 // Only search for conditional/non-conditional orders 408 string is_conditional = 9; 409 // Search for specific order type 410 string order_type = 10; 411 // Should include inactive orders 412 bool include_inactive = 11; 413 // Choose to return subaccount total orders 414 bool subaccount_total_orders = 12; 415 // TradeId of the order we want to fetch 416 string trade_id = 13; 417 // Client order ID 418 string cid = 14; 419 } 420 421 message OrdersResponse { 422 repeated DerivativeLimitOrder orders = 1; 423 Paging paging = 2; 424 } 425 426 message DerivativeLimitOrder { 427 // Hash of the order 428 string order_hash = 1; 429 // The side of the order 430 string order_side = 2; 431 // Derivative Market ID 432 string market_id = 3; 433 // The subaccountId that this order belongs to 434 string subaccount_id = 4; 435 // True if the order is a reduce-only order 436 bool is_reduce_only = 5; 437 // Margin of the order 438 string margin = 6; 439 // Price of the order 440 string price = 7; 441 // Quantity of the order 442 string quantity = 8; 443 // The amount of the quantity remaining unfilled 444 string unfilled_quantity = 9; 445 // Trigger price is the trigger price used by stop/take orders 446 string trigger_price = 10; 447 // Fee recipient address 448 string fee_recipient = 11; 449 // Order state 450 string state = 12; 451 // Order committed timestamp in UNIX millis. 452 sint64 created_at = 13; 453 // Order updated timestamp in UNIX millis. 454 sint64 updated_at = 14; 455 // Order number of subaccount 456 sint64 order_number = 15; 457 // Order type 458 string order_type = 16; 459 // Order type 460 bool is_conditional = 17; 461 // Trigger timestamp, only exists for conditional orders 462 uint64 trigger_at = 18; 463 // OrderHash of order that is triggered by this conditional order 464 string placed_order_hash = 19; 465 // Execution type of conditional order 466 string execution_type = 20; 467 // Transaction Hash where order is created. Not all orders have this field 468 string tx_hash = 21; 469 // Custom client order ID 470 string cid = 22; 471 } 472 473 message PositionsRequest { 474 // SubaccountId of the trader we want to get the positions from 475 string subaccount_id = 1; 476 // MarketId of the position we want to fetch. Use this field for fetching from 477 // single market 478 string market_id = 2; 479 // Skip will skip the first n item from the result 480 uint64 skip = 3; 481 // Limit is used to specify the maximum number of items to be returned 482 sint32 limit = 4; 483 // The starting timestamp in UNIX milliseconds that the trades must be equal or 484 // older than 485 sint64 start_time = 5; 486 // The ending timestamp in UNIX milliseconds that the trades must be equal or 487 // younger than 488 sint64 end_time = 6; 489 // MarketIds of the markets we want to filter. Use this field for fetching from 490 // multiple markets 491 repeated string market_ids = 7; 492 // filter by direction of the position 493 string direction = 8; 494 // set to True to return subaccount total positions 495 bool subaccount_total_positions = 9; 496 // filter by account address 497 string account_address = 10; 498 } 499 500 message PositionsResponse { 501 repeated DerivativePosition positions = 1; 502 Paging paging = 2; 503 } 504 505 message DerivativePosition { 506 // Ticker of the derivative market 507 string ticker = 1; 508 // Derivative Market ID 509 string market_id = 2; 510 // The subaccountId that the position belongs to 511 string subaccount_id = 3; 512 // Direction of the position 513 string direction = 4; 514 // Quantity of the position 515 string quantity = 5; 516 // Price of the position 517 string entry_price = 6; 518 // Margin of the position 519 string margin = 7; 520 // LiquidationPrice of the position 521 string liquidation_price = 8; 522 // MarkPrice of the position 523 string mark_price = 9; 524 // Aggregate Quantity of the Reduce Only orders associated with the position 525 string aggregate_reduce_only_quantity = 11; 526 // Position updated timestamp in UNIX millis. 527 sint64 updated_at = 12; 528 // Position created timestamp in UNIX millis. 529 sint64 created_at = 13; 530 } 531 532 message PositionsV2Request { 533 // SubaccountId of the trader we want to get the positions from 534 string subaccount_id = 1; 535 // MarketId of the position we want to fetch. Use this field for fetching from 536 // single market 537 string market_id = 2; 538 // Skip will skip the first n item from the result 539 uint64 skip = 3; 540 // Limit is used to specify the maximum number of items to be returned 541 sint32 limit = 4; 542 // The starting timestamp in UNIX milliseconds that the trades must be equal or 543 // older than 544 sint64 start_time = 5; 545 // The ending timestamp in UNIX milliseconds that the trades must be equal or 546 // younger than 547 sint64 end_time = 6; 548 // MarketIds of the markets we want to filter. Use this field for fetching from 549 // multiple markets 550 repeated string market_ids = 7; 551 // filter by direction of the position 552 string direction = 8; 553 // set to True to return subaccount total positions 554 bool subaccount_total_positions = 9; 555 // filter by account address 556 string account_address = 10; 557 } 558 559 message PositionsV2Response { 560 repeated DerivativePositionV2 positions = 1; 561 Paging paging = 2; 562 } 563 564 message DerivativePositionV2 { 565 // Ticker of the derivative market 566 string ticker = 1; 567 // Derivative Market ID 568 string market_id = 2; 569 // The subaccountId that the position belongs to 570 string subaccount_id = 3; 571 // Direction of the position 572 string direction = 4; 573 // Quantity of the position 574 string quantity = 5; 575 // Price of the position 576 string entry_price = 6; 577 // Margin of the position 578 string margin = 7; 579 // LiquidationPrice of the position 580 string liquidation_price = 8; 581 // MarkPrice of the position 582 string mark_price = 9; 583 // Position updated timestamp in UNIX millis. 584 sint64 updated_at = 11; 585 // Market quote denom 586 string denom = 12; 587 } 588 589 message LiquidablePositionsRequest { 590 // Market ID to filter orders for specific market 591 string market_id = 1; 592 // Skip will skip the first n item from the result 593 uint64 skip = 2; 594 // Limit is used to specify the maximum number of items to be returned. 595 sint32 limit = 3; 596 } 597 598 message LiquidablePositionsResponse { 599 // List of derivative positions 600 repeated DerivativePosition positions = 1; 601 } 602 603 message FundingPaymentsRequest { 604 // SubaccountId of the trader we want to get the positions from 605 string subaccount_id = 1; 606 // MarketIds of the funding payment we want to fetch. Using this for only one 607 // market id. This field is prioritized 608 string market_id = 2; 609 // Skip will skip the first n item from the result 610 uint64 skip = 3; 611 // Limit is used to specify the maximum number of items to be returned. 612 sint32 limit = 4; 613 // Upper bound of funding payment updatedAt 614 sint64 end_time = 5; 615 // Filter by market ids. Using this field for fetching funding payments from 616 // multiple market ids 617 repeated string market_ids = 6; 618 } 619 620 message FundingPaymentsResponse { 621 // List of funding payments 622 repeated FundingPayment payments = 1; 623 Paging paging = 2; 624 } 625 626 message FundingPayment { 627 // Derivative Market ID 628 string market_id = 1; 629 // The subaccountId that the position belongs to 630 string subaccount_id = 2; 631 // Amount of the funding payment 632 string amount = 3; 633 // Timestamp of funding payment in UNIX millis 634 sint64 timestamp = 4; 635 } 636 637 message FundingRatesRequest { 638 // MarketId of the position we want to fetch 639 string market_id = 1; 640 // Skip will skip the first n item from the result 641 uint64 skip = 2; 642 // Limit is used to specify the maximum number of items to be returned. 643 sint32 limit = 3; 644 // Upper bound of funding timestamp 645 sint64 end_time = 4; 646 } 647 648 message FundingRatesResponse { 649 // List of funding rates 650 repeated FundingRate funding_rates = 1; 651 Paging paging = 2; 652 } 653 654 message FundingRate { 655 // Derivative Market ID 656 string market_id = 1; 657 // Value of the funding rate 658 string rate = 2; 659 // Timestamp of funding rate in UNIX millis 660 sint64 timestamp = 3; 661 } 662 663 message StreamPositionsRequest { 664 // SubaccountId of the trader we want to get the positions from 665 string subaccount_id = 1; 666 // Backward compat single market ID of position we want to stream 667 string market_id = 2; 668 // List of market IDs of the positions we want to stream 669 repeated string market_ids = 3; 670 // Subaccount ids of traders we want to get positions 671 repeated string subaccount_ids = 4; 672 // filter by account address 673 string account_address = 5; 674 } 675 676 message StreamPositionsResponse { 677 // Updated derivative Position 678 DerivativePosition position = 1; 679 // Operation timestamp in UNIX millis. 680 sint64 timestamp = 2; 681 } 682 683 message StreamOrdersRequest { 684 // MarketId of market we want to fetch orders from. Using this field for one 685 // single marketId 686 string market_id = 1; 687 // Look for specific order side 688 string order_side = 2; 689 // Look for specific subaccountId of an order 690 string subaccount_id = 3; 691 // Skip will skip the first n item from the result 692 uint64 skip = 4; 693 // Limit is used to specify the maximum number of items to be returned 694 sint32 limit = 5; 695 // The starting timestamp in UNIX milliseconds that the trades must be equal or 696 // older than 697 sint64 start_time = 6; 698 // The ending timestamp in UNIX milliseconds that the trades must be equal or 699 // younger than 700 sint64 end_time = 7; 701 // MarketIds of the markets of which we want to get order from, use this field 702 // for fetching orders from multiple markets 703 repeated string market_ids = 8; 704 // Only search for conditional/non-conditional orders 705 string is_conditional = 9; 706 // Search for specific order type 707 string order_type = 10; 708 // Should include inactive orders 709 bool include_inactive = 11; 710 // Choose to return subaccount total orders 711 bool subaccount_total_orders = 12; 712 // TradeId of the order we want to fetch 713 string trade_id = 13; 714 // Client order ID 715 string cid = 14; 716 } 717 718 message StreamOrdersResponse { 719 // Updated market order 720 DerivativeLimitOrder order = 1; 721 // Order update type 722 string operation_type = 2; 723 // Operation timestamp in UNIX millis. 724 sint64 timestamp = 3; 725 } 726 727 message TradesRequest { 728 // MarketId of the market's orderbook we want to fetch 729 string market_id = 1; 730 // Filter by execution side of the trade 731 string execution_side = 2; 732 // Filter by direction the trade 733 string direction = 3; 734 // SubaccountId of the trader we want to get the trades from 735 string subaccount_id = 4; 736 // Skip will skip the first n item from the result 737 uint64 skip = 5; 738 // Limit is used to specify the maximum number of items to be returned. 739 sint32 limit = 6; 740 // The starting timestamp in UNIX milliseconds that the trades must be equal or 741 // older than 742 sint64 start_time = 7; 743 // The ending timestamp in UNIX milliseconds that the trades must be equal or 744 // younger than 745 sint64 end_time = 8; 746 // MarketIds of the markets of which we want to get trades 747 repeated string market_ids = 9; 748 // Subaccount ids of traders we want to get trades. Use this field for fetching 749 // trades from multiple subaccounts 750 repeated string subaccount_ids = 10; 751 repeated string execution_types = 11; 752 // Filter by the tradeId of the trade 753 string trade_id = 12; 754 // Account address 755 string account_address = 13; 756 // Client order ID 757 string cid = 14; 758 } 759 760 message TradesResponse { 761 // Trades of a Derivative Market 762 repeated DerivativeTrade trades = 1; 763 Paging paging = 2; 764 } 765 766 message DerivativeTrade { 767 // Order hash. 768 string order_hash = 1; 769 // The subaccountId that executed the trade 770 string subaccount_id = 2; 771 // The ID of the market that this trade is in 772 string market_id = 3; 773 // The execution type of the trade 774 string trade_execution_type = 4; 775 // True if the trade is a liquidation 776 bool is_liquidation = 5; 777 // Position Delta from the trade 778 PositionDelta position_delta = 6; 779 // The payout associated with the trade 780 string payout = 7; 781 // The fee associated with the trade 782 string fee = 8; 783 // Timestamp of trade execution in UNIX millis 784 sint64 executed_at = 9; 785 // Fee recipient address 786 string fee_recipient = 10; 787 // A unique string that helps differentiate between trades 788 string trade_id = 11; 789 // Trade's execution side, marker/taker 790 string execution_side = 12; 791 // Custom client order ID 792 string cid = 13; 793 } 794 795 message PositionDelta { 796 // The direction the trade 797 string trade_direction = 1; 798 // Execution Price of the trade. 799 string execution_price = 2; 800 // Execution Quantity of the trade. 801 string execution_quantity = 3; 802 // Execution Margin of the trade. 803 string execution_margin = 4; 804 } 805 806 message TradesV2Request { 807 // MarketId of the market's orderbook we want to fetch 808 string market_id = 1; 809 // Filter by execution side of the trade 810 string execution_side = 2; 811 // Filter by direction the trade 812 string direction = 3; 813 // SubaccountId of the trader we want to get the trades from 814 string subaccount_id = 4; 815 // Skip will skip the first n item from the result 816 uint64 skip = 5; 817 // Limit is used to specify the maximum number of items to be returned. 818 sint32 limit = 6; 819 // The starting timestamp in UNIX milliseconds that the trades must be equal or 820 // older than 821 sint64 start_time = 7; 822 // The ending timestamp in UNIX milliseconds that the trades must be equal or 823 // younger than 824 sint64 end_time = 8; 825 // MarketIds of the markets of which we want to get trades 826 repeated string market_ids = 9; 827 // Subaccount ids of traders we want to get trades. Use this field for fetching 828 // trades from multiple subaccounts 829 repeated string subaccount_ids = 10; 830 repeated string execution_types = 11; 831 // Filter by the tradeId of the trade 832 string trade_id = 12; 833 // Account address 834 string account_address = 13; 835 // Client order ID 836 string cid = 14; 837 } 838 839 message TradesV2Response { 840 // Trades of a Derivative Market 841 repeated DerivativeTrade trades = 1; 842 Paging paging = 2; 843 } 844 845 message StreamTradesRequest { 846 // MarketId of the market's orderbook we want to fetch 847 string market_id = 1; 848 // Filter by execution side of the trade 849 string execution_side = 2; 850 // Filter by direction the trade 851 string direction = 3; 852 // SubaccountId of the trader we want to get the trades from 853 string subaccount_id = 4; 854 // Skip will skip the first n item from the result 855 uint64 skip = 5; 856 // Limit is used to specify the maximum number of items to be returned. 857 sint32 limit = 6; 858 // The starting timestamp in UNIX milliseconds that the trades must be equal or 859 // older than 860 sint64 start_time = 7; 861 // The ending timestamp in UNIX milliseconds that the trades must be equal or 862 // younger than 863 sint64 end_time = 8; 864 // MarketIds of the markets of which we want to get trades 865 repeated string market_ids = 9; 866 // Subaccount ids of traders we want to get trades. Use this field for fetching 867 // trades from multiple subaccounts 868 repeated string subaccount_ids = 10; 869 repeated string execution_types = 11; 870 // Filter by the tradeId of the trade 871 string trade_id = 12; 872 // Account address 873 string account_address = 13; 874 // Client order ID 875 string cid = 14; 876 } 877 878 message StreamTradesResponse { 879 // New derivative market trade 880 DerivativeTrade trade = 1; 881 // Executed trades update type 882 string operation_type = 2; 883 // Operation timestamp in UNIX millis. 884 sint64 timestamp = 3; 885 } 886 887 message StreamTradesV2Request { 888 // MarketId of the market's orderbook we want to fetch 889 string market_id = 1; 890 // Filter by execution side of the trade 891 string execution_side = 2; 892 // Filter by direction the trade 893 string direction = 3; 894 // SubaccountId of the trader we want to get the trades from 895 string subaccount_id = 4; 896 // Skip will skip the first n item from the result 897 uint64 skip = 5; 898 // Limit is used to specify the maximum number of items to be returned. 899 sint32 limit = 6; 900 // The starting timestamp in UNIX milliseconds that the trades must be equal or 901 // older than 902 sint64 start_time = 7; 903 // The ending timestamp in UNIX milliseconds that the trades must be equal or 904 // younger than 905 sint64 end_time = 8; 906 // MarketIds of the markets of which we want to get trades 907 repeated string market_ids = 9; 908 // Subaccount ids of traders we want to get trades. Use this field for fetching 909 // trades from multiple subaccounts 910 repeated string subaccount_ids = 10; 911 repeated string execution_types = 11; 912 // Filter by the tradeId of the trade 913 string trade_id = 12; 914 // Account address 915 string account_address = 13; 916 // Client order ID 917 string cid = 14; 918 } 919 920 message StreamTradesV2Response { 921 // New derivative market trade 922 DerivativeTrade trade = 1; 923 // Executed trades update type 924 string operation_type = 2; 925 // Operation timestamp in UNIX millis. 926 sint64 timestamp = 3; 927 } 928 929 message SubaccountOrdersListRequest { 930 // subaccount ID to filter orders for specific subaccount 931 string subaccount_id = 1; 932 // Market ID to filter orders for specific market 933 string market_id = 2; 934 // Skip will skip the first n item from the result 935 uint64 skip = 3; 936 // Limit is used to specify the maximum number of items to be returned 937 sint32 limit = 4; 938 } 939 940 message SubaccountOrdersListResponse { 941 // List of derivative orders 942 repeated DerivativeLimitOrder orders = 1; 943 Paging paging = 2; 944 } 945 946 message SubaccountTradesListRequest { 947 // SubaccountId of the trader we want to get the trades from 948 string subaccount_id = 1; 949 // Filter trades by market ID 950 string market_id = 2; 951 // Filter by execution type of trades 952 string execution_type = 3; 953 // Filter by direction trades 954 string direction = 4; 955 // Skip will skip the first n item from the result 956 uint64 skip = 5; 957 // Limit is used to specify the maximum number of items to be returned 958 sint32 limit = 6; 959 } 960 961 message SubaccountTradesListResponse { 962 // List of derivative market trades 963 repeated DerivativeTrade trades = 1; 964 } 965 966 message OrdersHistoryRequest { 967 // subaccount ID to filter orders for specific subaccount 968 string subaccount_id = 1; 969 // Market ID to filter orders for specific market 970 string market_id = 2; 971 // Skip will skip the first n item from the result 972 uint64 skip = 3; 973 // Limit is used to specify the maximum number of items to be returned 974 sint32 limit = 4; 975 // filter by order types 976 repeated string order_types = 5; 977 // order side filter 978 string direction = 6; 979 // Search for orders which createdAt >= startTime, time in millisecond 980 sint64 start_time = 7; 981 // Search for orders which createdAt <= endTime, time in millisecond 982 sint64 end_time = 8; 983 // Only search for conditional/non-conditional orders 984 string is_conditional = 9; 985 // filter by order type 986 string order_type = 10; 987 // Filter by order state 988 string state = 11; 989 repeated string execution_types = 12; 990 repeated string market_ids = 13; 991 // TradeId of the order we want to fetch 992 string trade_id = 14; 993 // Return only orders for active markets 994 bool active_markets_only = 15; 995 // Client order ID 996 string cid = 16; 997 } 998 999 message OrdersHistoryResponse { 1000 // List of historical derivative orders 1001 repeated DerivativeOrderHistory orders = 1; 1002 Paging paging = 2; 1003 } 1004 1005 message DerivativeOrderHistory { 1006 // Hash of the order 1007 string order_hash = 1; 1008 // Spot Market ID is keccak265(baseDenom + quoteDenom) 1009 string market_id = 2; 1010 // active state of the order 1011 bool is_active = 3; 1012 // The subaccountId that this order belongs to 1013 string subaccount_id = 4; 1014 // The execution type 1015 string execution_type = 5; 1016 // The side of the order 1017 string order_type = 6; 1018 // Price of the order 1019 string price = 7; 1020 // Trigger price 1021 string trigger_price = 8; 1022 // Quantity of the order 1023 string quantity = 9; 1024 // Filled amount 1025 string filled_quantity = 10; 1026 // Order state 1027 string state = 11; 1028 // Order committed timestamp in UNIX millis. 1029 sint64 created_at = 12; 1030 // Order updated timestamp in UNIX millis. 1031 sint64 updated_at = 13; 1032 // True if an order is reduce only 1033 bool is_reduce_only = 14; 1034 // Order direction (order side) 1035 string direction = 15; 1036 // True if this is conditional order, otherwise false 1037 bool is_conditional = 16; 1038 // Trigger timestamp in unix milli 1039 uint64 trigger_at = 17; 1040 // Order hash placed when this triggers 1041 string placed_order_hash = 18; 1042 // Order's margin 1043 string margin = 19; 1044 // Transaction Hash where order is created. Not all orders have this field 1045 string tx_hash = 20; 1046 // Custom client order ID 1047 string cid = 21; 1048 } 1049 1050 message StreamOrdersHistoryRequest { 1051 // subaccount ID to filter orders for specific subaccount 1052 string subaccount_id = 1; 1053 // Market ID to filter orders for specific market 1054 string market_id = 2; 1055 // filter by order types 1056 repeated string order_types = 3; 1057 // order side filter 1058 string direction = 4; 1059 // Filter by order state 1060 string state = 5; 1061 repeated string execution_types = 6; 1062 } 1063 1064 message StreamOrdersHistoryResponse { 1065 // Updated order 1066 DerivativeOrderHistory order = 1; 1067 // Order update type 1068 string operation_type = 2; 1069 // Operation timestamp in UNIX millis. 1070 sint64 timestamp = 3; 1071 }