/
portfolios.proto
104 lines (98 loc) · 2.17 KB
/
portfolios.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
syntax = "proto3";
import "google/protobuf/timestamp.proto";
package Radar;
message EquitySource { string equity = 1; }
message InterestOnOwnCapital { string equity = 1; }
message Event {
enum PositionType {
SWING_TRADE = 0;
DAY_TRADE = 1;
}
enum EquityType {
OTHER = 0;
STOCK = 1;
OPTION = 2;
REIT = 3;
SUBSCRIPTION_RIGHT = 4;
}
message EquitySource {
string symbol = 1;
EquityType type = 2;
}
message Source {
oneof type {
string other = 1;
EquitySource equity = 2;
}
}
message CashFlow {
enum Type {
OTHER = 0;
DIVIDEND = 1;
INTEREST_ON_OWN_CAPITAL = 2;
BONUS = 3;
}
Type type = 1;
double value = 2;
Source source = 3;
}
message Portfolio {
message Position {
string id = 1;
int32 shares = 2;
double value = 3;
double avg_price = 4;
EquityType equity_type = 5;
}
message Provision {
double value = 1;
string source = 2;
}
repeated Position position = 1;
repeated Provision provision = 2;
}
message PositionMonthTax {
PositionType position_type = 1;
EquityType equity_type = 2;
double value = 3;
}
message StockExemptMonthTax { double value = 1; }
message AccumulatedTaxCredit {
double swing_trade = 1;
double day_trade = 2;
double reit = 3;
}
message MonthlySell {
double swing_trade = 1;
double reit = 2;
}
message MonthlyStockExemptionPeriodProfit {
double value = 1;
string source = 2;
}
google.protobuf.Timestamp date = 1;
oneof type {
CashFlow cash_flow = 20;
Portfolio portfolio = 21;
PositionMonthTax position_month_tax = 22;
StockExemptMonthTax stock_exempt_month_tax = 23;
AccumulatedTaxCredit accumulated_tax_credit = 24;
MonthlySell monthly_sell = 25;
MonthlyStockExemptionPeriodProfit monthly_stock_exemption_period_profit =
26;
}
}
message RunReq {
enum Event {
CASH_FLOW = 0;
EACH_DAY = 1;
EACH_MONTH = 2;
}
string user_id = 1;
string portfolio_id = 2;
repeated Event events = 3;
google.protobuf.Timestamp upto = 4;
}
service Portfolios {
rpc Run(RunReq) returns (stream Event) {}
}