Skip to content

Commit

Permalink
Merge pull request #66 from hareland/fix/CY-1983-use-ordertxid-as-ext…
Browse files Browse the repository at this point in the history
…ernal-id

CY-1983: Use ordertxid instead of key from object as externalId
  • Loading branch information
jeppenejsum authored Jan 28, 2025
2 parents f7fb387 + 7a79e2d commit c843817
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/ApiResponseConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function convertFromKrakenTrade(id, trade) {


return [ null, {
externalId: id,
externalId: trade.ordertxid,
timestamp: convertKrakenTimestampToISOString(trade.time),
state: 'closed',
baseCurrency,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@
"test": "LOG_LEVEL=fatal mocha --config .mocharc.json",
"test-watch": "LOG_LEVEL=info mocha --config .mocharc.json --watch"
},
"version": "2.5.2"
"version": "2.5.3"
}
2 changes: 1 addition & 1 deletion test/unit/apiResponseConverter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ describe('#ApiResponseConverter', function () {
it('convertFromKrakenTrade', () => {
const id = 'TCWJEG-FL4SZ-3FKGH6';
const [ err, trade ] = convertFromKrakenTrade(id, {
ordertxid: 'OQCLML-BW3P3-BUCMWZ',
ordertxid: id,
postxid: 'TKH2SE-M7IF5-CFI7LT',
pair: 'XETHZUSD',
time: Date.now()/1000,
Expand Down
10 changes: 10 additions & 0 deletions test/unit/listTradeHistoryForPeriod.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ describe('#listTradeHistoryForPeriod', function () {
maker: true
},
'OO3QCQ-SOJXH-NWMZZF': {
ordertxid: 'OO3QCQ-SOJXH-NWMZZF',
fee: '104.68207',
vol: '24.91800000',
cost: '58156.69775',
Expand All @@ -122,6 +123,7 @@ describe('#listTradeHistoryForPeriod', function () {
status: 'closed'
},
'OOEEE3QCQ-SOJXH-NWMZZF': {
ordertxid: 'OOEEE3QCQ-SOJXH-NWMZZF',
fee: '104.68207',
vol: '24.91800000',
cost: '58156.69775',
Expand All @@ -133,6 +135,7 @@ describe('#listTradeHistoryForPeriod', function () {
status: 'closed'
},
'OOUEE3QCQ-SOJXH-NWMZZF': {
ordertxid: 'OOUEE3QCQ-SOJXH-NWMZZF',
fee: '104.68207',
vol: '24.91800000',
cost: '58156.69775',
Expand All @@ -144,6 +147,7 @@ describe('#listTradeHistoryForPeriod', function () {
status: 'closed'
},
'EOUEE3QCQ-SOJXH-NWMZZF': {
ordertxid: 'EOUEE3QCQ-SOJXH-NWMZZF',
fee: '104.68207',
vol: '24.91800000',
cost: '58156.69775',
Expand All @@ -155,6 +159,7 @@ describe('#listTradeHistoryForPeriod', function () {
status: 'closed'
},
'IOUEE3QCQ-SOJXH-NWMZZF': {
ordertxid: 'IOUEE3QCQ-SOJXH-NWMZZF',
fee: '104.68207',
vol: '24.91800000',
cost: '58156.69775',
Expand All @@ -166,6 +171,7 @@ describe('#listTradeHistoryForPeriod', function () {
status: 'closed'
},
'ROUEE3QCQ-SOJXH-NWMZZF': {
ordertxid: 'ROUEE3QCQ-SOJXH-NWMZZF',
fee: '104.68207',
vol: '24.91800000',
cost: '58156.69775',
Expand All @@ -177,6 +183,7 @@ describe('#listTradeHistoryForPeriod', function () {
status: 'closed'
},
'KOUEE3QCQ-SOJXH-NWMZZF': {
ordertxid: 'KOUEE3QCQ-SOJXH-NWMZZF',
fee: '104.68207',
vol: '24.91800000',
cost: '58156.69775',
Expand All @@ -188,6 +195,7 @@ describe('#listTradeHistoryForPeriod', function () {
status: 'closed'
},
'KYUEE3QCQ-SOJXH-NWMZZF': {
ordertxid: 'KYUEE3QCQ-SOJXH-NWMZZF',
fee: '104.68207',
vol: '24.91800000',
cost: '58156.69775',
Expand Down Expand Up @@ -241,12 +249,14 @@ describe('#listTradeHistoryForPeriod', function () {
expect(trades).length(trades.length);
expect(trades).containSubset([
{
externalId: 'OQCLML-BW3P3-BUCMWZ',
baseCurrency: 'ETH',
quoteCurrency: 'USD',
baseAmount: 10000000000,
quoteAmount: -30010
},
{
externalId: 'OACLML-BW3P3-BUCMWZ',
baseCurrency: 'EUR',
quoteCurrency: 'USD'
},
Expand Down

0 comments on commit c843817

Please sign in to comment.