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

Fail to use network_id 420 #62

Open
huytuong010101 opened this issue Dec 29, 2023 · 0 comments
Open

Fail to use network_id 420 #62

huytuong010101 opened this issue Dec 29, 2023 · 0 comments

Comments

@huytuong010101
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant