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
Refactorized WebSocket API. #6
Conversation
Up |
this looks pretty awesome, i am going to play with it now. do you want to chat about it a little? |
Of course, tell me your thoughts. BTW, I took freedom for deleting some unnecessary files like
|
I was curious about the new documentation (npm run docs), I was using slate for the docs with github pages. I would like to know more about coveralls. One design decision i was contemplating was to accept an object as the argument instead of individual arguments... |
I know when I am crafting an order it is more comfortable to be able to work on the order object and play with its attributes and then just pass that one argument... I really like what you have done, I was wondering if you have looked into the classes in ECMA 2015 and if they could be better than the prototype method of creating objects... In general, you seem to be a much better js developer than myself, and I love what you have done |
i believe source/images was being used to create the logo in the top left corner |
anyway, if you are available to chat via Skype, this is exactly the type of interaction we hope to have regarding our libraries, really happy to see your interest, and I think we are going to have rewards for outstanding members of the community. I'd love to pick your brain on the API and what you think and how it can be improved, and how the library should function as a means to interacting with it. I was actually discussing individual event emitters because it seemed such a cleaner way of handling different situations, rather than having a massive "onmessage" we can have onticker, onbook, etc Anyway, the designer of the WS API, loves your suggestions and we are going to merge them as soon as we can do some testing |
I use JSDoc to document JS libs, its well spread and many modules uses it. JSDoc generates HTML but
I think you are pointing something like this, right? /**
* @param {string} pair BTCUSD, LTCUSD or LTCBTC. Mandatory param.
* @param {object} [options] Object of additional options
* @param {string} [options.precision] Level of price aggregation P0 (default), P1, P2, P3.
* @param {string} [options.length] Number of price points. 25 (default) or 100.
*/
BitfinexWS.prototype.subscribeOrderBook = function (pair, options) { ... I prefer it because new parameters can be sent to the API without having to write new code. Just depends if you plan to add new parameters to the API. Another obvious benefit is the number of arguments are less but having only 3 is not too much.
Thank you! 😊. Yes, I've played with ES2015 classes but they are only syntax sugar influenced by CoffeeScript. Well I like that sugar but I'm not using it in my public modules. The reason is many developers still uses NodeJS v0.10.x and they wont be able to use the module.
Thanks again, I've been working hard with JS for long 😸 |
The Travis badge? Travis try to pass tests and won't use the code coverage (at last that is what I know).
Coveralls is a free service to show tests coverage. A coverage badge is provided for each project by Coveralls so you can show that badge in the project like the Travis one. The code coverage can be generated by Travis and sent to Coveralls by scripting in // Taken from https://github.com/nickmerwin/node-coveralls
"scripts": {
"test": "mocha test/index.js",
"test-cov": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
}, There are other services for showing code coverage like Codecov but I haven't tried it. |
Sure, you can contact me through Skype as yago.ftw@outlook.es or Google Hangouts as yago.ftw@gmail.com . hahahah that sounds awesome.
You mean this? or the server side API implementation? |
Refactorized WebSocket API.
So, I merged in your changes, it looks really good. It automatically passed all the tests as well, so that is great. One thing I was curious about, in the past, I had made the pair argument optional, because the vast majority of people care about BTCUSD and that is a sensible default, what do you think? |
also published to npm and moved version up to 0.2.0 |
travis does run the code coverage i have, you can see it at the bottom of the test =============================== Coverage summary =============================== |
one of the main issues with code coverage is how do you test stuff that requires money? |
also you can see the docs have been updated using the docs generated via jsdocs (i just added them into the slate includes folder (might look into changing this in the future, but i would like to include example code of how to use the library) |
the docs are here http://bitfinexcom.github.io/bitfinex-api-node/ |
and coverage report here |
it might be out of date now, not sure |
I wrote
No, Travis.org pass the tests free and can send the code coverage free too. Everything is free.
I know. I wouldn’t generate the code coverage by |
ah, not the coverage costs money but testing an order or testing receiving an execution message, those events won't happen unless a financial transaction happens...so it is hard to have a built in test (because it would require a real account with real money to place the orders, etc) |
and yes, i am interested in adding coveralls |
I've rewritten everything on
ws.js
, now events are provided for every message.Events
trade
,orderbook
andticker
receives 2 arguments as callback, the first is the pair name and second the data. See the example.Included documentation (on DOCS.md) can be generated with
npm run docs
. API Rest doc should be written too.