Skip to content

Fail to use network_id 420 #62

@huytuong010101

Description

@huytuong010101

Thank you for your repo,
I want to connect to testnet network then get price history and open-close position, but I got this error, can anyone help me fix that?
Code:

from kwenta import Kwenta

kwenta = Kwenta(
    network_id=420,
    provider_rpc="https://opt-goerli.g.alchemy.com/v2/...",
    wallet_address="0x...",
    private_key="0x..."
)

Error:

Traceback (most recent call last):
  File "test.py", line 3, in <module>
    kwenta = Kwenta(
  File "/home/tuongnh/miniconda3/envs/trade/lib/python3.8/site-packages/kwenta/kwenta.py", line 72, in __init__
    ) = self._load_markets()
  File "/home/tuongnh/miniconda3/envs/trade/lib/python3.8/site-packages/kwenta/kwenta.py", line 183, in _load_markets
    results = list(executor.map(self._load_market, allmarketsdata))
  File "/home/tuongnh/miniconda3/envs/trade/lib/python3.8/concurrent/futures/_base.py", line 619, in result_iterator
    yield fs.pop().result()
  File "/home/tuongnh/miniconda3/envs/trade/lib/python3.8/concurrent/futures/_base.py", line 444, in result
    return self.__get_result()
  File "/home/tuongnh/miniconda3/envs/trade/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
  File "/home/tuongnh/miniconda3/envs/trade/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/tuongnh/miniconda3/envs/trade/lib/python3.8/site-packages/kwenta/kwenta.py", line 116, in _load_market
    addresses["PerpsV2MarketSettings"][self.network_id]
KeyError: 420

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions