Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Igor Kroitor
    @kroitor
    import ccxt
    from pprint import pprint
    exchange = ccxt.huobipro({'enableRateLimit': True})
    exchange.load_markets()
    # all tickers
    pprint(exchange.fetch_tickers())
    hivemall
    @hivemall
    awesome, thank you very much
    Igor Kroitor
    @kroitor
    hivemall
    @hivemall
    ok, no example has huobi, yet it should be like you showed above
    Igor Kroitor
    @kroitor
    @hivemall fetchOpenOrders will fetch your open orders only (and requires authentication), you probably want to fetchOrderBook if you want to see the open orders placed by other players (bids and asks)
    hivemall
    @hivemall
    how to call exchange.close() if theres an error? i have it at the end of the py script. but in middle if raise i cant close it
    Igor Kroitor
    @kroitor
    from ccxt.async_support import ccxt
    from pprint import pprint
    
    async def test():
        exchange = ccxt.huobipro({ YOUR_OPTIONS_HERE })
        try:
            # your code here
            pprint(await exchange.fetch_order_book('ETH/BTC'))
        except Exception as e:
            print('Oooops!')
            print(e)
        # close it regardless of whether the error happened or not
        await exchange.close()
    alternatively:
    from ccxt.async_support import ccxt
    from pprint import pprint
    
    async def test():
        exchange = ccxt.huobipro({ YOUR_OPTIONS_HERE })
        try:
            # your code here
            pprint(await exchange.fetch_order_book('ETH/BTC'))
            await exchange.close()  # close it on success
        except Exception as e:
            await exchange.close()  # close it on failure
            print('Oooops!')
            raise e # throw the error up the call stack
    ↑ these questions aren't really related to ccxt, since these are basic python fundamentals
    hivemall
    @hivemall
    indeed but it misses:
    AttributeError: type object 'kraken' has no attribute 'exit'
    exchanges = await init_exchanges(config) with ExitStack() as stack: files = [stack.enter_context(ex) for ex in exchanges]
    i cant use context managers since there is no AttributeError: type object 'kraken' has no attribute '__exit__'
    so i guess iam stuck with try finally
    Dino Hensen
    @dhensen
    @hivemall dont know if this info helps, but I have for instance a script where I call loop.run_until_complete(somefunction()). When I stop my script manually with CTRL+C i have a try/except around that line of code. I can then prepare to close all my "open" exchanges before I run my eventloop one more time (in order to perform the closes on all my exchange instance).
    hivemall
    @hivemall
    @dhensen good idea, you can use try: finally: to always close on sigint0 AND 1, nice
    i tried to use python with but no success there, other soluotin form kroitor is good though.
    but if so the apikey can be sniffed directly on the request no?
    like every parameter in the uri
    Igor Kroitor
    @kroitor
    @hivemall yep, however, the apiKey itself isn't enough to access your account, since it requires a signature generated with a secret as well.
    also, with https the url is encrypted as well
    so it would be very hard to sniff it from the outside, the attacker would need the access to your machine, and if the attacker has such an access to your machine, then there's probably a lot more interesting there than just the bittrex keys specifically
    hivemall
    @hivemall
    @kroitor if tickers = await exchange.fetch_tickers(symbols=[])should return an empty array not ALL, tested with bittrex; if the caller states no symbols its meant to return none; it makes the api calls cumbersome with another if else
    hivemall
    @hivemall
    The symbols attribute is simply not considered, bug?
    test = await exchange.fetch_tickers(symbols=['NXT/BTC', 'NXT/USDT'])
    # <bound method bittrex.fetch_tickers of ccxt.async_support.bittrex()>
    # returns the ENTIRE set
    <class 'dict'>: {'HMQ/BTC': {'symbol': 'HMQ/BTC', 'timestamp': 1568466299373, 'datetime': '2019-09-14T13:04:59.373Z', 'high': 5.9e-07, 'low': 5.4e-07....
    Igor Kroitor
    @kroitor
    @hivemall yes, that's a known one, the filtering by symbol is not implemented in all exchanges' fetchTickers yet, we are working on it
    hivemall
    @hivemall
    like the futures excahge kraken ;) ticket..; appriacte it sir
    i will open ticket so you can close it when its fixed and get notified
    hivemall
    @hivemall
    How to create order with expiry date for eg bittrex huobi binance etc? is it generall supported, how to lookup what to pass in the params field?
    hurtcomplex
    @hurtcomplex
    @kroitor noob question here
    'has': {
                    'cancelAllOrders': True,
                    'createMarketOrder': False,
                    'fetchDepositAddress': True,
                    'fetchMyTrades': False,
                    'fetchOHLCV': False,
                    'fetchOpenOrders': True,
                    'fetchTickers': True,
                    'withdraw': True,
                },
    how do I access this list from within an Exchange object?
    I'd like to do a conditional check before running a particular method based on whether or not it is supported by that particular exchange.
    hurtcomplex
    @hurtcomplex
    nvm, got it.
    client.has.
    hurtcomplex
    @hurtcomplex
    gateio parse orders still a little glitchy, remaining always returns as None
    mortezae
    @mortezae
    Hi, is Binance OCO supported? (and if not, from where can I follow news)
    Igor Kroitor
    @kroitor

    @hivemall

    How to create order with expiry date for eg bittrex huobi binance etc? is it generall supported, how to lookup what to pass in the params field?

    Very few exchanges support it in general. For those that support it – you need to pass the corresponding param in the params field as described here:

    See examples in the Manual on how to pass them.

    To look up which particular param it is, you should consult the API docs of the exchange in question, see links for all docs for all exchanges here:

    @hurtcomplex glad you've figured out client.has )

    gateio parse orders still a little glitchy, remaining always returns as None

    If you can post your verbose request/response or open an issue – we will get it fixed, if possible.

    Igor Kroitor
    @kroitor

    @mortezae

    Hi, is Binance OCO supported? (and if not, from where can I follow news)

    Yes, we have added the corresponding endpoints in version 1.18.1162 and it will arrive in 15 minutes. However, those endpoints currently don't have unified interfaces, so, you will have to use implicit API methods as described in the Manual and you will have to parse the responses on your side:

    We will look into unifying it at some point, but this is not our topmost priority atm.

    mortezae
    @mortezae
    Thanks Igor
    OliverNChalk
    @OliverNChalk

    Anyone here have much experience with Binance's "Signature is not valid" error?

    I'm currently watching it but it seems like it might be session-based? Which would lead me to think its either caused by an authentication error or some crude rejection system on Binance's end. Anyways, just thought I'd air that here in case someone else was dealing with these seemingly random rejections.

    If it occurs again I'll look into it further

    Igor Kroitor
    @kroitor
    @OliverNChalk are you using the rate-limiter as described in the Manual?
    Does the error happen consistently on all requests, or occasionally, on some private requests?
    Which language, ccxt version ?
    OliverNChalk
    @OliverNChalk
    i have my own rate limiting, ccxt's rate limiting should be off, right?
    JavaScript: 1.18.1148
    Does the error happen consistently on all requests, or occasionally, on some private requests? Occasionally but then it will happen 30 times in a row (30 retries) and I will turn my bot off
    Igor Kroitor
    @kroitor

    i have my own rate limiting, ccxt's rate limiting should be off, right?

    yes, but then you're responsible for avoiding the rate limit collisions

    Occasionally but then it will happen 30 times in a row (30 retries) and I will turn my bot off

    How do we reproduce it? Can you post a gist or a short snippet of code (10-20 lines) that would trigger the same thing?

    OliverNChalk
    @OliverNChalk
    Hence why I said "session-based" because when it happens it keeps happening. And it only happens for private end points
    Igor Kroitor
    @kroitor

    And it only happens for private end points

    That is pretty much expected to happen only with private endpoints, since public endpoints don't require a signature.

    OliverNChalk
    @OliverNChalk
    like I said, its random and not quite re-producable (at the moment). If I can reporduce it consistently ill share