Untitled

 avatar
unknown
python
a month ago
559 B
3
Indexable
from yahooquery import Ticker
import pandas as pd

# ✅ Tencent (0700.HK) scrape from Yahoo Finance
symbol = "0700.HK"
stock = Ticker(symbol)

# ✅ save price history to CSV
df = stock.history(period="max")
df.reset_index(inplace=True)

# ✅ colunms names
df.rename(columns={
    "date": "Date",
    "open": "Open",
    "high": "High",
    "low": "Low",
    "close": "Close",
    "volume": "Volume"
}, inplace=True)

# ✅ CSV save to file
df.to_csv("tencent_stock_yahoo.csv", index=False)
print("\n✅ Tencent stock saved as CSV with Yahoo Finance API!")
Editor is loading...
Leave a Comment