github.com/InjectiveLabs/sdk-go@v1.53.0/exchange/accounts_rpc/pb/injective_accounts_rpc.proto (about) 1 // Code generated with goa v3.7.0, DO NOT EDIT. 2 // 3 // InjectiveAccountsRPC 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_accounts_rpc; 11 12 option go_package = "/injective_accounts_rpcpb"; 13 14 // InjectiveAccountsRPC defines API of Exchange Accounts provider. 15 service InjectiveAccountsRPC { 16 // Provide the account's portfolio value in USD. 17 rpc Portfolio (PortfolioRequest) returns (PortfolioResponse); 18 // List order states by order hashes 19 rpc OrderStates (OrderStatesRequest) returns (OrderStatesResponse); 20 // List all subaccounts IDs of an account address 21 rpc SubaccountsList (SubaccountsListRequest) returns (SubaccountsListResponse); 22 // List subaccount balances for the provided denoms. 23 rpc SubaccountBalancesList (SubaccountBalancesListRequest) returns (SubaccountBalancesListResponse); 24 // Gets a balance for specific coin denom 25 rpc SubaccountBalanceEndpoint (SubaccountBalanceEndpointRequest) returns (SubaccountBalanceEndpointResponse); 26 // StreamSubaccountBalance streams new balance changes for a specified 27 // subaccount and denoms. If no denoms are provided, all denom changes are 28 // streamed. 29 rpc StreamSubaccountBalance (StreamSubaccountBalanceRequest) returns (stream StreamSubaccountBalanceResponse); 30 // Get subaccount's deposits and withdrawals history 31 rpc SubaccountHistory (SubaccountHistoryRequest) returns (SubaccountHistoryResponse); 32 // Get subaccount's orders summary 33 rpc SubaccountOrderSummary (SubaccountOrderSummaryRequest) returns (SubaccountOrderSummaryResponse); 34 // Provide historical trading rewards 35 rpc Rewards (RewardsRequest) returns (RewardsResponse); 36 // Stream live data for an account and respective data 37 rpc StreamAccountData (StreamAccountDataRequest) returns (stream StreamAccountDataResponse); 38 } 39 40 message PortfolioRequest { 41 // Account address 42 string account_address = 1; 43 } 44 45 message PortfolioResponse { 46 // The portfolio of this account 47 AccountPortfolio portfolio = 1; 48 } 49 50 message AccountPortfolio { 51 // The account's portfolio value in USD. 52 string portfolio_value = 1; 53 // The account's available balance value in USD. 54 string available_balance = 2; 55 // The account's locked balance value in USD. 56 string locked_balance = 3; 57 // The account's total unrealized PnL value in USD. 58 string unrealized_pnl = 4; 59 // List of all subaccounts' portfolio 60 repeated SubaccountPortfolio subaccounts = 5; 61 } 62 63 message SubaccountPortfolio { 64 // The ID of this subaccount 65 string subaccount_id = 1; 66 // The subaccount's available balance value in USD. 67 string available_balance = 2; 68 // The subaccount's locked balance value in USD. 69 string locked_balance = 3; 70 // The subaccount's total unrealized PnL value in USD. 71 string unrealized_pnl = 4; 72 } 73 74 message OrderStatesRequest { 75 repeated string spot_order_hashes = 1; 76 repeated string derivative_order_hashes = 2; 77 } 78 79 message OrderStatesResponse { 80 // List of the spot order state records 81 repeated OrderStateRecord spot_order_states = 1; 82 // List of the derivative order state records 83 repeated OrderStateRecord derivative_order_states = 2; 84 } 85 86 message OrderStateRecord { 87 // Hash of the order 88 string order_hash = 1; 89 // The subaccountId that this order belongs to 90 string subaccount_id = 2; 91 // The Market ID of the order 92 string market_id = 3; 93 // The type of the order 94 string order_type = 4; 95 // The side of the order 96 string order_side = 5; 97 // The state (status) of the order 98 string state = 6; 99 // The filled quantity of the order 100 string quantity_filled = 7; 101 // The filled quantity of the order 102 string quantity_remaining = 8; 103 // Order committed timestamp in UNIX millis. 104 sint64 created_at = 9; 105 // Order updated timestamp in UNIX millis. 106 sint64 updated_at = 10; 107 // Order prices 108 string price = 11; 109 // Margin for derivative order 110 string margin = 12; 111 } 112 113 message SubaccountsListRequest { 114 // Account address, the subaccounts owner 115 string account_address = 1; 116 } 117 118 message SubaccountsListResponse { 119 repeated string subaccounts = 1; 120 } 121 122 message SubaccountBalancesListRequest { 123 // SubaccountId of the trader we want to get the trades from 124 string subaccount_id = 1; 125 // Filter balances by denoms. If not set, the balances of all the denoms for 126 // the subaccount are provided. 127 repeated string denoms = 2; 128 } 129 130 message SubaccountBalancesListResponse { 131 // List of subaccount balances 132 repeated SubaccountBalance balances = 1; 133 } 134 135 message SubaccountBalance { 136 // Related subaccount ID 137 string subaccount_id = 1; 138 // Account address, owner of this subaccount 139 string account_address = 2; 140 // Coin denom on the chain. 141 string denom = 3; 142 SubaccountDeposit deposit = 4; 143 } 144 145 message SubaccountDeposit { 146 string total_balance = 1; 147 string available_balance = 2; 148 } 149 150 message SubaccountBalanceEndpointRequest { 151 // SubaccountId of the trader we want to get the trades from 152 string subaccount_id = 1; 153 // Specify denom to get balance 154 string denom = 2; 155 } 156 157 message SubaccountBalanceEndpointResponse { 158 // Subaccount balance 159 SubaccountBalance balance = 1; 160 } 161 162 message StreamSubaccountBalanceRequest { 163 // SubaccountId of the trader we want to get the trades from 164 string subaccount_id = 1; 165 // Filter balances by denoms. If not set, the balances of all the denoms for 166 // the subaccount are provided. 167 repeated string denoms = 2; 168 } 169 170 message StreamSubaccountBalanceResponse { 171 // Subaccount balance 172 SubaccountBalance balance = 1; 173 // Operation timestamp in UNIX millis. 174 sint64 timestamp = 2; 175 } 176 177 message SubaccountHistoryRequest { 178 // SubaccountId of the trader we want to get the history from 179 string subaccount_id = 1; 180 // Filter history by denom 181 string denom = 2; 182 // Filter history by transfer type 183 repeated string transfer_types = 3; 184 // Skip will skip the first n item from the result 185 uint64 skip = 4; 186 // Limit is used to specify the maximum number of items to be returned 187 sint32 limit = 5; 188 // Upper bound of account transfer history's executedAt 189 sint64 end_time = 6; 190 } 191 192 message SubaccountHistoryResponse { 193 // List of subaccount transfers 194 repeated SubaccountBalanceTransfer transfers = 1; 195 Paging paging = 2; 196 } 197 198 message SubaccountBalanceTransfer { 199 // Type of the subaccount balance transfer 200 string transfer_type = 1; 201 // Subaccount ID of the sending side 202 string src_subaccount_id = 2; 203 // Account address of the sending side 204 string src_account_address = 3; 205 // Subaccount ID of the receiving side 206 string dst_subaccount_id = 4; 207 // Account address of the receiving side 208 string dst_account_address = 5; 209 // Coin amount of the transfer 210 CosmosCoin amount = 6; 211 // Timestamp of the transfer in UNIX millis 212 sint64 executed_at = 7; 213 } 214 215 message CosmosCoin { 216 // Coin denominator 217 string denom = 1; 218 // Coin amount (big int) 219 string amount = 2; 220 } 221 // Paging defines the structure for required params for handling pagination 222 message Paging { 223 // total number of txs saved in database 224 sint64 total = 1; 225 // can be either block height or index num 226 sint32 from = 2; 227 // can be either block height or index num 228 sint32 to = 3; 229 // count entries by subaccount, serving some places on helix 230 sint64 count_by_subaccount = 4; 231 // array of tokens to navigate to the next pages 232 repeated string next = 5; 233 } 234 235 message SubaccountOrderSummaryRequest { 236 // SubaccountId of the trader we want to get the summary from 237 string subaccount_id = 1; 238 // MarketId is limiting order summary to specific market only 239 string market_id = 2; 240 // Filter by direction of the orders 241 string order_direction = 3; 242 } 243 244 message SubaccountOrderSummaryResponse { 245 // Total count of subaccount's spot orders in given market and direction 246 sint64 spot_orders_total = 1; 247 // Total count of subaccount's derivative orders in given market and direction 248 sint64 derivative_orders_total = 2; 249 } 250 251 message RewardsRequest { 252 // The distribution epoch sequence number. -1 for latest. 253 sint64 epoch = 1; 254 // Account address for the rewards distribution 255 string account_address = 2; 256 } 257 258 message RewardsResponse { 259 // The trading rewards distributed 260 repeated Reward rewards = 1; 261 } 262 263 message Reward { 264 // Account address 265 string account_address = 1; 266 // Reward coins distributed 267 repeated Coin rewards = 2; 268 // Rewards distribution timestamp in UNIX millis. 269 sint64 distributed_at = 3; 270 } 271 272 message Coin { 273 // Denom of the coin 274 string denom = 1; 275 string amount = 2; 276 } 277 278 message StreamAccountDataRequest { 279 // account address 280 string account_address = 1; 281 } 282 283 message StreamAccountDataResponse { 284 SubaccountBalanceResult subaccount_balance = 1; 285 PositionsResult position = 2; 286 TradeResult trade = 3; 287 OrderResult order = 4; 288 OrderHistoryResult order_history = 5; 289 FundingPaymentResult funding_payment = 6; 290 } 291 292 message SubaccountBalanceResult { 293 // Subaccount balance 294 SubaccountBalance balance = 1; 295 // Operation timestamp in UNIX millis. 296 sint64 timestamp = 2; 297 } 298 299 message PositionsResult { 300 // Updated derivative Position 301 Position position = 1; 302 // Operation timestamp in UNIX millis. 303 sint64 timestamp = 2; 304 } 305 306 message Position { 307 // Ticker of the derivative market 308 string ticker = 1; 309 // Derivative Market ID 310 string market_id = 2; 311 // The subaccountId that the position belongs to 312 string subaccount_id = 3; 313 // Direction of the position 314 string direction = 4; 315 // Quantity of the position 316 string quantity = 5; 317 // Price of the position 318 string entry_price = 6; 319 // Margin of the position 320 string margin = 7; 321 // LiquidationPrice of the position 322 string liquidation_price = 8; 323 // MarkPrice of the position 324 string mark_price = 9; 325 // Position updated timestamp in UNIX millis. 326 sint64 updated_at = 10; 327 // Position created timestamp in UNIX millis. 328 sint64 created_at = 11; 329 } 330 331 message TradeResult { 332 oneof trade { 333 // New spot market trade 334 SpotTrade spot_trade = 1; 335 // New derivative market trade 336 DerivativeTrade derivative_trade = 2; 337 } 338 // Executed trades update type 339 string operation_type = 3; 340 // Operation timestamp in UNIX millis. 341 sint64 timestamp = 4; 342 } 343 344 message SpotTrade { 345 // Maker order hash. 346 string order_hash = 1; 347 // The subaccountId that executed the trade 348 string subaccount_id = 2; 349 // The ID of the market that this trade is in 350 string market_id = 3; 351 // The execution type of the trade 352 string trade_execution_type = 4; 353 // The direction the trade 354 string trade_direction = 5; 355 // Price level at which trade has been executed 356 PriceLevel price = 6; 357 // The fee associated with the trade (quote asset denom) 358 string fee = 7; 359 // Timestamp of trade execution in UNIX millis 360 sint64 executed_at = 8; 361 // Fee recipient address 362 string fee_recipient = 9; 363 // A unique string that helps differentiate between trades 364 string trade_id = 10; 365 // Trade's execution side, marker/taker 366 string execution_side = 11; 367 // Custom client order ID 368 string cid = 12; 369 } 370 371 message PriceLevel { 372 // Price number of the price level. 373 string price = 1; 374 // Quantity of the price level. 375 string quantity = 2; 376 // Price level last updated timestamp in UNIX millis. 377 sint64 timestamp = 3; 378 } 379 380 message DerivativeTrade { 381 // Order hash. 382 string order_hash = 1; 383 // The subaccountId that executed the trade 384 string subaccount_id = 2; 385 // The ID of the market that this trade is in 386 string market_id = 3; 387 // The execution type of the trade 388 string trade_execution_type = 4; 389 // True if the trade is a liquidation 390 bool is_liquidation = 5; 391 // Position Delta from the trade 392 PositionDelta position_delta = 6; 393 // The payout associated with the trade 394 string payout = 7; 395 // The fee associated with the trade 396 string fee = 8; 397 // Timestamp of trade execution in UNIX millis 398 sint64 executed_at = 9; 399 // Fee recipient address 400 string fee_recipient = 10; 401 // A unique string that helps differentiate between trades 402 string trade_id = 11; 403 // Trade's execution side, marker/taker 404 string execution_side = 12; 405 // Custom client order ID 406 string cid = 13; 407 } 408 409 message PositionDelta { 410 // The direction the trade 411 string trade_direction = 1; 412 // Execution Price of the trade. 413 string execution_price = 2; 414 // Execution Quantity of the trade. 415 string execution_quantity = 3; 416 // Execution Margin of the trade. 417 string execution_margin = 4; 418 } 419 420 message OrderResult { 421 oneof order { 422 // Updated spot market order 423 SpotLimitOrder spot_order = 1; 424 // Updated derivative market order 425 DerivativeLimitOrder derivative_order = 2; 426 } 427 // Executed orders update type 428 string operation_type = 3; 429 // Operation timestamp in UNIX millis. 430 sint64 timestamp = 4; 431 } 432 433 message SpotLimitOrder { 434 // Hash of the order 435 string order_hash = 1; 436 // The side of the order 437 string order_side = 2; 438 // Spot Market ID is keccak265(baseDenom + quoteDenom) 439 string market_id = 3; 440 // The subaccountId that this order belongs to 441 string subaccount_id = 4; 442 // Price of the order 443 string price = 5; 444 // Quantity of the order 445 string quantity = 6; 446 // The amount of the quantity remaining unfilled 447 string unfilled_quantity = 7; 448 // Trigger price is the trigger price used by stop/take orders. 0 if the 449 // trigger price is not set. 450 string trigger_price = 8; 451 // Fee recipient address 452 string fee_recipient = 9; 453 // Order state 454 string state = 10; 455 // Order committed timestamp in UNIX millis. 456 sint64 created_at = 11; 457 // Order updated timestamp in UNIX millis. 458 sint64 updated_at = 12; 459 // Transaction Hash where order is created. Not all orders have this field 460 string tx_hash = 13; 461 // Custom client order ID 462 string cid = 14; 463 } 464 465 message DerivativeLimitOrder { 466 // Hash of the order 467 string order_hash = 1; 468 // The side of the order 469 string order_side = 2; 470 // Derivative Market ID 471 string market_id = 3; 472 // The subaccountId that this order belongs to 473 string subaccount_id = 4; 474 // True if the order is a reduce-only order 475 bool is_reduce_only = 5; 476 // Margin of the order 477 string margin = 6; 478 // Price of the order 479 string price = 7; 480 // Quantity of the order 481 string quantity = 8; 482 // The amount of the quantity remaining unfilled 483 string unfilled_quantity = 9; 484 // Trigger price is the trigger price used by stop/take orders 485 string trigger_price = 10; 486 // Fee recipient address 487 string fee_recipient = 11; 488 // Order state 489 string state = 12; 490 // Order committed timestamp in UNIX millis. 491 sint64 created_at = 13; 492 // Order updated timestamp in UNIX millis. 493 sint64 updated_at = 14; 494 // Order number of subaccount 495 sint64 order_number = 15; 496 // Order type 497 string order_type = 16; 498 // Order type 499 bool is_conditional = 17; 500 // Trigger timestamp, only exists for conditional orders 501 uint64 trigger_at = 18; 502 // OrderHash of order that is triggered by this conditional order 503 string placed_order_hash = 19; 504 // Execution type of conditional order 505 string execution_type = 20; 506 // Transaction Hash where order is created. Not all orders have this field 507 string tx_hash = 21; 508 // Custom client order ID 509 string cid = 22; 510 } 511 512 message OrderHistoryResult { 513 oneof order_history { 514 // Spot order history 515 SpotOrderHistory spot_order_history = 1; 516 // Derivative order history 517 DerivativeOrderHistory derivative_order_history = 2; 518 } 519 // Order update type 520 string operation_type = 3; 521 // Operation timestamp in UNIX millis. 522 sint64 timestamp = 4; 523 } 524 525 message SpotOrderHistory { 526 // Hash of the order 527 string order_hash = 1; 528 // Spot Market ID is keccak265(baseDenom + quoteDenom) 529 string market_id = 2; 530 // active state of the order 531 bool is_active = 3; 532 // The subaccountId that this order belongs to 533 string subaccount_id = 4; 534 // The execution type 535 string execution_type = 5; 536 // The side of the order 537 string order_type = 6; 538 // Price of the order 539 string price = 7; 540 // Trigger price 541 string trigger_price = 8; 542 // Quantity of the order 543 string quantity = 9; 544 // Filled amount 545 string filled_quantity = 10; 546 // Order state 547 string state = 11; 548 // Order committed timestamp in UNIX millis. 549 sint64 created_at = 12; 550 // Order updated timestamp in UNIX millis. 551 sint64 updated_at = 13; 552 // Order direction (order side) 553 string direction = 14; 554 // Transaction Hash where order is created. Not all orders have this field 555 string tx_hash = 15; 556 // Custom client order ID 557 string cid = 16; 558 } 559 560 message DerivativeOrderHistory { 561 // Hash of the order 562 string order_hash = 1; 563 // Spot Market ID is keccak265(baseDenom + quoteDenom) 564 string market_id = 2; 565 // active state of the order 566 bool is_active = 3; 567 // The subaccountId that this order belongs to 568 string subaccount_id = 4; 569 // The execution type 570 string execution_type = 5; 571 // The side of the order 572 string order_type = 6; 573 // Price of the order 574 string price = 7; 575 // Trigger price 576 string trigger_price = 8; 577 // Quantity of the order 578 string quantity = 9; 579 // Filled amount 580 string filled_quantity = 10; 581 // Order state 582 string state = 11; 583 // Order committed timestamp in UNIX millis. 584 sint64 created_at = 12; 585 // Order updated timestamp in UNIX millis. 586 sint64 updated_at = 13; 587 // True if an order is reduce only 588 bool is_reduce_only = 14; 589 // Order direction (order side) 590 string direction = 15; 591 // True if this is conditional order, otherwise false 592 bool is_conditional = 16; 593 // Trigger timestamp in unix milli 594 uint64 trigger_at = 17; 595 // Order hash placed when this triggers 596 string placed_order_hash = 18; 597 // Order's margin 598 string margin = 19; 599 // Transaction Hash where order is created. Not all orders have this field 600 string tx_hash = 20; 601 // Custom client order ID 602 string cid = 21; 603 } 604 605 message FundingPaymentResult { 606 // Funding payments of the account 607 FundingPayment funding_payments = 1; 608 // Funding payments type 609 string operation_type = 2; 610 // Operation timestamp in UNIX millis. 611 sint64 timestamp = 4; 612 } 613 614 message FundingPayment { 615 // Derivative Market ID 616 string market_id = 1; 617 // The subaccountId that the position belongs to 618 string subaccount_id = 2; 619 // Amount of the funding payment 620 string amount = 3; 621 // Timestamp of funding payment in UNIX millis 622 sint64 timestamp = 4; 623 }