INNER CODE UNIT · Python

get_random_string

hadialaddin/crypto-genie · crypto-genie.py:160

def get_random_string(length):
    # choose from all lowercase letter
    letters = string.ascii_lowercase
    result_str = ''.join(random.choice(letters) for i in range(length))
    return result_str

def close_enough_match(price1, price2, size1, size2, positionType=False):
    # price1 is the fixed target and price2 is the dynamic one being checked
    if positionType=="Buy":
        price_matches = price2 <= price1 # Price can be at the exact level or closer to entry
    elif positionType=="Sell":
        price_matches = price2 >= price1 # Price can be at the exact level or closer to entry
    else:
        price_matches = price2 == price1
    size_matches = size1 == size2 or math.floor(size1 * 10)/10.0 == size2 or math.floor(size1 * 100)/100.0 == size2 or math.floor(size1 * 1000)/1000.0 == size2 or math.floor(size1 * 10000)/10000.0 == size2
    return price_matches and size_matches

def round_to_tick(price,tick_size):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…