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

missing aff_code bug in updateOrder #79

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
# 1.8.1
- fix: Add extra Weighted Averages fields for trades timestamps
#1.6.4
- fix: added missing aff_code in updateOrder

# 1.8.0
- feature: Weighted Averages model

# 1.7.1
- fix: Change FundingOffer, Order, Position model to support new rest api signature
- fix: Test coverage to support new rest api signature

# 1.7.0
- feature: Currency Movement Info model

# 1.6.3
#1.6.3
- fix: public trade unserializing from snapshot

# 1.6.2
#1.6.2
- feature: visible on hit option supported for hidden orders

# 1.6.0
Expand Down
4 changes: 2 additions & 2 deletions docs/AccountSummary.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Alert.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/AuthPermission.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/BalanceInfo.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Candle.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/ChangeLog.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/CoreSettings.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Currency.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/FundingCredit.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/FundingInfo.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/FundingLoan.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/FundingOffer.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/FundingTicker.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/FundingTickerHist.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/FundingTrade.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Invoice.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/LedgerEntry.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Liquidations.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Login.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/MarginInfo.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Model.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Movement.html

Large diffs are not rendered by default.

1,047 changes: 0 additions & 1,047 deletions docs/MovementInfo.html

This file was deleted.

4 changes: 2 additions & 2 deletions docs/Notification.html

Large diffs are not rendered by default.

338 changes: 37 additions & 301 deletions docs/Order.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/OrderBook.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Position.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/PublicPulseProfile.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/PublicTrade.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/PulseMessage.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/StatusMessagesDeriv.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/SymbolDetails.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Trade.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/TradingTicker.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/TradingTickerHist.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/TransactionFee.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/UserInfo.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Wallet.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/WalletHist.html

Large diffs are not rendered by default.

817 changes: 0 additions & 817 deletions docs/WeightedAverages.html

This file was deleted.

4 changes: 2 additions & 2 deletions docs/account_summary.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/alert.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/auth_permission.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/balance_info.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/candle.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/change_log.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/core_settings.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/currency.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/funding_credit.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/funding_info.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/funding_loan.js.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/funding_offer.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/funding_ticker.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/funding_ticker_hist.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/funding_trade.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/global.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/invoice.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/ledger_entry.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/liquidations.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/login.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/margin_info.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/model.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/movement.js.html

Large diffs are not rendered by default.

178 changes: 0 additions & 178 deletions docs/movement_info.js.html

This file was deleted.

4 changes: 2 additions & 2 deletions docs/notification.js.html

Large diffs are not rendered by default.

41 changes: 4 additions & 37 deletions docs/order.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/order_book.js.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/position.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/public_pulse_profile.js.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/public_trade.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/pulse_message.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/status_messages_deriv.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/symbol_details.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/trade.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/trading_ticker.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/trading_ticker_hist.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/transaction_fee.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/user_info.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/util_assign_from_collection_or_instance.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/util_is_collection.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/validators_amount.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/validators_array.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/validators_bool.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/validators_currency.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/validators_date.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/validators_number.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/validators_object.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/validators_price.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/validators_string.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/validators_symbol.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/wallet.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/wallet_hist.js.html

Large diffs are not rendered by default.

143 changes: 0 additions & 143 deletions docs/weighted_averages.js.html

This file was deleted.

4 changes: 2 additions & 2 deletions lib/funding_offer.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class FundingOffer extends Model {
throw new Error('no API interface provided')
}

