23 lines
629 B
Python
23 lines
629 B
Python
from app.services.Bybit.functions import price_symbol
|
|
import app.telegram.database.requests as rq
|
|
|
|
from pybit.unified_trading import HTTP
|
|
|
|
client = HTTP()
|
|
|
|
async def get_min_qty(tg_id):
|
|
api_key = await rq.get_bybit_api_key(tg_id)
|
|
secret_key = await rq.get_bybit_secret_key(tg_id)
|
|
SYMBOL = await rq.get_symbol(tg_id)
|
|
|
|
client = HTTP(
|
|
api_key=api_key,
|
|
api_secret=secret_key
|
|
)
|
|
|
|
price = await price_symbol(tg_id)
|
|
json_data = client.get_instruments_info(symbol=SYMBOL, category='linear')
|
|
|
|
min_qty = int(5 / price * 1.1) # Äîáàâèë 1% ÷òîáû áûëî òî÷íî áîëüøå 5 USDT
|
|
|
|
return min_qty |