1

Do you know how can I scrape the values on the chart data on this page in python? Is it possible or not feasible?

https://platform.napbots.com/strategyDetails/STRAT_BTC_USD_D_2_V2

import requests 
from bs4 import BeautifulSoup
import pandas as pd
import re


url = 'https://platform.napbots.com/strategyDetails/STRAT_BTC_USD_D_2_V2'
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
3
  • What data do you need from that page? Commented Mar 30, 2021 at 18:52
  • The values on the chart Commented Mar 30, 2021 at 20:21
  • FYI it's scrape (and scraping, scraped, scraper) not scrap Commented Apr 22, 2021 at 13:18

1 Answer 1

2

The data you see in chart is loaded from external URL. You can use this example how to load it:

import json
import requests


url = "https://middle.napbots.com/v1/strategy/details/STRAT_BTC_USD_D_2_V2"
data = requests.get(url).json()

# uncomment this to print all data:
# print(json.dumps(data, indent=4))

for d in data["data"]["performance"]["quotes"]["NapoX BTC AR daily"]:
    print(d["date"], d["last"])

Prints:

...
2021-03-24 8090496.4614
2021-03-25 8090496.4614
2021-03-26 8090496.4614
2021-03-27 7971715.2932
2021-03-28 7959911.2069
2021-03-29 8223204.2625
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you, amazing, how can I find the external url by myself on the other strategies?
@Ricdm Look at Firefox developer tools->Network tab (or something similar in Chrome). There are all requests that the page is doing - including to external urls

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.