Trade Reporting API
1. account_balance.proto
syntax = "proto3";
package com.thinkmarkets.tt.grpc.account_service.message.v1;
option java_multiple_files = true;
/* ACCOUNT_BALANCE */
message AccountBalance {
uint32 account_id = 1;
double balance = 2;
double equity = 3;
}
2. account_service.proto
syntax = "proto3";
package com.thinkmarkets.tt.grpc.account_service.service.v1;
option java_multiple_files = true;
import "messages.proto";
service AccountService {
rpc Connect(stream com.thinkmarkets.tt.grpc.account_service.message.v1.WrapperMessage) returns (stream com.thinkmarkets.tt.grpc.account_service.message.v1.WrapperMessage) {};
}
3. logon.proto
syntax = "proto3";
package com.thinkmarkets.tt.grpc.account_service.service.v1;
option java_multiple_files = truesyntax = "proto3";
package com.thinkmarkets.tt.grpc.account_service.message.v1;
option java_multiple_files = true;
message Logon {
string username = 1;
string password = 2;
}
4. messages.proto
syntax = "proto3";
package com.thinkmarkets.tt.grpc.account_service.message.v1;
option java_multiple_files = true;
message WrapperMessage {
enum Type {
UNKNOWN = 0;
LOGIN = 1;
LOGOUT = 2;
SUBSCRIPTION = 3;
OPEN_POSITION = 4;
ACCOUNT_BALANCE = 5;
RESPONSE = 101;
}
uint64 time = 2;
Type type = 3;
bytes data = 4;
}
5. open_positions.proto
syntax = "proto3";
package com.thinkmarkets.tt.grpc.account_service.message.v1;
option java_multiple_files = true;
/* OPEN_POSITION */
message OpenPosition {
uint32 account_id = 1;
uint64 position_id = 2;
string symbol = 3;
double lots = 4;
double quantity = 5;
double usd_quantity = 6;
string direction = 7;
uint64 open_time = 8;
double open_price = 9;
double real_time_pl = 10;
}
6. response.proto
syntax = "proto3";
package com.thinkmarkets.tt.grpc.account_service.message.v1;
option java_multiple_files = true;
import "messages.proto";
message Response {
string result = 1;
WrapperMessage.Type orig_type = 2;
}
7. position_closed.proto
syntax = "proto3";
package com.thinkmarkets.tt.grpc.account_service.message.v1;
option java_multiple_files = true;
/* CLOSED_POSITIONS */
message PositionEvent {
uint32 account_id = 1;
uint64 position_id = 2;
string symbol = 3;
double lots = 4;
double quantity = 5;
double usd_quantity = 6;
string direction = 7;
uint64 open_time = 8;
double open_price = 9;
uint64 close_time = 10;
double close_price = 11;
double profit_loss = 12;
double close_amount = 13;
string eventType = 14; // Open, Close, Update (=PartialClose)
}
8. position_event.proto
syntax = "proto3";
package com.thinkmarkets.tt.grpc.account_service.message.v1;
option java_multiple_files = true;
/* CLOSED_POSITIONS */
message PositionEvent {
uint32 account_id = 1;
uint64 position_id = 2;
string symbol = 3;
double lots = 4;
double quantity = 5;
double usd_quantity = 6;
string direction = 7;
uint64 open_time = 8;
double open_price = 9;
uint64 close_time = 10;
double close_price = 11;
double profit_loss = 12;
double close_amount = 13;
string eventType = 14; // Open, Close, Update (=PartialClose)
}