futuresboard icon indicating copy to clipboard operation
futuresboard copied to clipboard

500 internal error

Open ka1myk opened this issue 3 years ago • 20 comments

[2022-03-19 20:57:06,807] ERROR in app: Exception on / [GET] Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2073, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1518, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1516, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1502, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) File "/usr/local/lib/python3.8/dist-packages/futuresboard/blueprint.py", line 340, in index_page coin_list=get_coins(), File "/usr/local/lib/python3.8/dist-packages/futuresboard/blueprint.py", line 103, in get_coins pbr = round(calc_pbr(position[3], position[1], position[2], float(balance[0])), 2) File "/usr/local/lib/python3.8/dist-packages/futuresboard/blueprint.py", line 69, in calc_pbr return abs(volume * price) / balance ZeroDivisionError: float division by zero 188.255.34.222 - - [19/Mar/2022 20:57:06] "GET / HTTP/1.1" 500 -

ka1myk avatar Mar 19 '22 20:03 ka1myk

I cloned the repository, created binance api keys, added them to config, and when accessing the ip address of the link, I get an error. Please tell me what the reason may be. PS: I created new keys twice.

ka1myk avatar Mar 19 '22 21:03 ka1myk

Looks like the balance in your account is 0 which is causing this error. I could add a check in for this but do wonder what's to gain from a dashboard that has nothing to show...? Unless perhaps it's just for data in the past.

ecoppen avatar Mar 21 '22 07:03 ecoppen

I have 8 active trading pairs: BUSD to ADA, DOGE, BTC, ETH, FTT, XRP, BNB, SOL. Will make 1 buy and sell USDT to ETH and return with result.

ka1myk avatar Mar 21 '22 08:03 ka1myk

The error may be caused by an unplanned reboot of the server during order reading. Tell me, please, is there a method for cleaning the database?

ka1myk avatar Mar 29 '22 05:03 ka1myk

You can simply delete the database and it will be repopulated by the next scraping routine. It's found in the config folder usually named futures.db

ecoppen avatar Mar 29 '22 06:03 ecoppen

  • [ ] rm -rf /usr/local/lib/python3.8/dist-packages/futuresboard
  • [ ] rm -rf /root/futuresboard
  • [ ] git clone && python3 -m pip install . still have
188.255.34.222 - - [29/Mar/2022 06:51:58] "GET / HTTP/1.1" 500 -
188.255.34.222 - - [29/Mar/2022 06:51:58] "GET /favicon.ico HTTP/1.1" 404 -
[2022-03-29 06:52:01,645] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1525, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/usr/local/lib/python3.8/dist-packages/futuresboard/blueprint.py", line 340, in index_page
    coin_list=get_coins(),
  File "/usr/local/lib/python3.8/dist-packages/futuresboard/blueprint.py", line 103, in get_coins
    pbr = round(calc_pbr(position[3], position[1], position[2], float(balance[0])), 2)
  File "/usr/local/lib/python3.8/dist-packages/futuresboard/blueprint.py", line 69, in calc_pbr
    return abs(volume * price) / balance
ZeroDivisionError: float division by zero
188.255.34.222 - - [29/Mar/2022 06:52:01] "GET / HTTP/1.1" 500 -

2022-03-29T06:58:09 INFO balance: 101.172 equity: 100.874 - from passivbot log.

Any ideas how to fix?

ka1myk avatar Mar 29 '22 06:03 ka1myk

Hmm that is strange indeed, this is for Binance or Bybit? It's not a subaccount?

ecoppen avatar Mar 30 '22 10:03 ecoppen

Binance, no subaccount. All restrictions are enable like on pic.

изображение

ka1myk avatar Mar 30 '22 11:03 ka1myk

Have new test: on vps with my futuresboard (working api keys) delete and insert keys of my friend (broken api keys). Futuresboard shows 500 error. Insert my keys and working again.

ka1myk avatar Mar 30 '22 11:03 ka1myk

The dashboard definitely should not have all those permissions :rofl:

It's strange because those permissions will allow totalWalletBalance to be pulled and saved.

ecoppen avatar Mar 30 '22 11:03 ecoppen

Have new test: on vps with my futuresboard (working api keys) delete and insert keys of my friend (broken api keys). Futuresboard shows 500 error. Insert my keys and working again.

oh, so the API keys needed refreshing? :face_with_spiral_eyes:

ecoppen avatar Mar 30 '22 11:03 ecoppen

Ok, will create new api keys with only read permissions and send to you. Maybe it will be useful

ka1myk avatar Mar 30 '22 11:03 ka1myk

api OxhjDngPVdgGla4Lefi25FV0QgUNQy1mQZ1QFfpMsUhNtNJGJVW9dkBXWJ6FmvjZ secret IeTfz6nrETnzhkOGCNIIrAcGca8hVEQoh4jliSy6XYO1t2RkvP8nJR77kSu4ku1U

only for reading, please, try it

ka1myk avatar Apr 04 '22 20:04 ka1myk

Aha! Looks like you're using BUSD? (multi-asset mode). The values I am pulling from binance explain it only returns USDT: "totalMaintMargin": "0.00000000", // total maintenance margin required, only for USDT asset.

I think it should be ok for me to loop through the assets and have them replace the values if they're greater than 0 - just need to see what the effects of this would be.

ecoppen avatar Apr 05 '22 14:04 ecoppen

You're right! So the solution is already prepared? Can I update the version?

ka1myk avatar Apr 12 '22 12:04 ka1myk

Not yet, once I get back to work I'll get a fix in for it~

ecoppen avatar Apr 13 '22 17:04 ecoppen

Finally found a solution. For the dashboard to work correctly, client.futureschange_multi_assets_mode(multiAssetsMargin="True") must be executed

ka1myk avatar Jun 28 '22 06:06 ka1myk

multiAssetsMargin

Is that code from this library? This dashboard makes API calls directly without using any libraries (for better or worse). I'm currently working on a another implementation of the dashboard though and will factor this in.

ecoppen avatar Jun 28 '22 06:06 ecoppen

https://binance-docs.github.io/apidocs/futures/en/#change-multi-assets-mode-trade Can be called via POST /fapi/v1/multiAssetsMargin

ka1myk avatar Jun 28 '22 07:06 ka1myk

Perfect! I'll look into this

ecoppen avatar Jun 28 '22 10:06 ecoppen

Didn't get to implementing this in V1 and while the PR #71 did address some of this, I broke it and now will look to have this sorted for V2.

ecoppen avatar Feb 26 '23 20:02 ecoppen