Kernel: Python 3 (system-wide)
In [21]:
['#RIC',
'Alias Underlying RIC',
'Domain',
'Date-Time',
'GMT Offset',
'Type',
'Price',
'Volume',
'Bid Price',
'Bid Size',
'Ask Price',
'Ask Size',
'Qualifiers']
In [27]:
WARNING: Some output was deleted.
In [39]:
In [29]:
In [16]:
In [26]:
WARNING: Some output was deleted.
In [56]:
In [10]:
Quote-To-Trade Ratio = 1.3898305084745763
In [30]:
0
In [0]:
In [18]:
2602
In [43]:
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-43-c110b6299a4e> in <module>
8 '''
9 path = "/Users/lvcheng/Desktop/HSI.xlsx"
---> 10 df = pd.read_excel(path)
11 df['Date'] = pd.to_datetime(df['Date'], format=None)
12 df = df.set_index('Date')
/usr/local/lib/python3.6/dist-packages/pandas/util/_decorators.py in wrapper(*args, **kwargs)
206 else:
207 kwargs[new_arg_name] = new_arg_value
--> 208 return func(*args, **kwargs)
209
210 return wrapper
/usr/local/lib/python3.6/dist-packages/pandas/io/excel/_base.py in read_excel(io, sheet_name, header, names, index_col, usecols, squeeze, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, verbose, parse_dates, date_parser, thousands, comment, skip_footer, skipfooter, convert_float, mangle_dupe_cols, **kwds)
308
309 if not isinstance(io, ExcelFile):
--> 310 io = ExcelFile(io, engine=engine)
311 elif engine and engine != io.engine:
312 raise ValueError(
/usr/local/lib/python3.6/dist-packages/pandas/io/excel/_base.py in __init__(self, io, engine)
817 self._io = _stringify_path(io)
818
--> 819 self._reader = self._engines[engine](self._io)
820
821 def __fspath__(self):
/usr/local/lib/python3.6/dist-packages/pandas/io/excel/_xlrd.py in __init__(self, filepath_or_buffer)
19 err_msg = "Install xlrd >= 1.0.0 for Excel support"
20 import_optional_dependency("xlrd", extra=err_msg)
---> 21 super().__init__(filepath_or_buffer)
22
23 @property
/usr/local/lib/python3.6/dist-packages/pandas/io/excel/_base.py in __init__(self, filepath_or_buffer)
357 self.book = self.load_workbook(filepath_or_buffer)
358 elif isinstance(filepath_or_buffer, str):
--> 359 self.book = self.load_workbook(filepath_or_buffer)
360 else:
361 raise ValueError(
/usr/local/lib/python3.6/dist-packages/pandas/io/excel/_xlrd.py in load_workbook(self, filepath_or_buffer)
34 return open_workbook(file_contents=data)
35 else:
---> 36 return open_workbook(filepath_or_buffer)
37
38 @property
/usr/local/lib/python3.6/dist-packages/xlrd/__init__.py in open_workbook(filename, logfile, verbosity, use_mmap, file_contents, encoding_override, formatting_info, on_demand, ragged_rows)
109 else:
110 filename = os.path.expanduser(filename)
--> 111 with open(filename, "rb") as f:
112 peek = f.read(peeksz)
113 if peek == b"PK\x03\x04": # a ZIP file
FileNotFoundError: [Errno 2] No such file or directory: '/Users/lvcheng/Desktop/HSI.xlsx'
In [13]:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-13-8a7a200a8ab5> in <module>
27 for transaction in VOD_TAS_Data:
28 security = transaction['#RIC']
---> 29 if transaction['Type'] == 'Mkt. Condition' and 'TRD' in transaction['Qualifiers']:
30 Market_Open[security] = True
31 if transaction['Type'] == 'Trade' and transaction['Volume'] and transaction['Price'] and Market_Open[security]:
KeyError: 'Type'
In [9]:
#RIC | Domain | Date-Time | GMT Offset | Type | Ex/Cntrb.ID | LOC | Price | Volume | Market VWAP | ... | Original Price | Original Volume | Original Seq. No. | Original Exch Time | Trade Price Currency | Unique Trade Identification | Net Change | Original Unique Trade Identification | ISIN | Unique Quote Identification | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | HTSCq.L | Market Price | 2019-11-06T17:30:00.281636801Z | 0 | Quote | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
1 | HTSCq.L | Market Price | 2019-11-06T17:30:00.281636801Z | 0 | Mkt. Condition | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
2 | HTSCq.L | Market Price | 2019-11-07T03:55:00.123212344Z | 0 | Trade | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
3 | HTSCq.L | Market Price | 2019-11-07T08:50:00.054196194Z | 0 | Mkt. Condition | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
4 | HTSCq.L | Market Price | 2019-11-07T08:50:00.055174436Z | 0 | Quote | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
2860 | HTSCq.L | Market Price | 2019-11-07T17:00:00.068136347Z | 0 | Quote | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
2861 | HTSCq.L | Market Price | 2019-11-07T17:00:01.240362477Z | 0 | Quote | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
2862 | HTSCq.L | Market Price | 2019-11-07T17:10:43.258904702Z | 0 | Trade | SINT | NaN | 25.1973 | 100000.0 | NaN | ... | NaN | NaN | NaN | NaN | USD | 1.015517e+18 | NaN | NaN | NaN | NaN |
2863 | HTSCq.L | Market Price | 2019-11-07T17:10:43.331008606Z | 0 | Trade | SINT | NaN | 25.0018 | 100000.0 | NaN | ... | NaN | NaN | NaN | NaN | USD | 1.020021e+18 | NaN | NaN | NaN | NaN |
2864 | HTSCq.L | Market Price | 2019-11-07T17:15:00.081804530Z | 0 | Mkt. Condition | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
2865 rows × 77 columns
In [0]: