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

How to get investing_id by the ticker? #3

Closed
vpozdnyakov opened this issue Oct 3, 2022 · 2 comments
Closed

How to get investing_id by the ticker? #3

vpozdnyakov opened this issue Oct 3, 2022 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@vpozdnyakov
Copy link

Hi there! Could you explain how to get investing_id by the ticker? For example, how to get the historical data of GOOGL in NASDAQ exchange from 09/01/2022 to 10/01/2022?

@alvarobartt
Copy link
Owner

Hi @vpozdnyakov, so currently there are 2 ways:

  • Via investpy as it follows:

    from pathlib import Path
    import pandas as pd
    import investpy
    import investing
    
    path = Path(investpy.__path__[0])
    path = path / "resources" / "stocks.csv" # Could be any file listed under "investpy/resources/*.csv"
    
    df = pd.read_csv(path)
    investing_id = df.loc[df["symbol"] == "GOOGL") & (df["country"] == "united states")].id.values[0]
    
    data = investiny.historical_data(investing_id=investing_id, from_date="09/01/2022", to_date="10/01/2022")
    print(data)
  • Manually through Investing.com

    1. Go to Investing.com and look for the asset that you want e.g. GOOGL at https://www.investing.com/equities/google-inc
    2. Open your Web Browser's inspect tool so as to check the Network
    3. Navigate to the "Historical Data" tab there, or just add historical-data to the URL e.g. GOOGL at https://www.investing.com/equities/google-inc-historical-data
    4. Filter the network traffic to just see api.investing.com queries
    5. Once filtered, you just need to look for the ID which is part of the https://api.investing.com/api/financialdata/historical/<INVESTING_ID> endpoint

    image

@alvarobartt
Copy link
Owner

FYI I'm planning to add a function to automatically retrieve those using investiny, I'm just exploring different options so as to see which is the best way possible.

Also remember to share this with others if interested, and to star the repository. Thanks for your patience! 🤗

@alvarobartt alvarobartt self-assigned this Oct 14, 2022
@alvarobartt alvarobartt added the question Further information is requested label Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants