proto/market/v1/msg.proto
nfel ea32c4623e
v2: sortby in market order
Signed-off-by: nfel <nfilsaraee@gmail.com>
2025-06-08 14:07:24 +03:30

157 lines
4.2 KiB
Protocol Buffer

syntax = "proto3";
package market.v1;
import "auth/v1/msg.proto";
import "base/v1/msg.proto";
import "wallet/v1/msg.proto";
enum MarketParticipantType {
MO_PT_UNKOWN = 0;
MO_PT_MAKER = 1;
MO_PT_TAKER = 2;
}
enum MarketOrderSide {
MO_UNKOWN = 0;
MO_BUY = 1;
MO_SELL = 2;
}
enum MarketOrderStatus {
MO_UNKOWN_MP_STATUS = 0; // Unknown
MO_CREATED = 1; // Order is just created and awaits confirmation
MO_OPEN = 2; // Order is open and waiting to be completed
MO_CANCEL = 3; // Cancelled by user
MO_COMPLETED = 4; // Order is completed
MO_FAILED = 5; // Order is failed - bad trx , etc.
MO_REFUNDED = 6; // Order is refunded by platform to user due to regulation
// MO_EXPIRED = 7; // Order is expired
}
message CalcMarketReq {
optional auth.v1.InternalIAM iam = 1; // For whitelist :')
int64 asset_id = 2;
int64 counter_asset_id = 3;
double amount = 4;
double unit_price = 5;
MarketParticipantType type = 6;
wallet.v1.BuyAssetSide req_side =
7; // For Calculation : can be from asset or irt
}
message CalcMarketRes {
double calculated_irt_amount = 1;
double calculated_asset_amount = 2;
wallet.v1.EffectiveCommission commission = 3;
MarketParticipantType type = 4;
wallet.v1.BuyAssetSide req_side =
5; // For Calculation : can be from asset or irt
}
message MPHistoryFilter {}
message MPListFilter {}
message MarketOrder {
uint64 id = 1;
uint64 trx_id = 2;
wallet.v1.Asset asset = 3;
wallet.v1.Asset counter_asset = 4;
double amount = 5;
double unit_price = 6;
double total_price = 7;
MarketOrderSide side = 8;
MarketOrderStatus status = 9;
int64 from = 10;
auth.v1.UserIdentityBasic from_identity = 11;
wallet.v1.Commission commission = 12;
double completed_amount = 13;
string created_at = 14;
string updated_at = 15;
bool is_public = 16;
wallet.v1.TransactionList trx = 17;
repeated string tags = 18;
repeated string comment = 19;
optional MarketOrder source = 20; // purchase is done via this field
// repeated string attachments = 14; // possible files included by
// seller/buyer
}
message MarketAssetListReq {
base.v1.BaseQueryParam base = 1;
optional auth.v1.InternalIAM iam =
2; // If not set, will returns only public orders which are limited by a
// white list
}
message MarketAssetList { repeated wallet.v1.Asset list = 1; }
message PurchaseReq {
auth.v1.InternalIAM iam = 1;
uint64 order_id = 2;
double amount = 3;
wallet.v1.BuyAssetSide req_side =
7; // For Calculation : can be from asset or irt
optional bool accepted_contract = 4;
optional auth.v1.TFA tfa = 5;
}
message PurchaseRes {
uint64 order_id = 1;
double calculated_irt_amount = 2;
double calculated_asset_amount = 3;
wallet.v1.EffectiveCommission commission = 4;
MarketOrderStatus status = 5;
}
message MarketOrderList {
base.v1.PaginationResp page = 2;
repeated MarketOrder list = 1;
}
message NewMarketReq {
auth.v1.InternalIAM iam = 1;
int64 asset_id = 2;
int64 counter_asset_id = 3;
double amount = 4;
double unit_price = 5;
MarketParticipantType type = 6;
wallet.v1.BuyAssetSide req_side =
7; // For Calculation : can be from asset or irt
MarketOrderSide side = 8;
optional auth.v1.TFA tfa = 9;
optional bool accepted_contract = 10;
}
enum MarketOrdersSortBy {
MO_UNKONWN = 0;
MO_CREATED_AT_ASC = 1;
MO_CREATED_AT_DESC = 2;
MO_UNIT_PRICE_ASC = 3;
MO_UNIT_PRICE_DESC = 4;
MO_TOTAL_PRICE_ASC = 5;
MO_TOTAL_PRICE_DESC = 6;
MO_AVAILABLE_AMOUNT_ASC = 7;
MO_AVAILABLE_AMOUNT_DESC = 8;
}
message OrderListFilter {
optional auth.v1.InternalIAM iam = 1;
base.v1.BaseQueryParam base = 2;
optional string search = 3;
optional MarketOrderSide side = 4;
repeated MarketOrderStatus status = 5;
repeated string from = 6;
repeated string to = 7;
optional double starting_price = 8;
optional double ending_price = 9;
repeated wallet.v1.Asset asset = 10;
optional uint64 order_id = 11;
optional uint64 trx_id = 12;
optional bool is_public = 13;
optional bool has_source = 14;
optional uint64 source_order_id = 15;
optional string from_date = 16;
optional string to_date = 17;
optional MarketOrdersSortBy sort_by = 18;
}