Skip to content
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

new trades endpoint #111

Merged
merged 5 commits into from
Dec 21, 2017
Merged

new trades endpoint #111

merged 5 commits into from
Dec 21, 2017

Conversation

tomerweller
Copy link
Contributor

remove old /orderbook/trades
add /trades with optional asset filters

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.7%) to 92.532% when pulling f728dc3 on tomerweller:new_trades into e752ce6 on stellar:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.01%) to 92.208% when pulling 2b6fcc6 on tomerweller:new_trades into e752ce6 on stellar:master.

}
return this;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it doesn't allow to set all the query params (offer_id, cursor, order, limit...).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding offer_id. Paging params come for free from the super class CallBuilder but adding a test anyway.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.0%) to 92.258% when pulling 24bba98 on tomerweller:new_trades into e752ce6 on stellar:master.

/**
* Creates a new {@link TradesCallBuilder} pointed to server defined by serverUrl.
*
* Do not create this object directly, use {@link Server#orderbook}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{@link Server#trades}

this.url.addQuery("counter_asset_issuer", counter.getIssuer());
} else {
this.url.addQuery("counter_asset_type", 'native');
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in a scope of this PR but I see this code a lot. Would be great to move it to a helper function.

* @param offerId
* @returns {TradesCallBuilder}
*/
forOffer(offerId) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space in before function name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird. will fix


describe("TradesCallBuilder", function() {
it("trades() requests the correct endpoint (no filters)", function (done) {
let response = "trades_no_filters";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen your comment about mocked responses in other PR but I think we should make them similar to real ones. For example we should test if functions are correctly created from _links.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No prob.

@tomerweller
Copy link
Contributor Author

@bartekn pushed fixes. The server_test.js is becoming somewhat of a monster, but I didn't want to make too many changes in the scope of this pr.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.0%) to 92.258% when pulling 3884c5b on tomerweller:new_trades into e752ce6 on stellar:master.

@tomerweller tomerweller merged commit 717e97c into stellar:master Dec 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants