Code Monkey home page Code Monkey logo

Comments (14)

kimms213 avatar kimms213 commented on September 14, 2024 2

Hello @nlsdfnbch,
Please check below!

In client._subscribe, the payload dictionary is passed to conn.send as separated parameters.
Unfortunately, candles channel has 'key' in payload field.
This is overlapped with original parameter name 'key' in conn.send method, which is used for api key.

A quick fix for this problem is to change parameter name in conn.send, something like below.

def send(self, key=None, secret=None, list_data=None, auth=False, **kwargs): ->
def send(self, api_key=None, api_secret=None, list_data=None, auth=False, **kwargs):

Hope this helps!

from btfxwss.

deepbrook avatar deepbrook commented on September 14, 2024

Hey @BitbeyHub !
Thanks for contributing! From looking at it, this probably due to a pull request I merged earlier. Good catch!
Unfortunately I'm not near a computer till Sunday - until then a workaround may be to prepend a 't' to the symbol when calling the method.

from btfxwss.

deepbrook avatar deepbrook commented on September 14, 2024

I've checked the logs and found that Bitfinex doesn't like the way I send the subscription for candles:

DEBUG:btfxwss.client:_subscribe: {'key': 'trade:1m:tBTCUSD', 'event': 'subscribe', 'channel': 'candles'}
DEBUG:btfxwss.connection:_on_message(): Received new message {"channel":"candles","event":"error","msg":"key: invalid","code":10300} at 1506424899.4304948

However, according to their documentation, this is what they want:

// request
{
   event: "subscribe",
   channel: "candles",
   key: "trade:1m:tBTCUSD"
}

Which is, as far as I can tell, the same thing as mine. Will look into this further.

from btfxwss.

BitbeyHub avatar BitbeyHub commented on September 14, 2024

Sorry I am not very familiar with github and ... I found it might be my network reason after I made the script repeat the line of code again and again only if it's in "KeyError" until it's connected successfully. Or so I can say I ... fixed it ?

And I traced back to its importing modules, only to find that the functions finally need to compare elements with the retrieved Queue object. Given my network unconnected, the Queue object to be compared with must be empty. So being empty means nothing to compare. Hence the KeyError occurred.


And there is another question I wanna cast : which branch is kept latest should I download and install if I wanna conduct websocket connect in Python 3.6.2?

from btfxwss.

deepbrook avatar deepbrook commented on September 14, 2024

@BitbeyHub, the release branch is the currently most up-to-date branch.

from btfxwss.

deepbrook avatar deepbrook commented on September 14, 2024

I have opened a ticket with the Bitfinex Support Team, hopefully they'll find out what's going on here.
Although I'm quite positive it's something odd on my end, I just haven't been able to spot it.

from btfxwss.

apotapov avatar apotapov commented on September 14, 2024

Fixed here: #64.

If you need a quick fix, you can modify your requirements.txt to replace:
btfxwss==1.1.1
with
-e git://github.com/TapWealth/btfxwss.git#egg=btfxwss

from btfxwss.

apotapov avatar apotapov commented on September 14, 2024

Note, the fix above also makes the code Python2 compatible which was a requirement for my use case. If you want to avoid any side effects of those changes and just want to fix the KeyError issue, here's the change that fixes it:

https://github.com/nlsdfnbch/btfxwss/pull/64/files#diff-fa3139a968f240692f4ad7f331d4ff7dR153

from btfxwss.

deepbrook avatar deepbrook commented on September 14, 2024

@kimms213
You're right! Fixed it that way. Thanks for the help and pointers, people!

from btfxwss.

Closius avatar Closius commented on September 14, 2024

I still have this error. I created a python file for collecting data (candles) of one PAIR. Then I created a bash script for running (with nohup) my python file many times with different pairs.

When I run my bash script with lets say 4-5 pairs - its ok. But if I run it with 10 pairs first 4-5 pairs are running ok but next pairs raises an error like [9]- Exit 1 nohup python3 $COLLECTOR $PAIR > $OUT_COLLECTOR

I think it might be because I create many websocket connection for collecting one pair. Is it true or I should look another cause of this error?

from btfxwss.

deepbrook avatar deepbrook commented on September 14, 2024

That is likely the case, yes - Bitfinex allows a maximum of 4-6 Requests per minute to the Websocket API, if I remember correctly. So You should connect once, and send a channel subscription for each pair on that one connection.

from btfxwss.

Closius avatar Closius commented on September 14, 2024

@nlsdfnbch Thank you Nils!
I didn't find any limitation of requests for websocket on official website.
Do you know if there is some limit for channel subscription? I mean how many pairs I can subscribe per one ws connection.

from btfxwss.

deepbrook avatar deepbrook commented on September 14, 2024

@Closius, I dug through my mails and found a ticket I had opened with them a few months ago, that's where I got the limit from:

The limit is 15 connections per minute. You should hardly ever need to connect more that once or twice per minute. You should connect and keep the connection open for longer periods. You should only need to connect a few time per day, if at all.

Kind regards,

Bjorn
Bitfinex.com

So It's 15 per minute, but still, that might happen pretty quickly if the client is executed multiple times and tries to reconnect.

You can subscribe to every single channel with all kinds of configurations - I haven't hit a limit for this on a single connection yet (and I run about 50 configurations)

from btfxwss.

Closius avatar Closius commented on September 14, 2024

@nlsdfnbch Thank you!

from btfxwss.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.