Files
TradingBot-with-BybitAPI/src/arbus.py
2025-05-18 17:03:59 +03:00

31 lines
827 B
Python

import options
from random import randint
async def getLevels(amount, highPrice, lowPrice, roundDecimals):
# Returns array of prices from low to high for each level
levels = []
delta = (highPrice - lowPrice)/amount
levelPrice = lowPrice
for i in range(amount - 1):
levels.append(levelPrice)
levelPrice = round(levelPrice + delta, roundDecimals)
levels.append(highPrice)
return levels
def floor(value, decimals):
# Rounds float to the lower side with the decimals given
factor = 1/(10**decimals)
return (value//factor)*factor
def countDecimals(value):
# Counts decimals in a float
decimals = len(str(value).split('.')[-1])
return decimals
def getArbus():
# Returnes n arbus (n is random 1 byte positive number)
return ("arbus"*randint(0, 255))