π Interactive Protobuf Types InspectorΒΆ
Interactive utility for exploring MT5 gRPC API protobuf types.
π Why You Need This ToolΒΆ
When working with MT5 gRPC API, you constantly face questions like:
- "What fields does
AccountSummaryDatahave?" - "Where can I find the
Ticketfield?" - "What values does the
ORDER_TYPEenum contain?" - "What types are available for working with orders/positions?"
Yes, all this information is already in the documentation, but without this inspector you would have to:
- Open multiple documentation files and scroll through pages
- Remember which doc file contains which type
- Manually search through text (Ctrl+F) in each file
- Constantly switch between IDE and documentation browser
- Interrupt your coding flow to look up references
ProtobufInspector solves all these problems in one command! π―
β¨ Convenience Features:ΒΆ
- Instant launch β just
dotnet run inspect - Smart search β find types by name, field, or keyword
- Clear output β structured display with emojis and formatting
- Case insensitive β no need to remember exact casing
- Interactive β explore API in real-time without recompiling code
- Time saver β answers in seconds instead of minutes of searching
Real-world benefit: Instead of spending 5-10 minutes searching documentation or proto files, you get the answer in 5 seconds. For daily MT5 API development, this tool becomes indispensable.
π LaunchΒΆ
π Available CommandsΒΆ
| Command | Description | Example |
|---|---|---|
list or ls |
Show all available types | list |
<TypeName> |
Inspect specific type | OpenedOrdersData |
search <text> or find <text> |
Find types containing text | search Order |
field <name> |
Find types with specific field | field Balance |
enum <name> |
Show enum values | enum BMT5_ENUM_ORDER_TYPE |
help or ? |
Show help | help |
exit, quit or q |
Exit inspector | exit |
π‘ Practical ExamplesΒΆ
Example 1: Discover AccountSummaryData fieldsΒΆ
Result:π Properties (15):
β’ AccountBalance : double
β’ AccountEquity : double
β’ AccountProfit : double
β’ AccountMargin : double
...
Example 2: Find type with "Ticket" fieldΒΆ
Result:β
Found in 5 type(s):
π¦ OpenedOrderInfo:
ββ Ticket: ulong
π¦ PositionInfo:
ββ Ticket: ulong
π¦ OrderCloseRequest:
ββ Ticket: ulong
...
Example 3: View ORDER_TYPE valuesΒΆ
Result:ββββββββββββββββββββββββββββββββ
ENUM: ENUM_ORDER_TYPE
ββββββββββββββββββββββββββββββββ
ORDER_TYPE_BUY = 0
ORDER_TYPE_SELL = 1
ORDER_TYPE_BUY_LIMIT = 2
ORDER_TYPE_SELL_LIMIT = 3
ORDER_TYPE_BUY_STOP = 4
ORDER_TYPE_SELL_STOP = 5
...
Example 4: Find all "Position" related typesΒΆ
Result:β
Found 8 type(s):
[Class] PositionInfo
[Class] PositionsTotalData
[Class] PositionsHistoryData
[Enum] ENUM_POSITION_TYPE
...
Example 5: View all available typesΒΆ
Result:π¦ Found 156 types:
[Data] AccountSummaryData
[Data] BalanceData
[Data] OpenedOrdersData
[Request] OrderSendRequest
[Request] OrderCloseRequest
...
π― Common Use CasesΒΆ
Scenario 1: "Getting 'field not found' error"ΒΆ
Problem: Writing summary.FreeMargin but getting compilation error.
Solution:
Result: Discover the correct field name isAccountBalance or AccountEquity.
Scenario 2: "Don't know what properties a type has"ΒΆ
Problem: Working with OpenedOrdersData but unsure what's inside.
Solution:
Result:Scenario 3: "Need enum values for ORDER_TYPE"ΒΆ
Problem: Want to use enum but don't know exact values.
Solution:
Result: All values with numeric codes.Scenario 4: "Looking for order-related types"ΒΆ
Problem: Need to find all types related to orders.
Solution:
Result:OrderSendRequest, OrderCloseRequest, OpenedOrderInfo, etc.
Scenario 5: "Want to understand what's available in API"ΒΆ
Problem: New to the API, want to see what's available.
Solution:
Result: Complete list of all types (Data, Request, Reply).π§ Code IntegrationΒΆ
After finding needed information:
// Found via inspector that correct field is AccountBalance
> AccountSummaryData
β’ AccountBalance : double β here it is!
// Use in code:
var summary = await service.GetAccountSnapshot();
Console.WriteLine(summary.Summary.AccountBalance); // β
Works!
π NotesΒΆ
- Case insensitive: can write
openeordersdataorOpenedOrdersData - Partial search:
search PosfindsPosition,PositionInfo, etc. - Lists marked π:
List<T>orRepeatedField<T> - Classes marked π¦: regular types
- Enums marked as
[Enum]
π¨ TroubleshootingΒΆ
Q: Command doesn't find type
A: Try search:Q: Need to find all enums
Q: Want to exit inspector
π Additional InformationΒΆ
- File location:
Examples/Helpers/ProtobufInspector.cs - Invoked from Program.cs:
case "inspect"orcase "types" - Used for: Exploring MT5 gRPC API types from
mt5_term_api
π» Technical DetailsΒΆ
What is inspected:
- All types from namespace
mt5_term_api - Only public types (public classes/enums)
- Types with suffixes:
Data,Request,Reply - All public properties and their types
Supported types:
- β Classes (protobuf messages)
- β Enums
- β
Generic types (List
, etc.) - β Primitive types (int, double, string, etc.)