blockworks-foundation / mango-explorer

A project to explore and provide useful code for Mango Markets (https://mango.markets/).
MIT License
155 stars 87 forks source link

health-check error:Exception: Could not find market for spot token ADA. #41

Closed foonsun closed 2 years ago

foonsun commented 2 years ago

Hi Team, I run the ./show-health in the bin directory. It shows the errors below. Mango has no ADA/USDC spot market,however, it seems still checks the ADA spot market. pls help fix it. thanks.


2022-02-08 17:00:43 ⚠ root         
⚠ WARNING ⚠

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    🥭 Mango Markets: https://mango.markets
    📄 Documentation: https://docs.mango.markets/
    💬 Discord: https://discord.gg/67jySBhxrg
    🐦 Twitter: https://twitter.com/mangomarkets
    🚧 Github: https://github.com/blockworks-foundation
    📧 Email: mailto:hello@blockworks.foundation

Traceback (most recent call last):
  File "/Users/foonsun/works/mango-explorer/bin/./show-health", line 51, in <module>
    mango.output("Health", health_calculator.calculate(mango_account, spot_open_orders, group, cache))
  File "/opt/anaconda3/envs/driftenv/lib/python3.9/site-packages/mango/calculators/healthcalculator.py", line 157, in calculate
    raise Exception(f"Could not find market for spot token {priced_report.base_token.symbol}.")
Exception: Could not find market for spot token ADA.

My account scout log is below:

2022-02-08 16:56:37 ⓘ root         Address: 8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag
« ScoutReport [8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag]:
    Summary:
        Found 13 error(s) and 0 warning(s).

    Errors:
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'MNGO'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'BTC'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'ETH'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'SOL'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'USDT'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'SRM'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'RAY'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'COPE'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'FTT'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'MSOL'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'BNB'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'AVAX'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'LUNA'.

    Warnings:
        None

    Details:
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has 1 USDC token account(s): [AztsQ8K4MfDzL3AXgjV4n5ymt6WmqGqjztcEW6ZRugbD]
        Margin account: « Account (un-named), Version.V3 [GUM8tdeVsKzKaBns828SgNbeA3i5oBQMZarutukZsVJt]
            « Metadata Version.V2 - Account: Initialized »
            Owner: 8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag
            Delegated To: None
            Group: « Group 'mainnet.1' [98pjRuQjK3qA6gXts96PqZT4Ze5QmnCmt3QYjhbUSPue] »
            Advanced Orders Account: None
            MSRM: 0
            Bankrupt? False
            Upgradable? True
            Being Liquidated? False
            Shared Quote Token:
                « AccountSlot [15] USDC
                    Net Value:     « InstrumentValue:       679.80051715 USDC »
                        Deposited: « InstrumentValue:       679.80051715 USDC » (raw value: 657.72375935230919452579)
                        Borrowed:  « InstrumentValue:         0.00000000 USDC » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        None
                »
            In Basket: MNGO, BTC, ETH, SOL, USDT, SRM, RAY, COPE, FTT, ADA, MSOL, BNB, AVAX, LUNA
            Basket [14 in basket]:
                « AccountSlot [0] MNGO
                    Net Value:     « InstrumentValue:         0.00000000 MNGO »
                        Deposited: « InstrumentValue:         0.00000000 MNGO » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 MNGO » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [1] BTC
                    Net Value:     « InstrumentValue:         0.00000000 BTC »
                        Deposited: « InstrumentValue:         0.00000000 BTC » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 BTC » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [2] ETH
                    Net Value:     « InstrumentValue:         0.00000000 ETH »
                        Deposited: « InstrumentValue:         0.00000000 ETH » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 ETH » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [3] SOL
                    Net Value:     « InstrumentValue:         0.60000928 SOL »
                        Deposited: « InstrumentValue:         0.60000928 SOL » (raw value: 599.26469950687738474926)
                        Borrowed:  « InstrumentValue:         0.00000000 SOL » (raw value 0E-20)
                    Spot OpenOrders: 2gWc3qrroPFMsF1BGwnamTUb1RtMggWXWcsSytAVUoAc
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [4] USDT
                    Net Value:     « InstrumentValue:         0.00000000 USDT »
                        Deposited: « InstrumentValue:         0.00000000 USDT » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 USDT » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [5] SRM
                    Net Value:     « InstrumentValue:         0.00000000 SRM »
                        Deposited: « InstrumentValue:         0.00000000 SRM » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 SRM » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [6] RAY
                    Net Value:     « InstrumentValue:         0.00000000 RAY »
                        Deposited: « InstrumentValue:         0.00000000 RAY » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 RAY » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [7] COPE
                    Net Value:     « InstrumentValue:         0.00000000 COPE »
                        Deposited: « InstrumentValue:         0.00000000 COPE » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 COPE » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [8] FTT
                    Net Value:     « InstrumentValue:         0.00000000 FTT »
                        Deposited: « InstrumentValue:         0.00000000 FTT » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 FTT » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [9] ADA
                    Net Value:     « InstrumentValue:         0.00000000 Cardano »
                        Deposited: « InstrumentValue:         0.00000000 Cardano » (raw value: 0)
                        Borrowed:  « InstrumentValue:         0.00000000 Cardano » (raw value 0)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount
                            Base Position: « InstrumentValue:         0.00000000 Cardano »
                            Quote Position: 0E-20
                            Long Settled Funding: 0E-20
                            Short Settled Funding: 0E-20
                            Bids Quantity: 1
                            Asks Quantity: 0
                            Taker Base: 0
                            Taker Quote: 0
                            MNGO Accrued: « InstrumentValue:         0.00000000 MNGO »
                            OpenOrders:
                                « PerpOpenOrders
                                    Orders:
                                        « PlacedOrder BUY [186330561888540172549656] 1644310038812 »
                                »
                        »
                »
                « AccountSlot [10] MSOL
                    Net Value:     « InstrumentValue:         0.00000000 MSOL »
                        Deposited: « InstrumentValue:         0.00000000 MSOL » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 MSOL » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [11] BNB
                    Net Value:     « InstrumentValue:         0.00000000 BNB »
                        Deposited: « InstrumentValue:         0.00000000 BNB » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 BNB » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [12] AVAX
                    Net Value:     « InstrumentValue:         0.00000000 AVAX »
                        Deposited: « InstrumentValue:         0.00000000 AVAX » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 AVAX » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [13] LUNA
                    Net Value:     « InstrumentValue:         0.00000000 LUNA »
                        Deposited: « InstrumentValue:         0.00000000 LUNA » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 LUNA » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
        »
»
OpinionatedGeek commented 2 years ago

Thanks for raising this. There was a bug in the health calculator that stopped it working if the slot didn't have a spot market, as is the case with ADA.

I've fixed that bug and pushed the code, so it will appear in the next release.

The health calculations are still very much a work-in-progress, so I wouldn't trust the figures they output. You might also be interested in the output of show-account-dataframe (you might need to write it to a file and turn off word-wrapping to see the dataframe table) but it too is a work-in-progress.

foonsun commented 2 years ago

thanks for your help. Health calculator is indeed a big work. I will also pay attention to the health data. thanks.