marketwatchdata
ohlc(code, timeframe, timerange)
retrieve ohlc data
import marketwatchdata as mw
df = mw.ohlc('STOCK/US/XNAS/AAPL', 'P1D', 'P1Y')
print(df)
open high low close volume
date
2022-07-21 154.500 155.5700 151.940 155.35 65086641.0
2022-07-22 155.390 156.2800 153.410 154.09 66675406.0
2022-07-25 154.010 155.0400 152.280 152.95 53623953.0
2022-07-26 152.265 153.0850 150.800 151.60 55138688.0
2022-07-27 152.580 157.3300 152.160 156.79 78620688.0
... ... ... ... ... ...
2023-07-14 190.230 191.1799 189.630 190.69 41616238.0
2023-07-17 191.900 194.3200 191.810 193.99 50520160.0
2023-07-18 193.350 194.3300 192.415 193.73 48353770.0
2023-07-19 193.100 198.2300 192.650 195.10 80507320.0
2023-07-20 195.090 196.4700 192.495 193.13 59581196.0
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code |
str
|
code of an instrument, eg: STOCK/US/XNAS/AAPL | TMUBMUSD10Y |
required |
timeframe |
str
|
P1D | P1W |
required |
timerange |
str
|
P1M P1Y P2Y All |
required |
Returns:
| Type | Description |
|---|---|
pd.DataFrame
|
pandas.dataframe |