stefan-jansen / machine-learning-for-trading

Code for Machine Learning for Algorithmic Trading, 2nd edition.
https://ml4trading.io
12.57k stars 4.03k forks source link

01_parse_itch_order_flow_messages #306

Open BasselCapm opened 10 months ago

Eating-Sulfur commented 10 months ago

Why do I still get these emails? Anyone has a clue?

On Tue, 19 Sept 2023, 18:27 BasselCapm, @.***> wrote:

file_name = may_be_download(urljoin(FTP_URL, SOURCE_FILE)) date = file_name.name.split('.')[0]

URLError: <urlopen error ftp error: TimeoutError(10060, 'A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond', None, 10060, None)>

— Reply to this email directly, view it on GitHub https://github.com/stefan-jansen/machine-learning-for-trading/issues/306, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALK6ZBMNDPH3TEWKYLM73DX3HBVZANCNFSM6AAAAAA46SP33E . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Yunbo-max commented 10 months ago

KeyError Traceback (most recent call last) /Users/yunbo-max/Desktop/CUATS/machine-learning-for-trading/02_market_and_fundamental_data/01_NASDAQ_TotalView-ITCH_Order_Book/01_parse_itch_order_flow_messages.ipynb Cell 81 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 ~/anaconda3/envs/Cambridge/lib/python3.10/site-packages/pandas/io/pytables.py:596, in HDFStore.getitem(self, key) 595 def getitem(self, key: str): --> 596 return self.get(key)

File ~/anaconda3/envs/Cambridge/lib/python3.10/site-packages/pandas/io/pytables.py:790, in HDFStore.get(self, key) 788 group = self.get_node(key) 789 if group is None: --> 790 raise KeyError(f"No object named {key} in the file") 791 return self._read_group(group)

KeyError: 'No object named P in the file'.

Why this error shows all the time

Impesud commented 7 months ago

Hi! I put the the solution here: https://github.com/Impesud/machine-learning-for-trading/blob/main/02_market_and_fundamental_data/01_NASDAQ_TotalView-ITCH_Order_Book/01_parse_itch_order_flow_messages.ipynb

View "Impesud Note" rows.