question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bittrex cancelOrder TypeError: Cannot read property 'split' of undefined

See original GitHub issue

ATTENTION!!!

MUST READ THIS BEFORE SUBMITTING ISSUES (read the link, then delete this message before submitting):

https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-submit-an-issue

  • OS: Ubuntu
  • Programming Language version: js
  • CCXT version: 1.18.787
  • Exchange: bittrex
  • Method: cancelOrder
const order =  await bittrex.fetchOpenOrders('PAY/BTC')
await bittrex.cancelOrder(order.id, 'PAY/BTC')

This error does not happen all the time. I tried to replicate it but did not appear again. But it is frequently observed on bittrex.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
denarioresearchcommented, Jun 29, 2019

Here is some more info on this issue:

TypeError: Cannot read property 'split' of undefined
    at bittrex.parseSymbol (/node_modules/ccxt/js/bittrex.js:817:40)
    at bittrex.parseOrderV3 (/node_modules/ccxt/js/bittrex.js:868:27)
    at bittrex.parseOrder (/node_modules/ccxt/js/bittrex.js:827:25)
    at bittrex.cancelOrder (/node_modules/ccxt/js/bittrex.js:637:34)

It seems error is not an inatance of ccxt.BaseError

1reaction
frosty00commented, Jun 29, 2019

What version of ccxt are you using? I am looking at the bittrex code on the current release and there is no parseSymbol in parseOrderV3 (the trace that you are outputting)

parseOrderV3 (order, market = undefined) {
        //
        //     {
        //         id: '1be35109-b763-44ce-b6ea-05b6b0735c0c',
        //         marketSymbol: 'LTC-ETH',
        //         direction: 'BUY',
        //         type: 'LIMIT',
        //         quantity: '0.50000000',
        //         limit: '0.17846699',
        //         timeInForce: 'GOOD_TIL_CANCELLED',
        //         fillQuantity: '0.50000000',
        //         commission: '0.00022286',
        //         proceeds: '0.08914915',
        //         status: 'CLOSED',
        //         createdAt: '2018-06-23T13:14:28.613Z',
        //         updatedAt: '2018-06-23T13:14:30.19Z',
        //         closedAt: '2018-06-23T13:14:30.19Z'
        //     }
        //
        const marketSymbol = this.safeString (order, 'marketSymbol');
        let symbol = undefined;
        let feeCurrency = undefined;
        if (marketSymbol !== undefined) {
            const [ baseId, quoteId ] = marketSymbol.split ('-');
            const base = this.commonCurrencyCode (baseId);
            const quote = this.commonCurrencyCode (quoteId);
            symbol = base + '/' + quote;
            feeCurrency = quote;
        }
        const direction = this.safeString (order, 'direction');
        const createdAt = this.safeString (order, 'createdAt');
        const updatedAt = this.safeString (order, 'updatedAt');
        const closedAt = this.safeString (order, 'closedAt');
        let lastTradeTimestamp = undefined;
        if (closedAt !== undefined) {
            lastTradeTimestamp = this.parse8601 (closedAt);
        } else if (updatedAt) {
            lastTradeTimestamp = this.parse8601 (updatedAt);
        }
        const timestamp = this.parse8601 (createdAt);
        const type = this.safeString (order, 'type');
        const quantity = this.safeFloat (order, 'quantity');
        const limit = this.safeFloat (order, 'limit');
        const fillQuantity = this.safeFloat (order, 'fillQuantity');
        const commission = this.safeFloat (order, 'commission');
        const proceeds = this.safeFloat (order, 'proceeds');
        const status = this.safeString (order, 'status');
        let average = undefined;
        let remaining = undefined;
        if (fillQuantity !== undefined) {
            if (proceeds !== undefined) {
                if (fillQuantity > 0) {
                    average = proceeds / fillQuantity;
                } else if (proceeds === 0) {
                    average = 0;
                }
            }
            if (quantity !== undefined) {
                remaining = quantity - fillQuantity;
            }
        }
        return {
            'id': this.safeString (order, 'id'),
            'timestamp': timestamp,
            'datetime': this.iso8601 (timestamp),
            'lastTradeTimestamp': lastTradeTimestamp,
            'symbol': symbol,
            'type': type.toLowerCase (),
            'side': direction.toLowerCase (),
            'price': limit,
            'cost': proceeds,
            'average': average,
            'amount': quantity,
            'filled': fillQuantity,
            'remaining': remaining,
            'status': status.toLowerCase (),
            'fee': {
                'cost': commission,
                'currency': feeCurrency,
            },
            'info': order,
        };
    }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot Read Property 'split' of Undefined - freeCodeCamp
it will throw the TypeError: Cannot read property 'split' of undefined error. The split method. When split is called on a string, it...
Read more >
How to prevent cannot read property split of ... - Meticulous
This error is a TypeError , and it occurs when calling a method, operand, or argument on the wrong data type, or when...
Read more >
How to Prevent cannot read property split of ... - Gopi Gorantala
The "cannot read property split of undefined" error occurs when we try ... TypeError: Cannot read properties of undefined (reading 'split').
Read more >
TypeError: Cannot read property 'split' of undefined in discord ...
You're trying to call split on undefined . Don't do that. First, check to see if it exists. let token; if (msg &&...
Read more >
Bittrex Crypto Exchange | The Best Crypto Trading Platform
Bittrex Crypto Exchange offers the best crypto trading platform for everyone, regardless of experience. Get started on your crypto trading journey here.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found