vegaprotocol / vega

A Go implementation of the Vega Protocol, a protocol for creating and trading derivatives on a fully decentralised network.
https://vega.xyz
GNU Affero General Public License v3.0
38 stars 22 forks source link

Market Value Proxy on staging is 0 #3288

Closed edd closed 3 years ago

edd commented 3 years ago

https://github.com/vegaprotocol/specs/blob/master/protocol/0042-setting-fees-and-rewarding-lps.md#calculating-market-value-proxy

Example market that should not have a MarketValue of 0

      {
        "state": "ACTIVE",
        "id": "3C58ED2A4A6C5D7E",
        "name": "UNIDAI Monthly (30 Jun 2021)",
        "data": {
          "marketValueProxy": "0",
          "targetStake": "6190630094.864211"
        },
        "liquidityProvisions": [
          {
            "party": {
              "id": "64685023985dcb0fa25afa8b0394632c0f6b3a9d75b81e815eb7a249b2df44f7"
            },
            "status": "Active",
            "commitmentAmount": 20013000000
          },
          {
            "party": {
              "id": "eaa2dd789b85c43e8a19c7f11e5124416de43608594008502a40181b85dd90ec"
            },
            "status": "Active",
            "commitmentAmount": 4500000002
          }
        ]
      },

Relevant network params

      {
        "key": "market.value.windowLength",
        "value": "168h0m0s"
      },

Full output

{
  markets {
    state
    id
    name
    data {
      marketValueProxy
      targetStake
    }
    liquidityProvisions {
      party { id }
      status
      commitmentAmount

    }
  }
}
{
  "data": {
    "markets": [
      {
        "state": "ACTIVE",
        "id": "076BB86A5AA41E3E",
        "name": "BTCUSD Monthly (30 Jun 2021)",
        "data": {
          "marketValueProxy": "0",
          "targetStake": "11963039921475.002"
        },
        "liquidityProvisions": [
          {
            "party": {
              "id": "64685023985dcb0fa25afa8b0394632c0f6b3a9d75b81e815eb7a249b2df44f7"
            },
            "status": "Undeployed",
            "commitmentAmount": 10000000000
          }
        ]
      },
      {
        "state": "ACTIVE",
        "id": "1F0BB6EB5703B099",
        "name": "ETHBTC Quarterly (30 Jun 2021)",
        "data": {
          "marketValueProxy": "0",
          "targetStake": "1370552.4764872254"
        },
        "liquidityProvisions": [
          {
            "party": {
              "id": "64685023985dcb0fa25afa8b0394632c0f6b3a9d75b81e815eb7a249b2df44f7"
            },
            "status": "Rejected",
            "commitmentAmount": 10000000000
          }
        ]
      },
      {
        "state": "ACTIVE",
        "id": "2839D9B2329C9E70",
        "name": "AAVEDAI Monthly (30 Jun 2021)",
        "data": {
          "marketValueProxy": "0",
          "targetStake": "410506249487.2376"
        },
        "liquidityProvisions": [
          {
            "party": {
              "id": "64685023985dcb0fa25afa8b0394632c0f6b3a9d75b81e815eb7a249b2df44f7"
            },
            "status": "Active",
            "commitmentAmount": 10000000000
          }
        ]
      },
      {
        "state": "ACTIVE",
        "id": "3C58ED2A4A6C5D7E",
        "name": "UNIDAI Monthly (30 Jun 2021)",
        "data": {
          "marketValueProxy": "0",
          "targetStake": "6190630094.864211"
        },
        "liquidityProvisions": [
          {
            "party": {
              "id": "64685023985dcb0fa25afa8b0394632c0f6b3a9d75b81e815eb7a249b2df44f7"
            },
            "status": "Active",
            "commitmentAmount": 20013000000
          },
          {
            "party": {
              "id": "eaa2dd789b85c43e8a19c7f11e5124416de43608594008502a40181b85dd90ec"
            },
            "status": "Active",
            "commitmentAmount": 4500000002
          }
        ]
      },
      {
        "state": "TRADING_TERMINATED",
        "id": "4199b5e7b5a60d3d9cf95d26da8dc774598f60afb1f809585e77b5efb4bceb72",
        "name": "XYZ/HIXEL Competition March 30-1",
        "data": {
          "marketValueProxy": "0",
          "targetStake": "0"
        },
        "liquidityProvisions": null
      },
      {
        "state": "ACTIVE",
        "id": "4899E01009F1A721",
        "name": "Apple Monthly (30 Jun 2021)",
        "data": {
          "marketValueProxy": "0",
          "targetStake": "90189672390.08203"
        },
        "liquidityProvisions": [
          {
            "party": {
              "id": "eaa2dd789b85c43e8a19c7f11e5124416de43608594008502a40181b85dd90ec"
            },
            "status": "Active",
            "commitmentAmount": 300000000
          }
        ]
      },
      {
        "state": "ACTIVE",
        "id": "5A86B190C384997F",
        "name": "Tesla Quarterly (30 Jun 2021)",
        "data": {
          "marketValueProxy": "0",
          "targetStake": "182682162892.3006"
        },
        "liquidityProvisions": null
      },
      {
        "state": "ACTIVE",
        "id": "9937510589ceebee",
        "name": "Internal Comp 1 (31 Mar 2021)",
        "data": {
          "marketValueProxy": "0",
          "targetStake": "0"
        },
        "liquidityProvisions": null
      },
      {
        "state": "REJECTED",
        "id": "b97a164c56ad21712b05076bc1e98bb0cd6ba353c669a493ea1deeb90cddfdf7",
        "name": "LP_Test1_BTC/USDC",
        "data": {
          "marketValueProxy": "0",
          "targetStake": "0"
        },
        "liquidityProvisions": null
      },
      {
        "state": "ACTIVE",
        "id": "d32d2c9a65d2752e6038af524a7ed104d084ae8ec1233fd18bb61815bc1cc649",
        "name": "LP_Test1_BTC/USDC",
        "data": {
          "marketValueProxy": "0",
          "targetStake": "69353663.94705716"
        },
        "liquidityProvisions": [
          {
            "party": {
              "id": "eaa2dd789b85c43e8a19c7f11e5124416de43608594008502a40181b85dd90ec"
            },
            "status": "Active",
            "commitmentAmount": 300000001
          }
        ]
      }
    ]
  }
}
davidsiska-vega commented 3 years ago

