Reputation: 71
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')
Upvotes: 1
Views: 254
Reputation: 195573
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
Upvotes: 2