Hello everyone
I have a question: I want to get the price of the first seller in P2P.
For example from this link
I want to create a bot for Telegram that brings the price from p2p to the first seller
Is there an API…
Hello everyone
I have a question: I want to get the price of the first seller in P2P.
For example from this link
I want to create a bot for Telegram that brings the price from p2p to the first seller
Is there an API…
Sorry I don’t think there is an API for that.
This is my code to see the first price in a range of 20 thousand bs in purchase and 1500 bs in sale with banesco payment method, the code is made in python. It also tells you the difference between buying and selling percentage-wise, I hope it helps you. All you have to do is change your model and payment method
import requests
import json
import time
data_buy = {
“proMerchantAds”: False,
“page”: 1,
“rows”: 20,
“transAmount”: 20000,
“payTypes”: [‘Banesco’],
“countries”: ,
“publisherType”: “merchant”,
“asset”: “USDT”,
“fiat”: “VES”,
“tradeType”: “BUY”
}
data_sell = {
“proMerchantAds”: False,
“page”: 1,
“rows”: 20,
“transAmount”: 1500,
“payTypes”: [‘Banesco’],
“countries”: ,
“publisherType”: “merchant”,
“asset”: “USDT”,
“fiat”: “VES”,
“tradeType”: “SELL”
}
while True:
result_buy = requests.post(“https://p2p.binance.com/bapi/c2c/v2/friendly/c2c/adv/search”, json=data_buy)
result_buy = json.loads(result_buy.text)
result_sell = requests.post("https://p2p.binance.com/bapi/c2c/v2/friendly/c2c/adv/search", json=data_sell)
result_sell = json.loads(result_sell.text)
if 'data' in result_buy and result_buy['data']:
price_buy = float(result_buy['data'][0]['adv']['price'])
else:
price_buy = 0
print("No hay datos disponibles para BUY")
if 'data' in result_sell and result_sell['data']:
price_sell = float(result_sell['data'][0]['adv']['price'])
else:
price_sell = 0
print("No hay datos disponibles para SELL")
# Calcular el porcentaje diferencial y la diferencia
if price_buy != 0:
porcentaje_diferencial = abs(((price_sell - price_buy) / price_buy) * 100)
else:
porcentaje_diferencial = None # Indicar que no se pudo calcular el porcentaje
diferencia = abs(price_sell - price_buy) # Utilizar abs() para obtener la diferencia positiva
# Imprimir resultados con 2 dígitos después de la coma
print(f"BUY: {price_buy:.3f}")
print(f"SELL: {price_sell:.3f}")
if porcentaje_diferencial is not None:
print(f"Porcentaje diferencial: {porcentaje_diferencial:.2f}%")
else:
print("No se pudo calcular el porcentaje diferencial")
print(f"Diferencia: {diferencia:.2f}")
time.sleep(1)