Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Price is zero for market with decimal places bigger than asset decimals #11297

Closed
daniel1302 opened this issue May 20, 2024 · 0 comments · Fixed by #11298
Closed

[Bug]: Price is zero for market with decimal places bigger than asset decimals #11297

daniel1302 opened this issue May 20, 2024 · 0 comments · Fixed by #11298
Assignees
Labels

Comments

@daniel1302
Copy link
Contributor

daniel1302 commented May 20, 2024

Problem encountered

All prices for trades in the market are 0 even if they are submitted with non-zero prices. Other problem is price mark is static even if oracles are coming, and Market is constantly in the auction monitoring:

image

Observed behaviour

The trade prices are zero

Expected behaviour

Price should be as they are submitted.

Steps to reproduce

1. Submit `xyz` transaction
2. With this payload
3. Query `abc` API
4. Observe the error

Software version

v0.76.3

Failing test

No response

Jenkins run

No response

Configuration used

The market config is like the following:

 {
      "id": "86d79adb47342f6e0d26be551478ec7e665aa9e33cf068bd4e63278cc22e5203",
      "tradableInstrument": {
        "instrument": {
          "id": "",
          "code": "PEPE/USD",
          "name": "PEPE / USD (price*1000)(Perpetual)",
          "metadata": {
            "tags": [
              "base:PEPE",
              "quote:USDT",
              "oracle:pyth",
              "oracleChain:gnosis",
              "class:fx/crypto",
              "perpetual",
              "sector:defi",
              "enactment:2024-02-04T15:00:00Z",
              "domain:https://www.pepe.vip/"
            ]
          },
          "perpetual": {
            "settlementAsset": "c9fe6fc24fce121b2cc72680543a886055abb560043fda394ba5376203b7527d",
            "quoteName": "siUSDC",
            "marginFundingFactor": "0.9",
            "interestRate": "0.1095",
            "clampLowerBound": "-0.0005",
            "clampUpperBound": "0.0005",
            "dataSourceSpecForSettlementSchedule": {
              "id": "97960f68df842d404c9935082c75027c11040e53f323f3219b84951827eeba4d",
              "createdAt": "0",
              "updatedAt": "0",
              "data": {
                "internal": {
                  "timeTrigger": {
                    "conditions": [
                      {
                        "operator": "OPERATOR_GREATER_THAN",
                        "value": "0"
                      }
                    ],
                    "triggers": [
                      {
                        "initial": "1715968124",
                        "every": "300"
                      }
                    ]
                  }
                }
              },
              "status": "STATUS_UNSPECIFIED"
            },
            "dataSourceSpecForSettlementData": {
              "id": "cf4152da41f360b526272ebe54bd174e7e589dfcc3fa26690bf88b7e6a74e064",
              "createdAt": "0",
              "updatedAt": "0",
              "data": {
                "external": {
                  "ethOracle": {
                    "address": "0x2BA6654FdB605637994047ecA217a02E224c4828",
                    "abi": "[{\"inputs\": [{\"internalType\": \"bytes32\", \"name\": \"id\", \"type\": \"bytes32\"}, {\"internalType\": \"int32\", \"name\": \"multiplier\", \"type\": \"int32\"}], \"name\": \"getPrice\", \"outputs\": [{\"internalType\": \"int256\", \"name\": \"\", \"type\": \"int256\" }], \"stateMutability\": \"view\", \"type\": \"function\"}]",
                    "method": "getPrice",
                    "args": [
                      "1pcxoudKwc6IT8OJD37jJLbetmFHBVJJVohp7XAIguQ=",
                      1000
                    ],
                    "trigger": {
                      "timeTrigger": {
                        "initial": "1715968124",
                        "every": "60"
                      }
                    },
                    "requiredConfirmations": "3",
                    "filters": [
                      {
                        "key": {
                          "name": "pepe.price",
                          "type": "TYPE_INTEGER",
                          "numberDecimalPlaces": "18"
                        },
                        "conditions": [
                          {
                            "operator": "OPERATOR_GREATER_THAN",
                            "value": "0"
                          }
                        ]
                      }
                    ],
                    "normalisers": [
                      {
                        "name": "pepe.price",
                        "expression": "$[0]"
                      }
                    ],
                    "sourceChainId": "100"
                  }
                }
              },
              "status": "STATUS_UNSPECIFIED"
            },
            "dataSourceSpecBinding": {
              "settlementDataProperty": "pepe.price",
              "settlementScheduleProperty": "vegaprotocol.builtin.timetrigger"
            },
            "fundingRateScalingFactor": "1",
            "fundingRateLowerBound": "-0.001",
            "fundingRateUpperBound": "0.001",
            "internalCompositePriceConfig": {
              "decayWeight": "1",
              "decayPower": "1",
              "cashAmount": "50000000",
              "sourceWeights": [
                "0",
                "0.999",
                "0.001",
                "0"
              ],
              "sourceStalenessTolerance": [
                "1m0s",
                "1m0s",
                "10m0s",
                "10m0s"
              ],
              "compositePriceType": "COMPOSITE_PRICE_TYPE_WEIGHTED",
              "dataSourcesSpec": [
                {
                  "external": {
                    "ethOracle": {
                      "address": "0x2BA6654FdB605637994047ecA217a02E224c4828",
                      "abi": "[{\"inputs\": [{\"internalType\": \"bytes32\", \"name\": \"id\", \"type\": \"bytes32\"}, {\"internalType\": \"int32\", \"name\": \"multiplier\", \"type\": \"int32\"}], \"name\": \"getPrice\", \"outputs\": [{\"internalType\": \"int256\", \"name\": \"\", \"type\": \"int256\" }], \"stateMutability\": \"view\", \"type\": \"function\"}]",
                      "method": "getPrice",
                      "args": [
                        "1pcxoudKwc6IT8OJD37jJLbetmFHBVJJVohp7XAIguQ=",
                        1000
                      ],
                      "trigger": {
                        "timeTrigger": {
                          "every": "60"
                        }
                      },
                      "requiredConfirmations": "3",
                      "filters": [
                        {
                          "key": {
                            "name": "pepe.price",
                            "type": "TYPE_INTEGER",
                            "numberDecimalPlaces": "18"
                          },
                          "conditions": [
                            {
                              "operator": "OPERATOR_GREATER_THAN",
                              "value": "0"
                            }
                          ]
                        }
                      ],
                      "normalisers": [
                        {
                          "name": "pepe.price",
                          "expression": "$[0]"
                        }
                      ],
                      "sourceChainId": "100"
                    }
                  }
                }
              ],
              "dataSourcesSpecBinding": [
                {
                  "priceSourceProperty": "pepe.price"
                }
              ]
            }
          }
        },
        "marginCalculator": {
          "scalingFactors": {
            "searchLevel": 1.1,
            "initialMargin": 1.5,
            "collateralRelease": 1.7
          }
        },
        "logNormalRiskModel": {
          "riskAversionParameter": 0.000001,
          "tau": 0.0000071,
          "params": {
            "mu": 0,
            "r": 0,
            "sigma": 1.5
          }
        }
      },
      "decimalPlaces": "7",
      "fees": {
        "factors": {
          "makerFee": "0.0002",
          "infrastructureFee": "0.0005",
          "liquidityFee": "0.05"
        },
        "liquidityFeeSettings": {
          "method": "METHOD_MARGINAL_COST"
        }
      },
      "openingAuction": {
        "duration": "60",
        "volume": "0"
      },
      "priceMonitoringSettings": {
        "parameters": {
          "triggers": [
            {
              "horizon": "21600",
              "probability": "0.9999999",
              "auctionExtension": "90"
            },
            {
              "horizon": "4320",
              "probability": "0.9999999",
              "auctionExtension": "80"
            },
            {
              "horizon": "1440",
              "probability": "0.9999999",
              "auctionExtension": "60"
            },
            {
              "horizon": "360",
              "probability": "0.9999999",
              "auctionExtension": "30"
            }
          ]
        }
      },
      "liquidityMonitoringParameters": {
        "targetStakeParameters": {
          "timeWindow": "3600",
          "scalingFactor": 0.05
        },
        "triggeringRatio": "",
        "auctionExtension": "0"
      },
      "tradingMode": "TRADING_MODE_MONITORING_AUCTION",
      "state": "STATE_SUSPENDED",
      "marketTimestamps": {
        "proposed": "1715957479400309315",
        "pending": "1715957729000000000",
        "open": "1715957825492364505",
        "close": "0"
      },
      "positionDecimalPlaces": "-3",
      "lpPriceRange": "",
      "linearSlippageFactor": "0.001",
      "quadraticSlippageFactor": "0",
      "liquiditySlaParams": {
        "priceRange": "0.005",
        "commitmentMinTimeFraction": "0.5",
        "performanceHysteresisEpochs": "0",
        "slaCompetitionFactor": "1"
      },
      "liquidationStrategy": {
        "disposalTimeStep": "1",
        "disposalFraction": "1",
        "fullDisposalSize": "1000000",
        "maxFractionConsumed": "0.1",
        "disposalSlippageRange": "1"
      },
      "markPriceConfiguration": {
        "decayWeight": "1",
        "decayPower": "1",
        "cashAmount": "0",
        "sourceWeights": [
          "0",
          "0",
          "1",
          "0"
        ],
        "sourceStalenessTolerance": [
          "1m0s",
          "1m0s",
          "1m0s",
          "1m0s"
        ],
        "compositePriceType": "COMPOSITE_PRICE_TYPE_WEIGHTED",
        "dataSourcesSpec": [
          {
            "external": {
              "ethOracle": {
                "address": "0x2BA6654FdB605637994047ecA217a02E224c4828",
                "abi": "[{\"inputs\": [{\"internalType\": \"bytes32\", \"name\": \"id\", \"type\": \"bytes32\"}, {\"internalType\": \"int32\", \"name\": \"multiplier\", \"type\": \"int32\"}], \"name\": \"getPrice\", \"outputs\": [{\"internalType\": \"int256\", \"name\": \"\", \"type\": \"int256\" }], \"stateMutability\": \"view\", \"type\": \"function\"}]",
                "method": "getPrice",
                "args": [
                  "1pcxoudKwc6IT8OJD37jJLbetmFHBVJJVohp7XAIguQ=",
                  1000
                ],
                "trigger": {
                  "timeTrigger": {
                    "every": "60"
                  }
                },
                "requiredConfirmations": "3",
                "filters": [
                  {
                    "key": {
                      "name": "pepe.price",
                      "type": "TYPE_INTEGER",
                      "numberDecimalPlaces": "18"
                    },
                    "conditions": [
                      {
                        "operator": "OPERATOR_GREATER_THAN",
                        "value": "0"
                      }
                    ]
                  }
                ],
                "normalisers": [
                  {
                    "name": "pepe.price",
                    "expression": "$[0]"
                  }
                ],
                "sourceChainId": "100"
              }
            }
          }
        ],
        "dataSourcesSpecBinding": [
          {
            "priceSourceProperty": "pepe.price"
          }
        ]
      },
      "tickSize": "100"
    },

Asset is the following


    {
      "id": "c9fe6fc24fce121b2cc72680543a886055abb560043fda394ba5376203b7527d",
      "details": {
        "name": "tUSDC Fairground",
        "symbol": "tUSDC",
        "decimals": "6",
        "quantum": "1",
        "erc20": {
          "contractAddress": "0x40ff2D218740EF033b43B8Ce0342aEBC81934554",
          "lifetimeLimit": "0",
          "withdrawThreshold": "0",
          "chainId": "11155111"
        }
      },
      "status": "STATUS_ENABLED"
    },

Relevant log output

No response

@daniel1302 daniel1302 added the bug label May 20, 2024
@vega-issues vega-issues moved this to Waiting Review in Core Kanban May 20, 2024
@ze97286 ze97286 self-assigned this May 20, 2024
@daniel1302 daniel1302 changed the title [Bug]: Proce is zero for market with decimal places bigger than asset decimals [Bug]: Price is zero for market with decimal places bigger than asset decimals May 20, 2024
@vega-issues vega-issues moved this from Waiting Review to Approved in Core Kanban May 20, 2024
@github-project-automation github-project-automation bot moved this from Approved to Merged in Core Kanban May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants