vegaprotocol / specs

Specs, designs and requirements 🦔
MIT License
7 stars 2 forks source link

Risk model spec #296

Open tamlyn10 opened 4 years ago

tamlyn10 commented 4 years ago

I've noted that in various discussion or in specs there is a request for a risk model spec.

Questions:

  1. Is this in addition to the quant risk model spec?
  2. Should there be one risk model spec per risk model?
  3. What is the data that this model needs to return for core?
  4. Does this spec also define how the risk model should return the validation ranges for risk parameters?

cc @davidsiska-vega @witgaw @barnabee

davidsiska-vega commented 4 years ago

Good points.

I don't understand "Does this spec also define how the risk model should return the validation ranges for risk parameters?". Are you saying that each risk model should have a function where the input is all the risk parameters and output is a boolean indicating whether the parameters are valid? If yes, then this should again go into 0018-quant-risk-models.md again because all risk models should be able to do this. Maybe the return should be a boolean (indicating valid or not) and a string (to indicate warnings: e.g. volatility can be negative but it looks like a mistake).

witgaw commented 4 years ago

👆 added two new issues based on David's comment and assigned them to myself.

tamlyn10 commented 4 years ago

Thanks @davidsiska-vega and @witgaw !

@davidsiska-vega the validation question was asked by @pand-dev on a call with Barney and I around market creation. The idea is that valid risk parameter ranges should be something that a risk model provides for the required parameters for market creation. I'm not opinionated on how it's done but @barnabee or @pand-dev may be.

davidsiska-vega commented 4 years ago

@tamlyn10 I see, thanks for the clarification. So we have a decision to make: A) a risk model implements a function which takes all model parameters as input and returns a bool to say whether these are valid and an optional string with warnings

Or

B) a risk model implements a function which lists parameters it accepts and valid value ranges.

Or

C) both.

I think in the medium term A) will be easier to work with because some models could take curves / surfaces as parameters. Also some parameters have to satisfy a complex relationship between themselves that won’t be easy to describe as a range. I’m thinking about eg Feller condition in Heston model: 2\kappa \theta >\xi^2.

It can be exposed via some API node code for clients to validate proposals before submitting them.

Do you have opinions @barnabee and @pand-dev ?

C0deMunk33 commented 4 years ago

With B, are the value ranges and list of parameters something that would change regularly?

davidsiska-vega commented 4 years ago

The set of valid values is fixed per risk model. But possibly impossible to describe be only specifying ranges.