Код: Выделить всё
coinPair=['ZRX-BTC','AAVE-BTC']
fromDate= date.today() + timedelta(days=-20)
toDate = date.today()
coinPairData = yf.download(coinPair,fromDate,toDate)['Adj Close']
arrayLength = len(coinPairData.values)
baseCurrencyCurrentPrice= coinPairData.values[arrayLength-1][0]
quoteCurrencyCurrentPrice= coinPairData.values[arrayLength-1][1]
Код: Выделить всё
np.float64(0.0017160000279545784) and quote currency price contains the value: np.float64(4.999999873689376e-06). I then tried this:
r1=baseCurrencyCurrentPrice/quoteCurrencyCurrentPrice
Код: Выделить всё
value1=float(0.0017)
value2=float(4.9999)
r1 = value1/value2
Код: Выделить всё
from decimal import *
Код: Выделить всё
baseCurrencyCurrentPrice= Decimal(coinPairData.values[arrayLength-1][0])
quoteCurrencyCurrentPrice= Decimal(coinPairData.values[arrayLength-1][1])
У меня не так много опыта работы с плавающей запятой. количество баллов, поэтому используйте это как возможность узнать больше. Я понимаю, что, возможно, здесь есть что-то фундаментальное, чего я не понимаю.
Подробнее здесь: https://stackoverflow.com/questions/787 ... ong-result