ALGObot, What error is causing this to only fall through ".......sold for a profit"?

44 Views Asked by At
def execute_doge_musktrade():


###Due to technical difficulties in instanteous limit orders (delay has been up to 6seconds)
###I have decided to instanteously order via market order and independently
#set the dogecoin price for monitoring
doge_data = get_price("DOGE-USDT")
doge_price = doge_data['price']
doge_price = float(doge_price)
symbol = "DOGE-USDT"
size = 1
client.create_market_order(symbol=symbol, side="buy", size=size)
print(f"1 dogecoin was successfully purchased at {doge_price}")
##SET to Text you the purchase order and then after sale the sale order

##Then we want to monitor the price of said token, and we want to determine what percentage of profits/losses we want to accept
desired_take_profit = 1.005
take_profit_target = doge_price * desired_take_profit
desired_stop_loss = 0.9975
stop_loss_target = doge_price * desired_stop_loss
print(take_profit_target, stop_loss_target)

doge_coin_not_sold = True
while doge_coin_not_sold:
    doge_monitor = get_price("DOGE-USDT")
    doge_monitor_price = doge_monitor['price']
    doge_monitor_price = float(doge_monitor_price)
    if doge_monitor_price <= stop_loss_target:
        doge_coin_not_sold = False
        client.create_market_order(symbol=symbol, side="sell", size=size)
        account_balance = doge_musk_check_balance()
        print(f"Dogecoin was sold for a 0.05% profit @{doge_monitor_price}")
        print(f"Account Balance:{account_balance}\n")
        return ("Success")
    ####If the take profit target is hit; trigger dogecoinsold, client.kucoin SELL, and print to the console
    if doge_monitor_price >= take_profit_target:
        doge_coin_not_sold = False
        client.create_market_order(symbol=symbol, side="sell", size=size)
        account_balance = doge_musk_check_balance()
        print(f"Dogecoin was sold for a 0.03% loss @{doge_monitor_price}")
        print(f"Account Balance: {account_balance}\n")
        return("Failure")
time.sleep(0.5)

[FROM CONSOLE] These are trials that I have run: [FROM CONSOLE]

BEGINNING BALANCE: 20.98360669 How many times should we run this data: 25 1 dogecoin was successfully purchased at 0.13936 0.1400568 0.1390116 Dogecoin was sold for a 0.05% profit @0.139 Account Balance:20.98188833

1 dogecoin was successfully purchased at 0.139 0.13969499999999999 0.1386525 Dogecoin was sold for a 0.05% profit @0.13865 Account Balance:20.980210890000002

1 dogecoin was successfully purchased at 0.13863 0.13932314999999998 0.13828342500000002 Dogecoin was sold for a 0.05% profit @0.13827 Account Balance:20.97839392

1 dogecoin was successfully purchased at 0.13827 0.13896134999999998 0.13792432500000001

0

There are 0 best solutions below