-
Notifications
You must be signed in to change notification settings - Fork 19
/
governance_update_market.go
606 lines (531 loc) · 20 KB
/
governance_update_market.go
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
// Copyright (c) 2022 Gobalsky Labs Limited
//
// Use of this software is governed by the Business Source License included
// in the LICENSE.VEGA file and at https://www.mariadb.com/bsl11.
//
// Change Date: 18 months from the later of the date of the first publicly
// available Distribution of this version of the repository, and 25 June 2022.
//
// On the date above, in accordance with the Business Source License, use
// of this software will be governed by version 3 or later of the GNU General
// Public License.
package types
import (
"fmt"
"code.vegaprotocol.io/vega/core/datasource"
dsdefinition "code.vegaprotocol.io/vega/core/datasource/definition"
"code.vegaprotocol.io/vega/libs/num"
"code.vegaprotocol.io/vega/libs/stringer"
vegapb "code.vegaprotocol.io/vega/protos/vega"
)
type ProposalTermsUpdateMarket struct {
UpdateMarket *UpdateMarket
}
func (a ProposalTermsUpdateMarket) String() string {
return fmt.Sprintf(
"updateMarket(%s)",
stringer.ReflectPointerToString(a.UpdateMarket),
)
}
func (a ProposalTermsUpdateMarket) IntoProto() *vegapb.ProposalTerms_UpdateMarket {
return &vegapb.ProposalTerms_UpdateMarket{
UpdateMarket: a.UpdateMarket.IntoProto(),
}
}
func (a ProposalTermsUpdateMarket) isPTerm() {}
func (a ProposalTermsUpdateMarket) oneOfProto() interface{} {
return a.IntoProto()
}
func (a ProposalTermsUpdateMarket) GetTermType() ProposalTermsType {
return ProposalTermsTypeUpdateMarket
}
func (a ProposalTermsUpdateMarket) DeepClone() proposalTerm {
if a.UpdateMarket == nil {
return &ProposalTermsUpdateMarket{}
}
return &ProposalTermsUpdateMarket{
UpdateMarket: a.UpdateMarket.DeepClone(),
}
}
func UpdateMarketFromProto(p *vegapb.ProposalTerms_UpdateMarket) (*ProposalTermsUpdateMarket, error) {
var updateMarket *UpdateMarket
if p.UpdateMarket != nil {
updateMarket = &UpdateMarket{}
updateMarket.MarketID = p.UpdateMarket.MarketId
if p.UpdateMarket.Changes != nil {
var err error
updateMarket.Changes, err = UpdateMarketConfigurationFromProto(p.UpdateMarket.Changes)
if err != nil {
return nil, err
}
}
}
return &ProposalTermsUpdateMarket{
UpdateMarket: updateMarket,
}, nil
}
type UpdateMarket struct {
MarketID string
Changes *UpdateMarketConfiguration
}
func (n UpdateMarket) String() string {
return fmt.Sprintf(
"marketID(%s) changes(%s)",
n.MarketID,
stringer.ReflectPointerToString(n.Changes),
)
}
func (n UpdateMarket) IntoProto() *vegapb.UpdateMarket {
var changes *vegapb.UpdateMarketConfiguration
if n.Changes != nil {
changes = n.Changes.IntoProto()
}
return &vegapb.UpdateMarket{
MarketId: n.MarketID,
Changes: changes,
}
}
func (n UpdateMarket) DeepClone() *UpdateMarket {
cpy := UpdateMarket{
MarketID: n.MarketID,
}
if n.Changes != nil {
cpy.Changes = n.Changes.DeepClone()
}
return &cpy
}
type updateRiskParams interface {
updateRiskParamsIntoProto() interface{}
DeepClone() updateRiskParams
String() string
}
type UpdateMarketConfiguration struct {
Instrument *UpdateInstrumentConfiguration
Metadata []string
PriceMonitoringParameters *PriceMonitoringParameters
LiquidityMonitoringParameters *LiquidityMonitoringParameters
LiquiditySLAParameters *LiquiditySLAParams
RiskParameters updateRiskParams
LinearSlippageFactor num.Decimal
QuadraticSlippageFactor num.Decimal
}
func (n UpdateMarketConfiguration) String() string {
return fmt.Sprintf(
"instrument(%s) metadata(%v) priceMonitoring(%s) liquidityMonitoring(%s) risk(%s) linearSlippageFactor(%s) quadraticSlippageFactor(%s)",
stringer.ReflectPointerToString(n.Instrument),
MetadataList(n.Metadata).String(),
stringer.ReflectPointerToString(n.PriceMonitoringParameters),
stringer.ReflectPointerToString(n.LiquidityMonitoringParameters),
stringer.ReflectPointerToString(n.RiskParameters),
n.LinearSlippageFactor.String(),
n.QuadraticSlippageFactor.String(),
)
}
func (n UpdateMarketConfiguration) DeepClone() *UpdateMarketConfiguration {
cpy := &UpdateMarketConfiguration{
Metadata: make([]string, len(n.Metadata)),
LinearSlippageFactor: n.LinearSlippageFactor.Copy(),
QuadraticSlippageFactor: n.QuadraticSlippageFactor.Copy(),
}
cpy.Metadata = append(cpy.Metadata, n.Metadata...)
if n.Instrument != nil {
cpy.Instrument = n.Instrument.DeepClone()
}
if n.PriceMonitoringParameters != nil {
cpy.PriceMonitoringParameters = n.PriceMonitoringParameters.DeepClone()
}
if n.LiquidityMonitoringParameters != nil {
cpy.LiquidityMonitoringParameters = n.LiquidityMonitoringParameters.DeepClone()
}
if n.RiskParameters != nil {
cpy.RiskParameters = n.RiskParameters.DeepClone()
}
if n.LiquiditySLAParameters != nil {
cpy.LiquiditySLAParameters = n.LiquiditySLAParameters.DeepClone()
}
return cpy
}
func (n UpdateMarketConfiguration) IntoProto() *vegapb.UpdateMarketConfiguration {
riskParams := n.RiskParameters.updateRiskParamsIntoProto()
md := make([]string, 0, len(n.Metadata))
md = append(md, n.Metadata...)
var instrument *vegapb.UpdateInstrumentConfiguration
if n.Instrument != nil {
instrument = n.Instrument.IntoProto()
}
var priceMonitoring *vegapb.PriceMonitoringParameters
if n.PriceMonitoringParameters != nil {
priceMonitoring = n.PriceMonitoringParameters.IntoProto()
}
var liquidityMonitoring *vegapb.LiquidityMonitoringParameters
if n.LiquidityMonitoringParameters != nil {
liquidityMonitoring = n.LiquidityMonitoringParameters.IntoProto()
}
var liquiditySLAParameters *vegapb.LiquiditySLAParameters
if n.LiquiditySLAParameters != nil {
liquiditySLAParameters = n.LiquiditySLAParameters.IntoProto()
}
r := &vegapb.UpdateMarketConfiguration{
Instrument: instrument,
Metadata: md,
PriceMonitoringParameters: priceMonitoring,
LiquidityMonitoringParameters: liquidityMonitoring,
LiquiditySlaParameters: liquiditySLAParameters,
LinearSlippageFactor: n.LinearSlippageFactor.String(),
QuadraticSlippageFactor: n.QuadraticSlippageFactor.String(),
}
switch rp := riskParams.(type) {
case *vegapb.UpdateMarketConfiguration_Simple:
r.RiskParameters = rp
case *vegapb.UpdateMarketConfiguration_LogNormal:
r.RiskParameters = rp
}
return r
}
func UpdateMarketConfigurationFromProto(p *vegapb.UpdateMarketConfiguration) (*UpdateMarketConfiguration, error) {
md := make([]string, 0, len(p.Metadata))
md = append(md, p.Metadata...)
var err error
var instrument *UpdateInstrumentConfiguration
if p.Instrument != nil {
instrument, err = UpdateInstrumentConfigurationFromProto(p.Instrument)
if err != nil {
return nil, fmt.Errorf("error getting update instrument configuration from proto: %s", err)
}
}
var priceMonitoring *PriceMonitoringParameters
if p.PriceMonitoringParameters != nil {
priceMonitoring = PriceMonitoringParametersFromProto(p.PriceMonitoringParameters)
}
var liquidityMonitoring *LiquidityMonitoringParameters
if p.LiquidityMonitoringParameters != nil {
var err error
liquidityMonitoring, err = LiquidityMonitoringParametersFromProto(p.LiquidityMonitoringParameters)
if err != nil {
return nil, fmt.Errorf("error getting update market configuration from proto: %s", err)
}
}
var liquiditySLAParameters *LiquiditySLAParams
if p.LiquiditySlaParameters != nil {
liquiditySLAParameters = LiquiditySLAParamsFromProto(p.LiquiditySlaParameters)
}
linearSlippageFactor, err := num.DecimalFromString(p.LinearSlippageFactor)
if err != nil {
return nil, fmt.Errorf("error getting new market configuration from proto: %w", err)
}
quadraticSlippageFactor, err := num.DecimalFromString(p.QuadraticSlippageFactor)
if err != nil {
return nil, fmt.Errorf("error getting new market configuration from proto: %w", err)
}
r := &UpdateMarketConfiguration{
Instrument: instrument,
Metadata: md,
PriceMonitoringParameters: priceMonitoring,
LiquidityMonitoringParameters: liquidityMonitoring,
LiquiditySLAParameters: liquiditySLAParameters,
LinearSlippageFactor: linearSlippageFactor,
QuadraticSlippageFactor: quadraticSlippageFactor,
}
if p.RiskParameters != nil {
switch rp := p.RiskParameters.(type) {
case *vegapb.UpdateMarketConfiguration_Simple:
r.RiskParameters = UpdateMarketConfigurationSimpleFromProto(rp)
case *vegapb.UpdateMarketConfiguration_LogNormal:
r.RiskParameters = UpdateMarketConfigurationLogNormalFromProto(rp)
}
}
return r, nil
}
type UpdateInstrumentConfiguration struct {
Code string
// *UpdateInstrumentConfigurationFuture
Product updateInstrumentConfigurationProduct
}
func (i UpdateInstrumentConfiguration) DeepClone() *UpdateInstrumentConfiguration {
cpy := UpdateInstrumentConfiguration{
Code: i.Code,
}
if i.Product != nil {
cpy.Product = i.Product.DeepClone()
}
return &cpy
}
func (i UpdateInstrumentConfiguration) IntoProto() *vegapb.UpdateInstrumentConfiguration {
p := i.Product.icpIntoProto()
r := &vegapb.UpdateInstrumentConfiguration{
Code: i.Code,
}
switch pr := p.(type) {
case *vegapb.UpdateInstrumentConfiguration_Future:
r.Product = pr
case *vegapb.UpdateInstrumentConfiguration_Perpetual:
r.Product = pr
}
return r
}
func (i UpdateInstrumentConfiguration) String() string {
return fmt.Sprintf(
"code(%s) product(%s)",
i.Code,
stringer.ReflectPointerToString(i.Product),
)
}
type updateInstrumentConfigurationProduct interface {
isUpdateInstrumentConfigurationProduct()
icpIntoProto() interface{}
DeepClone() updateInstrumentConfigurationProduct
String() string
}
type UpdateInstrumentConfigurationFuture struct {
Future *UpdateFutureProduct
}
func (i UpdateInstrumentConfigurationFuture) isUpdateInstrumentConfigurationProduct() {}
func (i UpdateInstrumentConfigurationFuture) icpIntoProto() interface{} {
return i.IntoProto()
}
func (i UpdateInstrumentConfigurationFuture) DeepClone() updateInstrumentConfigurationProduct {
if i.Future == nil {
return &UpdateInstrumentConfigurationFuture{}
}
return &UpdateInstrumentConfigurationFuture{
Future: i.Future.DeepClone(),
}
}
func (i UpdateInstrumentConfigurationFuture) String() string {
return fmt.Sprintf(
"future(%s)",
stringer.ReflectPointerToString(i.Future),
)
}
func (i UpdateInstrumentConfigurationFuture) IntoProto() *vegapb.UpdateInstrumentConfiguration_Future {
return &vegapb.UpdateInstrumentConfiguration_Future{
Future: i.Future.IntoProto(),
}
}
type UpdateInstrumentConfigurationPerps struct {
Perps *UpdatePerpsProduct
}
func (i UpdateInstrumentConfigurationPerps) isUpdateInstrumentConfigurationProduct() {}
func (i UpdateInstrumentConfigurationPerps) icpIntoProto() interface{} {
return i.IntoProto()
}
func (i UpdateInstrumentConfigurationPerps) DeepClone() updateInstrumentConfigurationProduct {
if i.Perps == nil {
return &UpdateInstrumentConfigurationPerps{}
}
return &UpdateInstrumentConfigurationPerps{
Perps: i.Perps.DeepClone(),
}
}
func (i UpdateInstrumentConfigurationPerps) String() string {
return fmt.Sprintf(
"perps(%s)",
stringer.ReflectPointerToString(i.Perps),
)
}
func (i UpdateInstrumentConfigurationPerps) IntoProto() *vegapb.UpdateInstrumentConfiguration_Perpetual {
return &vegapb.UpdateInstrumentConfiguration_Perpetual{
Perpetual: i.Perps.IntoProto(),
}
}
func UpdateInstrumentConfigurationFromProto(p *vegapb.UpdateInstrumentConfiguration) (*UpdateInstrumentConfiguration, error) {
r := &UpdateInstrumentConfiguration{
Code: p.Code,
}
switch pr := p.Product.(type) {
case *vegapb.UpdateInstrumentConfiguration_Future:
settl, err := datasource.DefinitionFromProto(pr.Future.DataSourceSpecForSettlementData)
if err != nil {
return nil, fmt.Errorf("failed to parse settlement data source spec: %w", err)
}
term, err := datasource.DefinitionFromProto(pr.Future.DataSourceSpecForTradingTermination)
if err != nil {
return nil, fmt.Errorf("failed to parse trading termination data source spec: %w", err)
}
r.Product = &UpdateInstrumentConfigurationFuture{
Future: &UpdateFutureProduct{
QuoteName: pr.Future.QuoteName,
DataSourceSpecForSettlementData: *datasource.NewDefinitionWith(settl),
DataSourceSpecForTradingTermination: *datasource.NewDefinitionWith(term),
DataSourceSpecBinding: datasource.SpecBindingForFutureFromProto(pr.Future.DataSourceSpecBinding),
},
}
case *vegapb.UpdateInstrumentConfiguration_Perpetual:
settlement, err := datasource.DefinitionFromProto(pr.Perpetual.DataSourceSpecForSettlementData)
if err != nil {
return nil, fmt.Errorf("failed to parse settlement data source spec: %w", err)
}
settlementSchedule, err := datasource.DefinitionFromProto(pr.Perpetual.DataSourceSpecForSettlementSchedule)
if err != nil {
return nil, fmt.Errorf("failed to parse settlement schedule data source spec: %w", err)
}
var marginFundingFactor, interestRate, clampLowerBound, clampUpperBound num.Decimal
if marginFundingFactor, err = num.DecimalFromString(pr.Perpetual.MarginFundingFactor); err != nil {
return nil, fmt.Errorf("failed to parse margin funding factor: %w", err)
}
if interestRate, err = num.DecimalFromString(pr.Perpetual.InterestRate); err != nil {
return nil, fmt.Errorf("failed to parse interest rate: %w", err)
}
if clampLowerBound, err = num.DecimalFromString(pr.Perpetual.ClampLowerBound); err != nil {
return nil, fmt.Errorf("failed to parse clamp lower bound: %w", err)
}
if clampUpperBound, err = num.DecimalFromString(pr.Perpetual.ClampUpperBound); err != nil {
return nil, fmt.Errorf("failed to parse clamp upper bound: %w", err)
}
r.Product = &UpdateInstrumentConfigurationPerps{
Perps: &UpdatePerpsProduct{
QuoteName: pr.Perpetual.QuoteName,
MarginFundingFactor: marginFundingFactor,
InterestRate: interestRate,
ClampLowerBound: clampLowerBound,
ClampUpperBound: clampUpperBound,
DataSourceSpecForSettlementData: *datasource.NewDefinitionWith(settlement),
DataSourceSpecForSettlementSchedule: *datasource.NewDefinitionWith(settlementSchedule),
DataSourceSpecBinding: datasource.SpecBindingForPerpsFromProto(pr.Perpetual.DataSourceSpecBinding),
},
}
}
return r, nil
}
type UpdateFutureProduct struct {
QuoteName string
DataSourceSpecForSettlementData dsdefinition.Definition
DataSourceSpecForTradingTermination dsdefinition.Definition
DataSourceSpecBinding *datasource.SpecBindingForFuture
}
func (f UpdateFutureProduct) IntoProto() *vegapb.UpdateFutureProduct {
return &vegapb.UpdateFutureProduct{
QuoteName: f.QuoteName,
DataSourceSpecForSettlementData: f.DataSourceSpecForSettlementData.IntoProto(),
DataSourceSpecForTradingTermination: f.DataSourceSpecForTradingTermination.IntoProto(),
DataSourceSpecBinding: f.DataSourceSpecBinding.IntoProto(),
}
}
func (f UpdateFutureProduct) DeepClone() *UpdateFutureProduct {
return &UpdateFutureProduct{
QuoteName: f.QuoteName,
DataSourceSpecForSettlementData: *f.DataSourceSpecForSettlementData.DeepClone().(*dsdefinition.Definition),
DataSourceSpecForTradingTermination: *f.DataSourceSpecForTradingTermination.DeepClone().(*dsdefinition.Definition),
DataSourceSpecBinding: f.DataSourceSpecBinding.DeepClone(),
}
}
func (f UpdateFutureProduct) String() string {
return fmt.Sprintf(
"quoteName(%s) settlementData(%s) tradingTermination(%s) binding(%s)",
f.QuoteName,
stringer.ReflectPointerToString(f.DataSourceSpecForSettlementData),
stringer.ReflectPointerToString(f.DataSourceSpecForTradingTermination),
stringer.ReflectPointerToString(f.DataSourceSpecBinding),
)
}
type UpdatePerpsProduct struct {
QuoteName string
MarginFundingFactor num.Decimal
InterestRate num.Decimal
ClampLowerBound num.Decimal
ClampUpperBound num.Decimal
DataSourceSpecForSettlementData dsdefinition.Definition
DataSourceSpecForSettlementSchedule dsdefinition.Definition
DataSourceSpecBinding *datasource.SpecBindingForPerps
}
func (p UpdatePerpsProduct) IntoProto() *vegapb.UpdatePerpetualProduct {
return &vegapb.UpdatePerpetualProduct{
QuoteName: p.QuoteName,
MarginFundingFactor: p.MarginFundingFactor.String(),
InterestRate: p.InterestRate.String(),
ClampLowerBound: p.ClampLowerBound.String(),
ClampUpperBound: p.ClampUpperBound.String(),
DataSourceSpecForSettlementData: p.DataSourceSpecForSettlementData.IntoProto(),
DataSourceSpecForSettlementSchedule: p.DataSourceSpecForSettlementSchedule.IntoProto(),
DataSourceSpecBinding: p.DataSourceSpecBinding.IntoProto(),
}
}
func (p UpdatePerpsProduct) DeepClone() *UpdatePerpsProduct {
return &UpdatePerpsProduct{
QuoteName: p.QuoteName,
MarginFundingFactor: p.MarginFundingFactor,
InterestRate: p.InterestRate,
ClampLowerBound: p.ClampLowerBound,
ClampUpperBound: p.ClampLowerBound,
DataSourceSpecForSettlementData: *p.DataSourceSpecForSettlementData.DeepClone().(*dsdefinition.Definition),
DataSourceSpecForSettlementSchedule: *p.DataSourceSpecForSettlementSchedule.DeepClone().(*dsdefinition.Definition),
DataSourceSpecBinding: p.DataSourceSpecBinding.DeepClone(),
}
}
func (p UpdatePerpsProduct) String() string {
return fmt.Sprintf(
"quote(%s)marginFundingFactor(%s) interestRate(%s) clampLowerBound(%s) clampUpperBound(%s) settlementData(%s) settlementSchedule(%s) binding(%s)",
p.QuoteName,
p.MarginFundingFactor.String(),
p.InterestRate.String(),
p.ClampLowerBound.String(),
p.ClampUpperBound.String(),
stringer.ReflectPointerToString(p.DataSourceSpecForSettlementData),
stringer.ReflectPointerToString(p.DataSourceSpecForSettlementSchedule),
stringer.ReflectPointerToString(p.DataSourceSpecBinding),
)
}
type UpdateMarketConfigurationSimple struct {
Simple *SimpleModelParams
}
func (n UpdateMarketConfigurationSimple) String() string {
return fmt.Sprintf(
"simple(%s)",
stringer.ReflectPointerToString(n.Simple),
)
}
func (n UpdateMarketConfigurationSimple) updateRiskParamsIntoProto() interface{} {
return n.IntoProto()
}
func (n UpdateMarketConfigurationSimple) DeepClone() updateRiskParams {
if n.Simple == nil {
return &UpdateMarketConfigurationSimple{}
}
return &UpdateMarketConfigurationSimple{
Simple: n.Simple.DeepClone(),
}
}
func (n UpdateMarketConfigurationSimple) IntoProto() *vegapb.UpdateMarketConfiguration_Simple {
return &vegapb.UpdateMarketConfiguration_Simple{
Simple: n.Simple.IntoProto(),
}
}
func UpdateMarketConfigurationSimpleFromProto(p *vegapb.UpdateMarketConfiguration_Simple) *UpdateMarketConfigurationSimple {
return &UpdateMarketConfigurationSimple{
Simple: SimpleModelParamsFromProto(p.Simple),
}
}
type UpdateMarketConfigurationLogNormal struct {
LogNormal *LogNormalRiskModel
}
func (n UpdateMarketConfigurationLogNormal) String() string {
return fmt.Sprintf(
"logNormal(%s)",
stringer.ReflectPointerToString(n.LogNormal),
)
}
func (n UpdateMarketConfigurationLogNormal) updateRiskParamsIntoProto() interface{} {
return n.IntoProto()
}
func (n UpdateMarketConfigurationLogNormal) DeepClone() updateRiskParams {
if n.LogNormal == nil {
return &UpdateMarketConfigurationLogNormal{}
}
return &UpdateMarketConfigurationLogNormal{
LogNormal: n.LogNormal.DeepClone(),
}
}
func (n UpdateMarketConfigurationLogNormal) IntoProto() *vegapb.UpdateMarketConfiguration_LogNormal {
return &vegapb.UpdateMarketConfiguration_LogNormal{
LogNormal: n.LogNormal.IntoProto(),
}
}
func UpdateMarketConfigurationLogNormalFromProto(p *vegapb.UpdateMarketConfiguration_LogNormal) *UpdateMarketConfigurationLogNormal {
return &UpdateMarketConfigurationLogNormal{
LogNormal: &LogNormalRiskModel{
RiskAversionParameter: num.DecimalFromFloat(p.LogNormal.RiskAversionParameter),
Tau: num.DecimalFromFloat(p.LogNormal.Tau),
Params: LogNormalParamsFromProto(p.LogNormal.Params),
},
}
}