Is it non-zero on dev?

edd commented 3 years ago

@davidsiska-vega I've given you all the tools to go and find out. They're all 0 there but there are also no LPs

{
  markets {
    state
    id
    name
    data {
      marketValueProxy
      targetStake
    }
    liquidityProvisions {
      party { id }
      status
      commitmentAmount

    }
  }
}
{
  "data": {
    "markets": [
      {
        "state": "ACTIVE",
        "id": "076BB86A5AA41E3E",
        "name": "BTCUSD Monthly (30 Jun 2021)",
        "data": {
          "marketValueProxy": "0",
          "targetStake": "0"
        },
        "liquidityProvisions": null
      },
      {
        "state": "ACTIVE",
        "id": "1F0BB6EB5703B099",
        "name": "ETHBTC Quarterly (30 Jun 2021)",
        "data": {
          "marketValueProxy": "0",
          "targetStake": "0"
        },
        "liquidityProvisions": null
      },
      {
        "state": "ACTIVE",
        "id": "2839D9B2329C9E70",
        "name": "AAVEDAI Monthly (30 Jun 2021)",
        "data": {
          "marketValueProxy": "0",
          "targetStake": "0"
        },
        "liquidityProvisions": null
      },
      {
        "state": "ACTIVE",
        "id": "3C58ED2A4A6C5D7E",
        "name": "UNIDAI Monthly (30 Jun 2021)",
        "data": {
          "marketValueProxy": "0",
          "targetStake": "0"
        },
        "liquidityProvisions": null
      },
      {
        "state": "ACTIVE",
        "id": "4899E01009F1A721",
        "name": "Apple Monthly (30 Jun 2021)",
        "data": {
          "marketValueProxy": "0",
          "targetStake": "0"
        },
        "liquidityProvisions": null
      },
      {
        "state": "ACTIVE",
        "id": "5A86B190C384997F",
        "name": "Tesla Quarterly (30 Jun 2021)",
        "data": {
          "marketValueProxy": "0",
          "targetStake": "0"
        },
        "liquidityProvisions": null
      }
    ]
  }
}
davidsiska-vega commented 3 years ago

Hi @jeremyletang , could you please have a look at this. We looked into this with @barnabee and @tamlyn10 yesterday and we "think" that "market value proxy" is calculated by core but just not exposed on APIs, is that correct?

At least the equity-like-share which is determined by market value proxy looked like it might have used it... though not 100% clear.

jeremyletang commented 3 years ago

Hi @jeremyletang , could you please have a look at this. We looked into this with @barnabee and @tamlyn10 yesterday and we "think" that "market value proxy" is calculated by core but just not exposed on APIs, is that correct?

At least the equity-like-share which is determined by market value proxy looked like it might have used it... though not 100% clear.

Taking a look now. For some reason when looking at unit tests, this seems perfectly fine. looking at it in more depth now.