github.com/InjectiveLabs/sdk-go@v1.53.0/exchange/spot_exchange_rpc/pb/injective_spot_exchange_rpc.proto (about) 1 // Code generated with goa v3.7.0, DO NOT EDIT. 2 // 3 // InjectiveSpotExchangeRPC 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_spot_exchange_rpc; 11 12 option go_package = "/injective_spot_exchange_rpcpb"; 13 14 // InjectiveSpotExchangeRPC defines gRPC API of Spot Exchange provider. 15 service InjectiveSpotExchangeRPC { 16 // Get a list of Spot Markets 17 rpc Markets (MarketsRequest) returns (MarketsResponse); 18 // Get details of a single spot market 19 rpc Market (MarketRequest) returns (MarketResponse); 20 // Stream live updates of selected spot markets 21 rpc StreamMarkets (StreamMarketsRequest) returns (stream StreamMarketsResponse); 22 // Orderbook of a Spot Market 23 rpc OrderbookV2 (OrderbookV2Request) returns (OrderbookV2Response); 24 // Orderbook of Spot Markets 25 rpc OrderbooksV2 (OrderbooksV2Request) returns (OrderbooksV2Response); 26 // Stream live snapshot updates of selected spot market orderbook 27 rpc StreamOrderbookV2 (StreamOrderbookV2Request) returns (stream StreamOrderbookV2Response); 28 // Stream live level updates of selected spot market orderbook 29 rpc StreamOrderbookUpdate (StreamOrderbookUpdateRequest) returns (stream StreamOrderbookUpdateResponse); 30 // Orders of a Spot Market 31 rpc Orders (OrdersRequest) returns (OrdersResponse); 32 // Stream updates to individual orders of a Spot Market 33 rpc StreamOrders (StreamOrdersRequest) returns (stream StreamOrdersResponse); 34 // Trades of a Spot Market 35 rpc Trades (TradesRequest) returns (TradesResponse); 36 // Stream newly executed trades from Spot Market 37 rpc StreamTrades (StreamTradesRequest) returns (stream StreamTradesResponse); 38 // Trades of a Spot Market 39 rpc TradesV2 (TradesV2Request) returns (TradesV2Response); 40 // Stream newly executed trades from Spot Market 41 rpc StreamTradesV2 (StreamTradesV2Request) returns (stream StreamTradesV2Response); 42 // List orders posted from this subaccount 43 rpc SubaccountOrdersList (SubaccountOrdersListRequest) returns (SubaccountOrdersListResponse); 44 // List trades executed by this subaccount 45 rpc SubaccountTradesList (SubaccountTradesListRequest) returns (SubaccountTradesListResponse); 46 // Lists history orders posted from this subaccount 47 rpc OrdersHistory (OrdersHistoryRequest) returns (OrdersHistoryResponse); 48 // Stream updates to historical orders of a spot Market 49 rpc StreamOrdersHistory (StreamOrdersHistoryRequest) returns (stream StreamOrdersHistoryResponse); 50 // Get historical atomic swaps 51 rpc AtomicSwapHistory (AtomicSwapHistoryRequest) returns (AtomicSwapHistoryResponse); 52 } 53 54 message MarketsRequest { 55 // Filter by market status 56 string market_status = 1; 57 // Filter by the Coin denomination of the base currency 58 string base_denom = 2; 59 // Filter by the Coin denomination of the quote currency 60 string quote_denom = 3; 61 repeated string market_statuses = 4; 62 } 63 64 message MarketsResponse { 65 // Spot Markets list 66 repeated SpotMarketInfo markets = 1; 67 } 68 69 message SpotMarketInfo { 70 // SpotMarket ID is keccak265(baseDenom || quoteDenom) 71 string market_id = 1; 72 // The status of the market 73 string market_status = 2; 74 // A name of the pair in format AAA/BBB, where AAA is base asset, BBB is quote 75 // asset. 76 string ticker = 3; 77 // Coin denom used for the base asset. 78 string base_denom = 4; 79 // Token metadata for base asset, only for Ethereum-based assets 80 TokenMeta base_token_meta = 5; 81 // Coin denom used for the quote asset. 82 string quote_denom = 6; 83 // Token metadata for quote asset, only for Ethereum-based assets 84 TokenMeta quote_token_meta = 7; 85 // Defines the fee percentage makers pay when trading (in quote asset) 86 string maker_fee_rate = 8; 87 // Defines the fee percentage takers pay when trading (in quote asset) 88 string taker_fee_rate = 9; 89 // Percentage of the transaction fee shared with the service provider 90 string service_provider_fee = 10; 91 // Defines the minimum required tick size for the order's price 92 string min_price_tick_size = 11; 93 // Defines the minimum required tick size for the order's quantity 94 string min_quantity_tick_size = 12; 95 // Minimum notional value for the market 96 string min_notional = 13; 97 } 98 99 message TokenMeta { 100 // Token full name 101 string name = 1; 102 // Token Ethereum contract address 103 string address = 2; 104 // Token symbol short name 105 string symbol = 3; 106 // URL to the logo image 107 string logo = 4; 108 // Token decimals 109 sint32 decimals = 5; 110 // Token metadata fetched timestamp in UNIX millis. 111 sint64 updated_at = 6; 112 } 113 114 message MarketRequest { 115 // MarketId of the market we want to fetch 116 string market_id = 1; 117 } 118 119 message MarketResponse { 120 // Info about particular spot market 121 SpotMarketInfo market = 1; 122 } 123 124 message StreamMarketsRequest { 125 // List of market IDs for updates streaming, empty means 'ALL' spot markets 126 repeated string market_ids = 1; 127 } 128 129 message StreamMarketsResponse { 130 // Info about particular spot market 131 SpotMarketInfo market = 1; 132 // Update type 133 string operation_type = 2; 134 // Operation timestamp in UNIX millis. 135 sint64 timestamp = 3; 136 } 137 138 message OrderbookV2Request { 139 // MarketId of the market's orderbook we want to fetch 140 string market_id = 1; 141 } 142 143 message OrderbookV2Response { 144 // Orderbook of a particular spot market 145 SpotLimitOrderbookV2 orderbook = 1; 146 } 147 148 message SpotLimitOrderbookV2 { 149 // Array of price levels for buys 150 repeated PriceLevel buys = 1; 151 // Array of price levels for sells 152 repeated PriceLevel sells = 2; 153 // market orderbook sequence 154 uint64 sequence = 3; 155 // Last update timestamp in UNIX millis. 156 sint64 timestamp = 4; 157 } 158 159 message PriceLevel { 160 // Price number of the price level. 161 string price = 1; 162 // Quantity of the price level. 163 string quantity = 2; 164 // Price level last updated timestamp in UNIX millis. 165 sint64 timestamp = 3; 166 } 167 168 message OrderbooksV2Request { 169 // MarketIds of the markets 170 repeated string market_ids = 1; 171 } 172 173 message OrderbooksV2Response { 174 repeated SingleSpotLimitOrderbookV2 orderbooks = 1; 175 } 176 177 message SingleSpotLimitOrderbookV2 { 178 // market's ID 179 string market_id = 1; 180 // Orderbook of the market 181 SpotLimitOrderbookV2 orderbook = 2; 182 } 183 184 message StreamOrderbookV2Request { 185 // List of market IDs for orderbook streaming, empty means 'ALL' spot markets 186 repeated string market_ids = 1; 187 } 188 189 message StreamOrderbookV2Response { 190 // Orderbook of a Spot Market 191 SpotLimitOrderbookV2 orderbook = 1; 192 // Order update type 193 string operation_type = 2; 194 // Operation timestamp in UNIX millis. 195 sint64 timestamp = 3; 196 // MarketId of the market's orderbook 197 string market_id = 4; 198 } 199 200 message StreamOrderbookUpdateRequest { 201 // List of market IDs for orderbook streaming, empty means 'ALL' spot markets 202 repeated string market_ids = 1; 203 } 204 205 message StreamOrderbookUpdateResponse { 206 // Orderbook level updates of a Spot Market 207 OrderbookLevelUpdates orderbook_level_updates = 1; 208 // Order update type 209 string operation_type = 2; 210 // Operation timestamp in UNIX millis. 211 sint64 timestamp = 3; 212 // MarketId of the market's orderbook 213 string market_id = 4; 214 } 215 216 message OrderbookLevelUpdates { 217 // market's ID 218 string market_id = 1; 219 // orderbook update sequence 220 uint64 sequence = 2; 221 // buy levels 222 repeated PriceLevelUpdate buys = 3; 223 // sell levels 224 repeated PriceLevelUpdate sells = 4; 225 // updates timestamp 226 sint64 updated_at = 5; 227 } 228 229 message PriceLevelUpdate { 230 // Price number of the price level. 231 string price = 1; 232 // Quantity of the price level. 233 string quantity = 2; 234 // Price level status. 235 bool is_active = 3; 236 // Price level last updated timestamp in UNIX millis. 237 sint64 timestamp = 4; 238 } 239 240 message OrdersRequest { 241 // MarketId of the market's orderbook we want to fetch 242 string market_id = 1; 243 // Look for specific order side 244 string order_side = 2; 245 // Look for specific subaccountId of an order 246 string subaccount_id = 3; 247 // Skip will skip the first n item from the result 248 uint64 skip = 4; 249 // Limit is used to specify the maximum number of items to be returned. 250 sint32 limit = 5; 251 // The starting timestamp in UNIX milliseconds that the trades must be equal or 252 // older than 253 sint64 start_time = 6; 254 // The ending timestamp in UNIX milliseconds that the trades must be equal or 255 // younger than 256 sint64 end_time = 7; 257 // MarketIds of the markets of which we want to get trades 258 repeated string market_ids = 8; 259 // Should include inactive orders 260 bool include_inactive = 9; 261 // Choose to return subaccount total orders 262 bool subaccount_total_orders = 10; 263 // TradeId of the order we want to fetch 264 string trade_id = 11; 265 // Client order ID 266 string cid = 12; 267 } 268 269 message OrdersResponse { 270 repeated SpotLimitOrder orders = 1; 271 Paging paging = 2; 272 } 273 274 message SpotLimitOrder { 275 // Hash of the order 276 string order_hash = 1; 277 // The side of the order 278 string order_side = 2; 279 // Spot Market ID is keccak265(baseDenom + quoteDenom) 280 string market_id = 3; 281 // The subaccountId that this order belongs to 282 string subaccount_id = 4; 283 // Price of the order 284 string price = 5; 285 // Quantity of the order 286 string quantity = 6; 287 // The amount of the quantity remaining unfilled 288 string unfilled_quantity = 7; 289 // Trigger price is the trigger price used by stop/take orders. 0 if the 290 // trigger price is not set. 291 string trigger_price = 8; 292 // Fee recipient address 293 string fee_recipient = 9; 294 // Order state 295 string state = 10; 296 // Order committed timestamp in UNIX millis. 297 sint64 created_at = 11; 298 // Order updated timestamp in UNIX millis. 299 sint64 updated_at = 12; 300 // Transaction Hash where order is created. Not all orders have this field 301 string tx_hash = 13; 302 // Custom client order ID 303 string cid = 14; 304 } 305 // Paging defines the structure for required params for handling pagination 306 message Paging { 307 // total number of txs saved in database 308 sint64 total = 1; 309 // can be either block height or index num 310 sint32 from = 2; 311 // can be either block height or index num 312 sint32 to = 3; 313 // count entries by subaccount, serving some places on helix 314 sint64 count_by_subaccount = 4; 315 // array of tokens to navigate to the next pages 316 repeated string next = 5; 317 } 318 319 message StreamOrdersRequest { 320 // MarketId of the market's orderbook we want to fetch 321 string market_id = 1; 322 // Look for specific order side 323 string order_side = 2; 324 // Look for specific subaccountId of an order 325 string subaccount_id = 3; 326 // Skip will skip the first n item from the result 327 uint64 skip = 4; 328 // Limit is used to specify the maximum number of items to be returned. 329 sint32 limit = 5; 330 // The starting timestamp in UNIX milliseconds that the trades must be equal or 331 // older than 332 sint64 start_time = 6; 333 // The ending timestamp in UNIX milliseconds that the trades must be equal or 334 // younger than 335 sint64 end_time = 7; 336 // MarketIds of the markets of which we want to get trades 337 repeated string market_ids = 8; 338 // Should include inactive orders 339 bool include_inactive = 9; 340 // Choose to return subaccount total orders 341 bool subaccount_total_orders = 10; 342 // TradeId of the order we want to fetch 343 string trade_id = 11; 344 // Client order ID 345 string cid = 12; 346 } 347 348 message StreamOrdersResponse { 349 // Updated market order 350 SpotLimitOrder order = 1; 351 // Order update type 352 string operation_type = 2; 353 // Operation timestamp in UNIX millis. 354 sint64 timestamp = 3; 355 } 356 357 message TradesRequest { 358 // MarketId of the market's orderbook we want to fetch 359 string market_id = 1; 360 // Filter by execution side of the trade 361 string execution_side = 2; 362 // Filter by direction the trade 363 string direction = 3; 364 // SubaccountId of the trader we want to get the trades from 365 string subaccount_id = 4; 366 // Skip will skip the first n item from the item result 367 uint64 skip = 5; 368 // Limit is used to specify the maximum number of items to be returned. 369 sint32 limit = 6; 370 // The starting timestamp in UNIX milliseconds that the trades must be equal or 371 // older than 372 sint64 start_time = 7; 373 // The ending timestamp in UNIX milliseconds that the trades must be equal or 374 // younger than 375 sint64 end_time = 8; 376 // MarketIds of the markets of which we want to get trades 377 repeated string market_ids = 9; 378 // Subaccount ids of traders we want to get trades 379 repeated string subaccount_ids = 10; 380 repeated string execution_types = 11; 381 // Filter by the tradeId of the trade 382 string trade_id = 12; 383 // Account address 384 string account_address = 13; 385 // Client order ID 386 string cid = 14; 387 } 388 389 message TradesResponse { 390 // Trades of a Spot Market 391 repeated SpotTrade trades = 1; 392 // Paging indicates pages response is on 393 Paging paging = 2; 394 } 395 396 message SpotTrade { 397 // Maker order hash. 398 string order_hash = 1; 399 // The subaccountId that executed the trade 400 string subaccount_id = 2; 401 // The ID of the market that this trade is in 402 string market_id = 3; 403 // The execution type of the trade 404 string trade_execution_type = 4; 405 // The direction the trade 406 string trade_direction = 5; 407 // Price level at which trade has been executed 408 PriceLevel price = 6; 409 // The fee associated with the trade (quote asset denom) 410 string fee = 7; 411 // Timestamp of trade execution in UNIX millis 412 sint64 executed_at = 8; 413 // Fee recipient address 414 string fee_recipient = 9; 415 // A unique string that helps differentiate between trades 416 string trade_id = 10; 417 // Trade's execution side, marker/taker 418 string execution_side = 11; 419 // Custom client order ID 420 string cid = 12; 421 } 422 423 message StreamTradesRequest { 424 // MarketId of the market's orderbook we want to fetch 425 string market_id = 1; 426 // Filter by execution side of the trade 427 string execution_side = 2; 428 // Filter by direction the trade 429 string direction = 3; 430 // SubaccountId of the trader we want to get the trades from 431 string subaccount_id = 4; 432 // Skip will skip the first n item from the item result 433 uint64 skip = 5; 434 // Limit is used to specify the maximum number of items to be returned. 435 sint32 limit = 6; 436 // The starting timestamp in UNIX milliseconds that the trades must be equal or 437 // older than 438 sint64 start_time = 7; 439 // The ending timestamp in UNIX milliseconds that the trades must be equal or 440 // younger than 441 sint64 end_time = 8; 442 // MarketIds of the markets of which we want to get trades 443 repeated string market_ids = 9; 444 // Subaccount ids of traders we want to get trades 445 repeated string subaccount_ids = 10; 446 repeated string execution_types = 11; 447 // Filter by the tradeId of the trade 448 string trade_id = 12; 449 // Account address 450 string account_address = 13; 451 // Client order ID 452 string cid = 14; 453 } 454 455 message StreamTradesResponse { 456 // New spot market trade 457 SpotTrade trade = 1; 458 // Executed trades update type 459 string operation_type = 2; 460 // Operation timestamp in UNIX millis. 461 sint64 timestamp = 3; 462 } 463 464 message TradesV2Request { 465 // MarketId of the market's orderbook we want to fetch 466 string market_id = 1; 467 // Filter by execution side of the trade 468 string execution_side = 2; 469 // Filter by direction the trade 470 string direction = 3; 471 // SubaccountId of the trader we want to get the trades from 472 string subaccount_id = 4; 473 // Skip will skip the first n item from the item result 474 uint64 skip = 5; 475 // Limit is used to specify the maximum number of items to be returned. 476 sint32 limit = 6; 477 // The starting timestamp in UNIX milliseconds that the trades must be equal or 478 // older than 479 sint64 start_time = 7; 480 // The ending timestamp in UNIX milliseconds that the trades must be equal or 481 // younger than 482 sint64 end_time = 8; 483 // MarketIds of the markets of which we want to get trades 484 repeated string market_ids = 9; 485 // Subaccount ids of traders we want to get trades 486 repeated string subaccount_ids = 10; 487 repeated string execution_types = 11; 488 // Filter by the tradeId of the trade 489 string trade_id = 12; 490 // Account address 491 string account_address = 13; 492 // Client order ID 493 string cid = 14; 494 } 495 496 message TradesV2Response { 497 // Trades of a Spot Market 498 repeated SpotTrade trades = 1; 499 // Paging indicates pages response is on 500 Paging paging = 2; 501 } 502 503 message StreamTradesV2Request { 504 // MarketId of the market's orderbook we want to fetch 505 string market_id = 1; 506 // Filter by execution side of the trade 507 string execution_side = 2; 508 // Filter by direction the trade 509 string direction = 3; 510 // SubaccountId of the trader we want to get the trades from 511 string subaccount_id = 4; 512 // Skip will skip the first n item from the item result 513 uint64 skip = 5; 514 // Limit is used to specify the maximum number of items to be returned. 515 sint32 limit = 6; 516 // The starting timestamp in UNIX milliseconds that the trades must be equal or 517 // older than 518 sint64 start_time = 7; 519 // The ending timestamp in UNIX milliseconds that the trades must be equal or 520 // younger than 521 sint64 end_time = 8; 522 // MarketIds of the markets of which we want to get trades 523 repeated string market_ids = 9; 524 // Subaccount ids of traders we want to get trades 525 repeated string subaccount_ids = 10; 526 repeated string execution_types = 11; 527 // Filter by the tradeId of the trade 528 string trade_id = 12; 529 // Account address 530 string account_address = 13; 531 // Client order ID 532 string cid = 14; 533 } 534 535 message StreamTradesV2Response { 536 // New spot market trade 537 SpotTrade trade = 1; 538 // Executed trades update type 539 string operation_type = 2; 540 // Operation timestamp in UNIX millis. 541 sint64 timestamp = 3; 542 } 543 544 message SubaccountOrdersListRequest { 545 // subaccount ID to filter orders for specific subaccount 546 string subaccount_id = 1; 547 // Market ID to filter orders for specific market 548 string market_id = 2; 549 // Skip will skip the first n item from the result 550 uint64 skip = 3; 551 // Limit is used to specify the maximum number of items to be returned 552 sint32 limit = 4; 553 } 554 555 message SubaccountOrdersListResponse { 556 repeated SpotLimitOrder orders = 1; 557 Paging paging = 2; 558 } 559 560 message SubaccountTradesListRequest { 561 // SubaccountId of the trader we want to get the trades from 562 string subaccount_id = 1; 563 // Filter trades by market ID 564 string market_id = 2; 565 // Filter by execution type of trades 566 string execution_type = 3; 567 // Filter by direction trades 568 string direction = 4; 569 // Skip will skip the first n item from the result 570 uint64 skip = 5; 571 // Limit is used to specify the maximum number of items to be returned 572 sint32 limit = 6; 573 } 574 575 message SubaccountTradesListResponse { 576 // List of spot market trades 577 repeated SpotTrade trades = 1; 578 } 579 580 message OrdersHistoryRequest { 581 // subaccount ID to filter orders for specific subaccount 582 string subaccount_id = 1; 583 // Market ID to filter orders for specific market 584 string market_id = 2; 585 // Skip will skip the first n item from the result 586 uint64 skip = 3; 587 // Limit is used to specify the maximum number of items to be returned 588 sint32 limit = 4; 589 // filter by order types 590 repeated string order_types = 5; 591 // order side filter 592 string direction = 6; 593 // Search for orders which createdAt >= startTime, time in millisecond 594 sint64 start_time = 7; 595 // Search for orders which createdAt <= endTime, time in millisecond 596 sint64 end_time = 8; 597 // Filter by order state 598 string state = 9; 599 repeated string execution_types = 10; 600 repeated string market_ids = 11; 601 // TradeId of the order we want to fetch 602 string trade_id = 12; 603 // Return only orders for active markets 604 bool active_markets_only = 13; 605 // Client order ID 606 string cid = 14; 607 } 608 609 message OrdersHistoryResponse { 610 // List of history spot orders 611 repeated SpotOrderHistory orders = 1; 612 Paging paging = 2; 613 } 614 615 message SpotOrderHistory { 616 // Hash of the order 617 string order_hash = 1; 618 // Spot Market ID is keccak265(baseDenom + quoteDenom) 619 string market_id = 2; 620 // active state of the order 621 bool is_active = 3; 622 // The subaccountId that this order belongs to 623 string subaccount_id = 4; 624 // The execution type 625 string execution_type = 5; 626 // The side of the order 627 string order_type = 6; 628 // Price of the order 629 string price = 7; 630 // Trigger price 631 string trigger_price = 8; 632 // Quantity of the order 633 string quantity = 9; 634 // Filled amount 635 string filled_quantity = 10; 636 // Order state 637 string state = 11; 638 // Order committed timestamp in UNIX millis. 639 sint64 created_at = 12; 640 // Order updated timestamp in UNIX millis. 641 sint64 updated_at = 13; 642 // Order direction (order side) 643 string direction = 14; 644 // Transaction Hash where order is created. Not all orders have this field 645 string tx_hash = 15; 646 // Custom client order ID 647 string cid = 16; 648 } 649 650 message StreamOrdersHistoryRequest { 651 // subaccount ID to filter orders for specific subaccount 652 string subaccount_id = 1; 653 // Market ID to filter orders for specific market 654 string market_id = 2; 655 // filter by order types 656 repeated string order_types = 3; 657 // order side filter 658 string direction = 4; 659 // Filter by order state 660 string state = 5; 661 repeated string execution_types = 6; 662 } 663 664 message StreamOrdersHistoryResponse { 665 // Updated order 666 SpotOrderHistory order = 1; 667 // Order update type 668 string operation_type = 2; 669 // Operation timestamp in UNIX millis. 670 sint64 timestamp = 3; 671 } 672 673 message AtomicSwapHistoryRequest { 674 // sender of the atomic swap 675 string address = 1; 676 // atomic swap contract address to filter 677 string contract_address = 2; 678 // skip some swaps 679 sint32 skip = 3; 680 // limit number of swaps returned by this API 681 sint32 limit = 4; 682 // lowerbound of atomic swap index 683 sint32 from_number = 5; 684 // upperbound of atomic swap index 685 sint32 to_number = 6; 686 } 687 688 message AtomicSwapHistoryResponse { 689 // Paging indicates total number of records with this filter 690 Paging paging = 1; 691 // swap data 692 repeated AtomicSwap data = 2; 693 } 694 695 message AtomicSwap { 696 // executor of the swap 697 string sender = 1; 698 // swap route 699 string route = 2; 700 // source coin 701 Coin source_coin = 3; 702 // destination received coin 703 Coin dest_coin = 4; 704 // fees of each steps in route 705 repeated Coin fees = 5; 706 // contract address that executes to make this swap 707 string contract_address = 6; 708 // Numerical index by sender to use in pagination from_number and to_number 709 sint32 index_by_sender = 7; 710 // Numerical index by sender + acontract to use in pagination from_number and 711 // to_number, that support contract filter 712 sint32 index_by_sender_contract = 8; 713 // transaction hash of the swap 714 string tx_hash = 9; 715 // transaction timestamp of the swap 716 sint64 executed_at = 10; 717 // Refunded amount of the swap 718 string refund_amount = 11; 719 } 720 721 message Coin { 722 // Denom of the coin 723 string denom = 1; 724 string amount = 2; 725 }