A
A
antei132020-02-18 00:55:02
Parsing
antei13, 2020-02-18 00:55:02

How to get the desired element with json after sending a get request?

import  json
import  requests
pair = 'BTC/UAH'
side = 'baying'
response = requests.get('https://richamster.com/public/v1/exchange/order-book',
                        params= { 'pair' : pair,
                                  'side' : side,
                                  }
                        )

data = response.json()
print (data)

concocted some kind of crutch.
but you need to parse the desired price from the exchange, according to several parameters and display it.
that is, you need to calculate the desired "unit_price" when the sum "sum" is greater than x

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
antei13, 2020-02-19
@antei13

The server response contains purchase requests with keys - the price "unit_price" and the purchase amount "sum", you need to find out what the price "unit_price" will be if the sum "sum" becomes more equal to, for example, 1000, while you need to filter by additional parameters - by one of the pairs ,'BTC/UAH','ETH/UAH'..... and by type 'baying' or 'selling'.
Of course I would like the code in python.
Thank you FRIENDS)))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question