ccxt: For-loops are translated incorrectly for Python
When I run npm run build, the piece of JS, like:
for (var i = 0; i < rawOrders.length; i++) {
let order = rawOrders[i];
result.push (this.parseOrder (order, market));
}
translated into Python code:
for(var i = 0 i < len(rawOrders) i++) {
order = rawOrders[i]
result.append(self.parse_order(order, market))
}
which is wrong and annoying š
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 47 (46 by maintainers)
Commits related to this issue
- added an example method to clarify on #694 — committed to ccxt/ccxt by kroitor 7 years ago
- add a missing market to example #694 — committed to ccxt/ccxt by kroitor 7 years ago
@kroitor, tried to add better exception handling: https://github.com/ccxt/ccxt/pull/837
@kroitor Made a PR https://github.com/ccxt/ccxt/pull/775
@orkenstein yep, it should throw an exception. We also have
handleErrors()to catch the errors before the standard default HTTP error handler, you might want to put all checks intohandleErrors(), see other existing implementations for examples. Most of the time it does throw an exception of a specific type (if recognized, like InsufficientFunds or InvalidOrder), or a generic exception (like DDoSProtection, NetworkError or ExchangeError).More on error handling here: https://github.com/ccxt/ccxt/wiki/Manual#error-handling
@orkenstein the point is: you will never trade that much if you donāt account for the above. So, if you wish to trade that much some day, you have to consider this very carefully.
Also here: https://www.youtube.com/watch?v=u9RIA1uUbAs&index=2&list=PLj-hivYUpPZsHeLWy7EK7hOHtLQBKE05F and here: https://www.youtube.com/watch?v=7kkohJKFSLk&index=1&list=PLj-hivYUpPZsHeLWy7EK7hOHtLQBKE05F
On Thu, Nov 30, 2017 at 1:32 PM, Igor Kroitor notifications@github.com wrote:
@orkenstein
No worries at all, feel free to ask questions, even if you think they might not be worth itā¦
Would love to, but didnāt have enough time for it just yet, that is why itās a little outdated⦠I guess an answer to that sort of questions would always be āwe never said we donāt want to do that, we just didnāt have time for that yetā. In other words, if you see something missing, itās most likely in progress. Your help on this would be appreciated a lot! I mean, the contribution guide is editable, if you think we should add something there, feel free to submit the edits, Iāll merge them all asap.
@orkenstein those should be handled like milliseconds timestamps in UTC. Thereās a set of functions:
@orkenstein oh, then you can raise the timeout (defaults to 10000 ms), just do
exchange.timeout = 20000or pass'timeout': 20000along with other constructor params upon instantiation.@orkenstein currenty, itās the long version of it:
This is because
includescan be used on arrays in JS in an interchangeable fashion, whereas in other languages the methods for lists and strings are different.I know it can be frustrating sometimes, but until we have a full-featured AST any āā any converter, we have to be syntactically precise. Feel free to ask if you have any difficulty with it. Thx!
@kroitor yep, thanks, found and issue right before you posted a comment. Cheers. P.S: working on some Livecoin updates.