return apiInterface.submitFundingOffer({ offer: this }).then((offerArray) => {
return apiInterface.submitFundingOffer(this).then((offerArray) => {
Object.assign(this, FundingOffer.unserialize(offerArray))
return this
})
Expand All @@ -115,7 +115,7 @@ class FundingOffer extends Model {
throw new Error('no API interface provided')
}

return apiInterface.cancelFundingOffer({ id: this.id }).then((offerArray) => {
return apiInterface.cancelFundingOffer(this.id).then((offerArray) => {
Object.assign(this, FundingOffer.unserialize(offerArray))
return this
})
Expand Down
2 changes: 0 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ module.exports = {
LedgerEntry: require('./ledger_entry'),
Liquidations: require('./liquidations'),
Movement: require('./movement'),
MovementInfo: require('./movement_info'),
UserInfo: require('./user_info'),
Currency: require('./currency'),
StatusMessagesDeriv: require('./status_messages_deriv'),
Expand All @@ -39,7 +38,6 @@ module.exports = {
AccountSummary: require('./account_summary'),
AuthPermission: require('./auth_permission'),
CoreSettings: require('./core_settings'),
WeightedAverages: require('./weighted_averages'),

isCollection: require('./util/is_collection')
}
105 changes: 0 additions & 105 deletions lib/movement_info.js

This file was deleted.

9 changes: 7 additions & 2 deletions lib/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@ class Order extends Model {

changes.id = this.id // tag with ID

if (_isString(this.affiliateCode) && !_isEmpty(this.affiliateCode)) {
changes.meta = {};
changes.meta.aff_code = this.affiliateCode // eslint-disable-line
}

if (changes.price) changes.price = preparePrice(changes.price)
if (changes.amount) changes.amount = prepareAmount(changes.amount)
if (changes.delta) changes.delta = prepareAmount(changes.delta)
Expand Down Expand Up @@ -482,7 +487,7 @@ class Order extends Model {
throw new Error('no API interface provided')
}

const orderArr = await apiInterface.submitOrder({ order: this })
const orderArr = await apiInterface.submitOrder(this)
Object.assign(this, Order.unserialize(orderArr))
return this
}
Expand All @@ -497,7 +502,7 @@ class Order extends Model {
if (!apiInterface) throw new Error('no API interface provided')
if (!this.id) throw new Error('order has no ID')

return apiInterface.cancelOrder({ id: this.id })
return apiInterface.cancelOrder(this.id)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Position extends Model {
throw new Error('claim position only supported on RESTv2')
}

return apiInterface.claimPosition({ id: this.id }).then((positionArray) => {
return apiInterface.claimPosition(this.id).then((positionArray) => {
Object.assign(this, Position.unserialize(positionArray))
return this
})
Expand Down
70 changes: 0 additions & 70 deletions lib/weighted_averages.js

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bfx-api-node-models",
"version": "1.8.1",
"version": "1.6.4",
"description": "Object models for usage with the Bitfinex node API",
"engines": {
"node": ">=8.3.0"
Expand Down Expand Up @@ -41,7 +41,7 @@
},
"homepage": "http://bitfinexcom.github.io/bfx-api-node-models/",
"devDependencies": {
"bfx-api-node-rest": "^5.1.0",
"bfx-api-node-rest": "^4.1.2",
"chai": "^4.2.0",
"docdash": "^1.2.0",
"husky": "^4.2.3",
Expand Down
7 changes: 1 addition & 6 deletions test/lib/models/candle.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ describe('Candle model', () => {

it('unserializes live data correctly', async () => {
const rest = new RESTv2()

const arr = await rest.candles({
timeframe: '1D',
symbol: 'tBTCUSD',
section: 'hist'
})
const arr = await rest.candles('tBTCUSD')

arr.forEach(candle => {
const obj = Candle.unserialize(candle)
Expand Down
2 changes: 1 addition & 1 deletion test/lib/models/funding_ticker.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe('FundingTicker model', () => {

it('unserializes live data correctly', async () => {
const rest = new RESTv2()
const arr = await rest.ticker({ symbol: 'fUSD' })
const arr = await rest.ticker('fUSD')
const obj = FundingTicker.unserialize(arr)

assert.strictEqual(obj.symbol, arr[0])
Expand Down
2 changes: 1 addition & 1 deletion test/lib/models/funding_ticker_hist.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('FundingTicker history model', () => {

it('unserializes live data correctly', async () => {
const rest = new RESTv2()
const arr = await rest.ticker({ symbol: 'fUSD' })
const arr = await rest.ticker('fUSD')
const obj = FundingTickerHist.unserialize(arr)

assert.strictEqual(obj.symbol, arr[0])
Expand Down
50 changes: 0 additions & 50 deletions test/lib/models/movement_info.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/lib/models/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ describe('Order model', () => {
it('calls cancelOrder on the interface', (done) => {
const o = new Order({ id: 42 })
o.cancel({
cancelOrder: async ({ id }) => {
cancelOrder: async (id) => {
assert.strictEqual(id, 42)
done()
return []
Expand Down
Loading