Skip to content
This repository has been archived by the owner on Oct 8, 2019. It is now read-only.

Commit

Permalink
feat(Quote/Trade): expectedDelivery, speedupAvailable
Browse files Browse the repository at this point in the history
  • Loading branch information
plondon committed Jul 30, 2018
1 parent 2ef87f7 commit 0a8e788
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ class Profile {
}

fetchJumioToken () {
return this.api.authPOST('account/verify/enhanced')
return this.api.authPOST('account/verify/enhanced');
}

fetchJumioStatus (id) {
return this.api.authGET(`account/verify/enhanced/${id}`)
return this.api.authGET(`account/verify/enhanced/${id}`);
}
}

Expand Down
22 changes: 19 additions & 3 deletions src/quote.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ class Quote extends Exchange.Quote {

var expiresAt = new Date(obj.expires_on);
var timeOfRequest = new Date(obj.current_time);
var expectedDelivery = new Date(obj.expected_delivery);
var btcAmount = toSatoshi(obj.base_amount);
var usdAmount = obj.quote_amount;

this._id = obj.quote_id;
this._expiresAt = expiresAt;
this._timeOfRequest = timeOfRequest;
this._expectedDelivery = expectedDelivery;
this._speedupAvailable = obj.speedup_available;
this._rate = obj.rate;

this._baseCurrency = baseCurrency.toUpperCase();
Expand All @@ -42,6 +45,14 @@ class Quote extends Exchange.Quote {
return this._feeCurrency;
}

get expectedDelivery () {
return this._expectedDelivery;
}

get speedupAvailable () {
return this._speedupAvailable;
}

static getQuote (api, delegate, amount, baseCurrency, quoteCurrency, debug) {
const processQuote = (quote) => {
let q = new Quote(quote, baseCurrency, api, delegate);
Expand All @@ -51,14 +62,19 @@ class Quote extends Exchange.Quote {

const getQuote = (_baseAmount) => {
let action = _baseAmount > 0 ? 'buy' : 'sell';

return api.POST('quote/', {
let data = {
action: action,
base_currency: 'btc',
quote_currency: 'usd',
amount: Math.abs(_baseAmount),
amount_currency: baseCurrency.toLowerCase()
}, 'v1', 'quotes');
};

if (api.hasAccount) {
return api.authPOST('quote/', data, 'v1', 'quotes');
} else {
return api.POST('quote/', data, 'v1', 'quotes');
}
};

return super
Expand Down
3 changes: 3 additions & 0 deletions src/trade.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ class Trade extends Exchange.Trade {

if (obj !== null) {
this._id = obj.id.toLowerCase();
this._speedupAvailable = obj.speedup_available;
this.set(obj);
}
}

get isBuy () { return this._is_buy; }

get speedupAvailable () { return this._speedupAvailable; }

get expectedDelivery () { return this._expectedDelivery; }

setFromAPI (obj) {
Expand Down

0 comments on commit 0a8e788

Please sign in to comment.