Skip to content

Commit 204509b

Browse files
committed
Added support of fractional lastSize
1 parent 35f92e3 commit 204509b

7 files changed

Lines changed: 65 additions & 8 deletions

File tree

contract.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@ type ContractDetails struct {
270270
SizeIncrement Decimal
271271
SuggestedSizeIncrement Decimal
272272
MinAlgoSize Decimal
273+
LastPricePrecision Decimal
274+
LastSizePrecision Decimal
273275

274276
SecIDList []TagValue
275277

@@ -321,11 +323,13 @@ func NewContractDetails() *ContractDetails {
321323
cd.SizeIncrement = UNSET_DECIMAL
322324
cd.SuggestedSizeIncrement = UNSET_DECIMAL
323325
cd.MinAlgoSize = UNSET_DECIMAL
326+
cd.LastPricePrecision = UNSET_DECIMAL
327+
cd.LastSizePrecision = UNSET_DECIMAL
324328
return cd
325329
}
326330

327331
func (c ContractDetails) String() string {
328-
return fmt.Sprintf("%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %t, %t, %f, %t, %s, %s, %s, %s, %t, %s, %s, %s, %s, %s, %s, %s, %s, %s",
332+
return fmt.Sprintf("%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %t, %t, %f, %t, %s, %s, %s, %s, %t, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s",
329333
c.Contract,
330334
c.MarketName,
331335
FloatMaxString(c.MinTick),
@@ -370,6 +374,8 @@ func (c ContractDetails) String() string {
370374
DecimalMaxString(c.SizeIncrement),
371375
DecimalMaxString(c.SuggestedSizeIncrement),
372376
DecimalMaxString(c.MinAlgoSize),
377+
DecimalMaxString(c.LastPricePrecision),
378+
DecimalMaxString(c.LastSizePrecision),
373379
c.IneligibilityReasonList,
374380
c.EventContract1,
375381
c.EventContractDescription1,

decoder_utils.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,12 @@ func decodeContractDetails(contractProto *protobuf.Contract, contractDetailsProt
10241024
if contractDetailsProto.MinAlgoSize != nil {
10251025
contractDetails.MinAlgoSize = StringToDecimal(contractDetailsProto.GetMinAlgoSize())
10261026
}
1027+
if contractDetailsProto.LastPricePrecision != nil {
1028+
contractDetails.LastPricePrecision = StringToDecimal(contractDetailsProto.GetLastPricePrecision())
1029+
}
1030+
if contractDetailsProto.LastSizePrecision != nil {
1031+
contractDetails.LastSizePrecision = StringToDecimal(contractDetailsProto.GetLastSizePrecision())
1032+
}
10271033

10281034
setLastTradeDate(contractDetails.Contract.LastTradeDateOrContractMonth, contractDetails, isBond)
10291035

proto/ContractDetails.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,6 @@ message ContractDetails {
7777
optional string eventContractDescription2 = 61;
7878

7979
optional string minAlgoSize = 62;
80+
optional string lastPricePrecision = 63;
81+
optional string lastSizePrecision = 64;
8082
}

proto/TickReqParams.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ message TickReqParams {
99
optional string minTick = 2;
1010
optional string bboExchange = 3;
1111
optional int32 snapshotPermissions = 4;
12+
optional string lastPricePrecision = 5;
13+
optional string lastSizePrecision = 6;
1214
}

protobuf/ContractDetails.pb.go

Lines changed: 23 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protobuf/TickReqParams.pb.go

Lines changed: 23 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server_versions.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,11 @@ const (
169169
MIN_SERVER_VER_CONFIG Version = 219
170170
MIN_SERVER_VER_MARKET_DATA_VOLUMES_IN_SHARES Version = 220
171171
MIN_SERVER_VER_UPDATE_CONFIG Version = 221
172+
MIN_SERVER_VER_FRACTIONAL_LAST_SIZE Version = 222
172173

173174
// 100+ messaging
174175
// 100 = enhanced handshake, msg length prefixes
175176

176177
MIN_CLIENT_VER = 100
177-
MAX_CLIENT_VER = MIN_SERVER_VER_UPDATE_CONFIG
178+
MAX_CLIENT_VER = MIN_SERVER_VER_FRACTIONAL_LAST_SIZE
178179
)

0 commit comments

Comments
 (0)