api = requests.post(cex_bal,data=params)
symbols = ["BTC_USD","XRP_USD","ETH_USD","BCH_USD"]
def your_function_that_computes_correlation_martrix(x):
data = x.corr(method='pearson')
print(data)
while True:
for symbol in symbols:
base,counter = symbol.split('_')[0],symbol.split('_')[1]
tickers = requests.get(last_price.format(base,counter))
x = tickers.json()
percentage_pairs = x['priceChangePercentage'],x['pair']
y = pd.DataFrame(percentage_pairs).rename(index={0:'Percentage Change',1:'Pair'})
print(your_function_that_computes_correlation_martrix(y))
time.sleep(5)
有人可以帮助我理解为什么我的代码返回一个空数据集吗?另外,我如何将这些数据存储到df中?
•
问答