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

oracle provider error #31

Closed teehanming closed 2 years ago

teehanming commented 2 years ago
Traceback (most recent call last):
  File "/app/bin/marketmaker", line 149, in <module>
    oracle_provider: mango.OracleProvider = mango.create_oracle_provider(context, args.oracle_provider)
  File "/app/mango/oraclefactory.py", line 45, in create_oracle_provider
    raise Exception(f"Unknown oracle provider '{proper_provider_name}'.")

Already tried with 3 different oracle, result come with same error

OpinionatedGeek commented 2 years ago

I'm afraid there really isn't enough information here to help you. Can you please let me know either:

Without knowing either of those things, I can't really help. The code will give that stack trace if you try to use a provider that doesn't exist, but until you let me know what you tried I won't know if that's what happened.

teehanming commented 2 years ago

I follow the tutorial from: https://github.com/blockworks-foundation/mango-explorer/blob/main/docs/MarketmakingQuickstart.md#11--start-the-marketmaker

command used from: https://github.com/blockworks-foundation/mango-explorer/blob/main/docs/MarketmakingQuickstart.md#11--start-the-marketmaker

Command used: Oracle pyth

mango-explorer marketmaker --name "BTC-PERP Marketmaker" --market BTC-PERP --oracle-provider pyth --confidenceinterval-position-size-ratio 0.1 --minimumcharge-ratio 0 --confidenceinterval-level 2 --confidenceinterval-level 4 --existing-order-tolerance 0.0001 --pulse-interval 30 --order-type POST_ONLY --biasquoteonposition-bias 0.00003 --log-level DEBUG --cluster-name devnet --dry-run

Oracle serum

mango-explorer marketmaker --name "BTC-PERP Marketmaker" --market BTC-PERP --oracle-provider serum --confidenceinterval-position-size-ratio 0.1 --minimumcharge-ratio 0 --confidenceinterval-level 2 --confidenceinterval-level 4 --existing-order-tolerance 0.0001 --pulse-interval 30 --order-type POST_ONLY --biasquoteonposition-bias 0.00003 --log-level DEBUG --cluster-name devnet --dry-run

Oracle for ftx works fine.

Full output:

2022-01-20 09:04:24 โš  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

2022-01-20 09:04:24 ๐Ÿ› root         marketmaker arguments:
    --account_address None
    --afteraccumulateddepth_adjustment_ticks 1
    --afteraccumulateddepth_depth None
    --biasquantityonposition_maximum_position None
    --biasquantityonposition_target_position None
    --biasquote_factor None
    --biasquoteonposition_bias [Decimal('0.00003')]
    --blockhash_cache_duration None
    --chain []
    --cluster_name devnet
    --cluster_url []
    --commitment None
    --confidenceinterval_level [Decimal('2'), Decimal('4')]
    --confidenceinterval_position_size_ratio 0.1
    --dry_run True
    --encoding None
    --existing_order_tolerance 0.0001
    --fixedpositionsize_value None
    --fixedspread_value None
    --gma_chunk_pause None
    --gma_chunk_size None
    --group_address None
    --group_name None
    --hedging_action_threshold 0
    --hedging_market None
    --hedging_max_chunk_quantity 0
    --hedging_max_price_slippage_factor 0.05
    --hedging_target_balance None
    --id_file id.json
    --log_level 10
    --log_suppress_timestamp False
    --mango_program_address None
    --market BTC-PERP
    --maximumquantity_remove False
    --maximumquantity_size None
    --minimumcharge_from_bid_ask False
    --minimumcharge_ratio [Decimal('0')]
    --minimumquantity_remove False
    --minimumquantity_size 1
    --name BTC-PERP Marketmaker
    --notify_errors []
    --oracle_market None
    --oracle_provider pyth
    --order_type POST_ONLY
    --output_format TEXT
    --pulse_interval 30
    --quotesingleside_side None
    --ratios_from_bid_ask False
    --ratios_position_size None
    --ratios_spread None
    --redeem_threshold None
    --serum_program_address None
    --skip_preflight False
    --stale_data_maximum_retries None
    --stale_data_pause_before_retry None
    --token_data_file /app/data/solana.tokenlist.json
    --topofbook_adjustment_ticks 1
    --update_mode POLL
