import requests
res = requests.get('https://api.bittrex.com/api/v1.1/public/getmarkets').json()['result']
for i in res:
print(i['MarketCurrency'])
print(i['BaseCurrency'])
print(i['MarketCurrencyLong'])
print(i['BaseCurrencyLong'])
print(i['MinTradeSize'])
print(i['MarketName'])
print(i['Created'])
print('-------------------')
data = '''{
"success": true,
"message": "''",
"result": [
{
"MarketCurrency": "LTC",
"BaseCurrency": "BTC",
"MarketCurrencyLong": "Litecoin",
"BaseCurrencyLong": "Bitcoin",
"MinTradeSize": 0.01,
"MarketName": "BTC-LTC",
"IsActive": true,
"IsRestricted": false,
"Created": "2014-02-13T00:00:00",
"Notice": "BTC-LTC",
"IsSponsored": false,
"LogoUrl": "https://storage.blob.core.windows.net/public/8637ccad-9e7f-45ac-8f03-a41b440e3911.png"
}
]
}'''
import json
all_data = json.loads(data)
my_data = all_data['result'][0]
for key, value in my_data.items():
if 'Currency' in key:
print (value)
import requests #библиотека для чтения запросов
response = requests.get('https://1234.com/public', params=params) #запрос к api
workrequest = response.json() #забираем json из запроса. Обычно там список что то подобное
sql_json = [] #создаем свой список (list) пустой
#циклом забираем данные в своей список.
for i in range(len(workrequest)):
sql_json.append(workrequest[i]['globalTradeID'])
sql_json.append(workrequest[i]['tradeID'])
upgradata_str = workrequest[i]['date']
sql_json.append(updateloghourse(upgradata_str))
sql_json.append(workrequest[i]['type'])
sql_json.append(workrequest[i]['rate'])
sql_json.append(workrequest[i]['amount'])
sql_json.append(workrequest[i]['total'])
sqlADDinfoTable(sql_json,name_table) # В моем случае я отправляю данные сразу в таблицу SQL
sql_json.clear() #Очищаю список для новой итерации цикла.
arr[i] % 0 +`${s}`+ 0
function getSameParity(arr){
const newArr = [];
let s = arr[0] % 2;
for(let i = 0; i < arr.length; i += 1){
if(arr[i] % 2 === s){
newArr.push(arr[i]);
}
}
return newArr;
}
console.log(getSameParity([3, 6, 7, 8])) // [3, 7]
console.log(getSameParity([4, 6, 7, 8])) // [4, 6, 8]
const getSameParity = arr => arr.filter(v => v % 2 === arr[0] % 2)