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

Error in the last line of code 01_parse_itch_order_flow_messages.ipynb #330

Open
adanog opened this issue Nov 10, 2024 · 0 comments
Open

Comments

@adanog
Copy link

adanog commented Nov 10, 2024

Describe the bug

KeyError Traceback (most recent call last)
Cell In[32], line 3
1 with pd.HDFStore(itch_store) as store:
2 stocks = store['R'].loc[:, ['stock_locate', 'stock']]
----> 3 trades = store['P'].append(store['Q'].rename(columns={'cross_price': 'price'}), sort=False).merge(stocks)
5 trades['value'] = trades.shares.mul(trades.price)
6 trades['value_share'] = trades.value.div(trades.value.sum())

File /opt/anaconda3/envs/stocks-env/lib/python3.12/site-packages/pandas/io/pytables.py:602, in HDFStore.getitem(self, key)
601 def getitem(self, key: str):
--> 602 return self.get(key)

File /opt/anaconda3/envs/stocks-env/lib/python3.12/site-packages/pandas/io/pytables.py:812, in HDFStore.get(self, key)
810 group = self.get_node(key)
811 if group is None:
--> 812 raise KeyError(f"No object named {key} in the file")
813 return self._read_group(group)

KeyError: 'No object named P in the file'

To Reproduce

  • In case you are not running the current version of the notebook/script as found on GitHub.

Steps to reproduce the behavior:

  1. Go to 01_parse_itch_order_flow_messages.ipynb'
  2. Scroll down to '6.2. Top Equities by Traded Value'
  3. Run the code bellow
  4. See error

Expected behavior

Must plot

Add any other context about the problem here.

The error message “No object named ‘P’ in the file” indicates that the key 'P' is not present in the HDF5 file. This key represents a dataset or a group in the file that is expected by your script but does not exist in the file structure.

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