Skip to content

Commit 3599ff3

Browse files
authored
Merge pull request #15 from triamazikamno/master
fix OperationStatus type, add missing types
2 parents 6208709 + f7cbce3 commit 3599ff3

File tree

1 file changed

+65
-31
lines changed

1 file changed

+65
-31
lines changed

Diff for: rest_domain.go

+65-31
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,26 @@ const (
1313
type OperationType string
1414

1515
const (
16-
BUY OperationType = "Buy"
17-
SELL OperationType = "Sell"
16+
BUY OperationType = "Buy"
17+
SELL OperationType = "Sell"
18+
OperationTypeBrokerCommission OperationType = "BrokerCommission"
19+
OperationTypeExchangeCommission OperationType = "ExchangeCommission"
20+
OperationTypeServiceCommission OperationType = "ServiceCommission"
21+
OperationTypeMarginCommission OperationType = "MarginCommission"
22+
OperationTypeOtherCommission OperationType = "OtherCommission"
23+
OperationTypePayIn OperationType = "PayIn"
24+
OperationTypePayOut OperationType = "PayOut"
25+
OperationTypeTax OperationType = "Tax"
26+
OperationTypeTaxLucre OperationType = "TaxLucre"
27+
OperationTypeTaxDividend OperationType = "TaxDividend"
28+
OperationTypeTaxCoupon OperationType = "TaxCoupon"
29+
OperationTypeTaxBack OperationType = "TaxBack"
30+
OperationTypeRepayment OperationType = "Repayment"
31+
OperationTypePartRepayment OperationType = "PartRepayment"
32+
OperationTypeCoupon OperationType = "Coupon"
33+
OperationTypeDividend OperationType = "Dividend"
34+
OperationTypeSecurityIn OperationType = "SecurityIn"
35+
OperationTypeSecurityOut OperationType = "SecurityOut"
1836
)
1937

2038
type OrderStatus string
@@ -34,30 +52,46 @@ const (
3452
type OperationStatus string
3553

3654
const (
37-
OperationStatusDone OrderStatus = "Done"
38-
OperationStatusDecline OrderStatus = "Decline"
39-
OperationStatusProgress OrderStatus = "Progress"
55+
OperationStatusDone OperationStatus = "Done"
56+
OperationStatusDecline OperationStatus = "Decline"
57+
OperationStatusProgress OperationStatus = "Progress"
58+
)
59+
60+
type InstrumentType string
61+
62+
const (
63+
InstrumentTypeStock InstrumentType = "Stock"
64+
InstrumentTypeCurrency InstrumentType = "Currency"
65+
InstrumentTypeBond InstrumentType = "Bond"
66+
InstrumentTypeEtf InstrumentType = "Etf"
67+
)
68+
69+
type OrderType string
70+
71+
const (
72+
OrderTypeLimit OrderType = "Limit"
73+
OrderTypeMarket OrderType = "Market"
4074
)
4175

4276
type PlacedLimitOrder struct {
43-
ID string `json:"orderId"`
44-
Operation string `json:"operation"`
45-
Status OrderStatus `json:"status"`
46-
RejectReason string `json:"rejectReason"`
47-
RequestedLots int `json:"requestedLots"`
48-
ExecutedLots int `json:"executedLots"`
49-
Commission MoneyAmount `json:"commission"`
77+
ID string `json:"orderId"`
78+
Operation OperationType `json:"operation"`
79+
Status OrderStatus `json:"status"`
80+
RejectReason string `json:"rejectReason"`
81+
RequestedLots int `json:"requestedLots"`
82+
ExecutedLots int `json:"executedLots"`
83+
Commission MoneyAmount `json:"commission"`
5084
}
5185

5286
type Order struct {
53-
ID string `json:"orderId"`
54-
FIGI string `json:"figi"`
55-
Operation string `json:"operation"`
56-
Status string `json:"status"`
57-
RequestedLots int `json:"requestedLots"`
58-
ExecutedLots int `json:"executedLots"`
59-
Type string `json:"type"`
60-
Price float64 `json:"price"`
87+
ID string `json:"orderId"`
88+
FIGI string `json:"figi"`
89+
Operation OperationType `json:"operation"`
90+
Status OrderStatus `json:"status"`
91+
RequestedLots int `json:"requestedLots"`
92+
ExecutedLots int `json:"executedLots"`
93+
Type OrderType `json:"type"`
94+
Price float64 `json:"price"`
6195
}
6296

6397
type Portfolio struct {
@@ -72,16 +106,16 @@ type CurrencyBalance struct {
72106
}
73107

74108
type PositionBalance struct {
75-
FIGI string `json:"figi"`
76-
Ticker string `json:"ticker"`
77-
ISIN string `json:"isin"`
78-
InstrumentType string `json:"instrumentType"`
79-
Balance float64 `json:"balance"`
80-
Blocked float64 `json:"blocked"`
81-
Lots int `json:"lots"`
82-
ExpectedYield MoneyAmount `json:"expectedYield"`
83-
AveragePositionPrice MoneyAmount `json:"averagePositionPrice"`
84-
AveragePositionPriceNoNkd MoneyAmount `json:"averagePositionPriceNoNkd"`
109+
FIGI string `json:"figi"`
110+
Ticker string `json:"ticker"`
111+
ISIN string `json:"isin"`
112+
InstrumentType InstrumentType `json:"instrumentType"`
113+
Balance float64 `json:"balance"`
114+
Blocked float64 `json:"blocked"`
115+
Lots int `json:"lots"`
116+
ExpectedYield MoneyAmount `json:"expectedYield"`
117+
AveragePositionPrice MoneyAmount `json:"averagePositionPrice"`
118+
AveragePositionPriceNoNkd MoneyAmount `json:"averagePositionPriceNoNkd"`
85119
}
86120

87121
type MoneyAmount struct {
@@ -109,7 +143,7 @@ type Operation struct {
109143
Price float64 `json:"price"`
110144
Quantity int `json:"quantity"`
111145
FIGI string `json:"figi"`
112-
InstrumentType string `json:"instrumentType"`
146+
InstrumentType InstrumentType `json:"instrumentType"`
113147
IsMarginCall bool `json:"isMarginCall"`
114148
DateTime time.Time `json:"date"`
115149
OperationType OperationType `json:"operationType"`

0 commit comments

Comments
 (0)