2022-01-20 09:04:24 ๐Ÿ› root         Version: ยซ PackageVersion Unknown - '' ยป
2022-01-20 09:04:24 ๐Ÿ› root         ยซ Context 'BTC-PERP Marketmaker':
    Cluster Name: devnet
    Cluster URLs:
        https://mango.devnet.rpcpool.com
    Group Name: devnet.2
    Group Address: Ec2enZyoC4nGpEfu2sUNAa2nUGJHWxoUWYSEJ2hNTWTA
    Mango Program Address: 4skJ85cdxQAFVKbcGgfun8iZPL7BadVYXG3kGEGkufqA
    Serum Program Address: DESVgJVGajEgKGXhb6XmqDHGz3VjdgP7rEVESBgxmroY
ยป
2022-01-20 09:04:24 ๐Ÿ› RPCCaller    getAccountInfo() data is from slot: 109031341
2022-01-20 09:04:24 ๐Ÿ› SlotHolder   Only accepting data from slot 109031341 onwards now.
2022-01-20 09:04:25 ๐Ÿ› RPCCaller    getAccountInfo() data is from slot: 109031341
2022-01-20 09:04:25 ๐Ÿ› RPCCaller    getAccountInfo() data is from slot: 109031342
2022-01-20 09:04:25 ๐Ÿ› SlotHolder   Only accepting data from slot 109031342 onwards now.
2022-01-20 09:04:25 ๐Ÿ› RPCCaller    getAccountInfo() data is from slot: 109031342
2022-01-20 09:04:25 โ“˜ root         Desired orders chain: ยซ Chain of 5 elements:
    ยซ ConfidenceIntervalElement POST_ONLY - position size: 0.1, confidence interval levels: 2, 4 ยป
    ยซ MinimumChargeElement - minimum charge ratios: [Decimal('0')] ยป
    ยซ BiasQuoteOnPositionElement - biases: [Decimal('0.00003')] ยป
    ยซ PreventPostOnlyCrossingBookElement ยป
    ยซ ๐š๐š˜๐šž๐š—๐š๐šƒ๐š˜๐™ป๐š˜๐š๐š‚๐š’๐šฃ๐šŽ๐™ด๐š•๐šŽ๐š–๐šŽ๐š—๐š ยป
ยป
2022-01-20 09:04:25 ๐Ÿ› RPCCaller    getAccountInfo() data is from slot: 109031342
2022-01-20 09:04:25 ๐Ÿ› RPCCaller    getMultipleAccounts() data is from slot: 109031343
2022-01-20 09:04:25 ๐Ÿ› SlotHolder   Only accepting data from slot 109031343 onwards now.
Traceback (most recent call last):
  File "/app/bin/marketmaker", line 154, in <module>
    raise Exception(f"Could not find oracle for market {oracle_market.symbol} from provider {args.oracle_provider}.")
Exception: Could not find oracle for market BTC-PERP from provider pyth.

Using serum as oracle came out the same error:

Traceback (most recent call last):
  File "/app/bin/marketmaker", line 149, in <module>
    oracle_provider: mango.OracleProvider = mango.create_oracle_provider(context, args.oracle_provider)
  File "/app/mango/oraclefactory.py", line 45, in create_oracle_provider
    raise Exception(f"Unknown oracle provider '{proper_provider_name}'.")
Exception: Unknown oracle provider 'SERUM'.
OpinionatedGeek commented 2 years ago

Excellent info - thanks!

There are a few things going on. 'pyth' should work as an oracle provider, but doesn't on devnet because pyth changed their naming convention for markets. I have a fix for this in the code but it isn't in a release yet (maybe later today?) Pyth on devnet hasn't been too reliable lately anyway - yesterday it was quoting prices ten times higher than reality because one of their data providers had a faulty exponent.

You could try using 'pyth-mainnet' as the oracle provider. That should load pyth prices from mainnet rather than devnet.

'serum' as an oracle provider won't work because it was renamed 'market' and the Quickstart wasn't updated. Sorry about that. 'market' should work.

Apologies.

teehanming commented 2 years ago

I see, thank you for the explanation