Post
Topic
Board Trading Discussion
Re: Help improve the trading bot code
by
Den11
on 01/07/2023, 16:54:26 UTC
It's difficult to help you out without knowing where the problem is occurring exactly (which function/line).

But if I had to guess, I would say it's because one of your variables (possibly buy or sell) is failing for some reason and not returning anything. Did you by any chance forget to set your APIKEY and SECRET?


Sorry. For not posting right away.

The spread right now is 7.000000000000001%
{
    "success": true,
    "message": "",
    "result": {
        "uuid": "856c4057-f36b-1410-8ee1-00532493487a"
    }
}
{
    "success": false,
    "message": "INSUFFICIENT_FUNDS",
    "result": null
}
No uuid's!
Sleeping for 1s
{
    "success": false,
    "message": "UUID_INVALID",
    "result": null
}
Canceling buy order 🗙
{
    "success": false,
    "message": "UUID_INVALID",
    "result": null
}
Canceling sell order 🗙
{
    "success": false,
    "message": "UUID_INVALID",
    "result": null
}
Canceling buy order 🗙
Sleeping for 1s
{
    "success": false,
    "message": "UUID_INVALID",
    "result": null
}
Canceling sell order 🗙
Traceback (most recent call last):
  File "C:\bot\trader.py", line 104, in <module>
    main()
  File "C:\bot\trader.py", line 102, in main
    cancel_orders(buy_uuid, sell_uuid)
  File "C:\bot\trader.py", line 93, in cancel_orders
    if buy_order_info.result["IsOpen"] == False:
       ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable