I'd like to make a trading bot. We use JSON data to get the average price I'd like to calculate the margin of error of the price.
I'm still studying. More than anything else, First of all, the part where there' I'd like to convert JSON data into a list form and make it calculate with other variables. Then I wonder how to organize it.
Ezero, From the
python api json
import requests # It is not a standard module, so it needs to be installed separately
response = requests.get('http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20(%22USDKRW%22)&format=json&env=store://datatables.org/alltableswithkeys&callback=')
financeData = response.json()
financeData
{'query': {'count': 1,
'created': '2017-05-12T01:40:27Z',
'lang': 'en-US',
'results': {'rate': {'Ask': '1128.7700',
'Bid': '1127.7700',
'Date': '5/11/2017',
'Name': 'USD/KRW',
'Rate': '1127.7700',
'Time': '4:28pm',
'id': 'USDKRW'}}}}
financeData['query']['results']['rate']['Bid']
Out[19]: '1127.7700'
© 2024 OneMinuteCode. All rights reserved.