Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'asks' when no response from server with current prices #34

Closed
Tim55667757 opened this issue Jul 22, 2022 · 1 comment
Closed
Assignees
Labels
Error It's a BUG! Or just something isn't working...
Milestone

Comments

@Tim55667757
Copy link
Owner

If server not responses with current prices. an error occured:

TKSBrokerAPI.py     L:797  DEBUG   [2022-07-22 17:07:45,401] Requesting current prices for instrument with ticker [POSI] and FIGI [TCS00A103X66]...
TKSBrokerAPI.py     L:357  DEBUG   [2022-07-22 17:07:55,483]     - not oK status code received: [504] {"code":4,"message":null,"description":null}
TKSBrokerAPI.py     L:361  DEBUG   [2022-07-22 17:07:55,484] Retry: [1]. Wait until 5 sec. and try again...
TKSBrokerAPI.py     L:367  ERROR   [2022-07-22 17:08:00,573] Not `oK` status received from broker server!
TKSBrokerAPI.py     L:368  ERROR   [2022-07-22 17:08:00,574]     - message: [504] {"code":4,"message":null,"description":null}
TKSBrokerAPI.py     L:797  DEBUG   [2022-07-22 17:08:00,574] Requesting current prices for instrument with ticker [POSI] and FIGI [TCS00A103X66]...
TKSBrokerAPI.py     L:357  DEBUG   [2022-07-22 17:08:10,663]     - not oK status code received: [504] {"code":4,"message":null,"description":null}
TKSBrokerAPI.py     L:361  DEBUG   [2022-07-22 17:08:10,664] Retry: [1]. Wait until 5 sec. and try again...
TKSBrokerAPI.py     L:357  DEBUG   [2022-07-22 17:08:25,755]     - not oK status code received: [504] {"code":4,"message":null,"description":null}
TKSBrokerAPI.py     L:361  DEBUG   [2022-07-22 17:08:25,756] Retry: [2]. Wait until 5 sec. and try again...
TKSBrokerAPI.py     L:357  DEBUG   [2022-07-22 17:08:40,842]     - not oK status code received: [504] {"code":4,"message":null,"description":null}
TKSBrokerAPI.py     L:361  DEBUG   [2022-07-22 17:08:40,842] Retry: [3]. Wait until 5 sec. and try again...
TKSBrokerAPI.py     L:357  DEBUG   [2022-07-22 17:08:55,933]     - not oK status code received: [504] {"code":4,"message":null,"description":null}
TKSBrokerAPI.py     L:367  ERROR   [2022-07-22 17:08:55,934] Not `oK` status received from broker server!
TKSBrokerAPI.py     L:368  ERROR   [2022-07-22 17:08:55,935]     - message: [504] {"code":4,"message":null,"description":null}
TKSBrokerAPI.py     L:3025 DEBUG   [2022-07-22 17:08:55,938] Traceback (most recent call last):
TKSBrokerAPI.py     L:3025 DEBUG   [2022-07-22 17:08:55,938]   File "tksbrokerapi\TKSBrokerAPI.py", line 2869, in Main
TKSBrokerAPI.py     L:3025 DEBUG   [2022-07-22 17:08:55,939]     server.Overview(showStatistics=True)
TKSBrokerAPI.py     L:3025 DEBUG   [2022-07-22 17:08:55,939]   File "tksbrokerapi\TKSBrokerAPI.py", line 1370, in Overview
TKSBrokerAPI.py     L:3025 DEBUG   [2022-07-22 17:08:55,939]     instrument = self.SearchByFIGI(requestPrice=True)  # full raw info about instrument by FIGI
TKSBrokerAPI.py     L:3025 DEBUG   [2022-07-22 17:08:55,940]   File "tksbrokerapi\TKSBrokerAPI.py", line 755, in SearchByFIGI
TKSBrokerAPI.py     L:3025 DEBUG   [2022-07-22 17:08:55,940]     figiJSON["currentPrice"] = self.GetCurrentPrices(showPrice=False)
TKSBrokerAPI.py     L:3025 DEBUG   [2022-07-22 17:08:55,941]   File "tksbrokerapi\TKSBrokerAPI.py", line 805, in GetCurrentPrices
TKSBrokerAPI.py     L:3025 DEBUG   [2022-07-22 17:08:55,941]     prices["buy"] = [{"price": NanoToFloat(item["price"]["units"], item["price"]["nano"]), "quantity": int(item["quantity"])} for item in pricesResponse["asks"]]
TKSBrokerAPI.py     L:3025 DEBUG   [2022-07-22 17:08:55,942] KeyError: 'asks'
@Tim55667757 Tim55667757 self-assigned this Jul 22, 2022
@Tim55667757 Tim55667757 added the Error It's a BUG! Or just something isn't working... label Jul 22, 2022
@Tim55667757 Tim55667757 added this to the release-1.1 milestone Jul 22, 2022
Tim55667757 added a commit that referenced this issue Jul 22, 2022
@Tim55667757
Copy link
Owner Author

The error was when the server did not send data about current prices. Now this situation is being processed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error It's a BUG! Or just something isn't working...
Projects
None yet
Development

No branches or pull requests

1 participant