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

Bug: public funding trades mapping is wrong. #555

Closed
1 of 4 tasks
michael34435 opened this issue Jul 10, 2020 · 9 comments
Closed
1 of 4 tasks

Bug: public funding trades mapping is wrong. #555

michael34435 opened this issue Jul 10, 2020 · 9 comments

Comments

@michael34435
Copy link

michael34435 commented Jul 10, 2020

Issue type

  • bug
  • missing functionality
  • performance
  • feature request

Brief description

Public funding trade mapping is wrong. There is no maker column in public funding trades.

Steps to reproduce

const BFX = require('bitfinex-api-node');
const bfx = new BFX(
  {
    apiKey: 'xxxxx',
    apiSecret: 'xxxxx',
    ws: {
      autoReconnect: true,
    },
  },
);
const ws = bfx.ws(2, { transform: true });

ws.once('open', () => {
  ws.subscribeTrades(`fUSD`);
  ws.on('trades', console.log);
});

ws.open();

output:

fUSD [
  {
    id: 161367901,
    symbol: 1594289406000,
    mtsCreate: -51.4457011,
    offerID: 0.00020119,
    amount: 3,
    rate: undefined,
    period: undefined,
    maker: undefined
  }
]
Additional Notes:

I had found the same issue in 4.0.2 - 4.0.15 ;(

@crazyguitar
Copy link

Hi,

I fixed this issue and am waiting for reviewing now.

@iccicci
Copy link

iccicci commented Feb 14, 2022

Hi all, (and @crazyguitar )

I can read comment about 1 year and half ago stating the issue was fixed, but in v5.0.3 the issue is still alive.

Could I please have an estimation of when the fix will be merged and published?

Thank you

@vigan-abd
Copy link
Contributor

Hi @iccicci @crazyguitar , we'll take a look at the issue asap, thanks for the info

@iccicci
Copy link

iccicci commented Feb 15, 2022

Hi @vigan-abd,

I've checked the funding_trade.js file in the bfx-api-node-models package:

  1. the const fields mapping respects exactly what the API documentation says;
  2. with a console.log in the unserialize method, I saw the data is [ [ 267665633, 1644877838000, -0.1, 0.00002297, 2 ] ] (I would say: ID, MTS_CREATE, AMOUNT, RATE, PERIOD);

I also checked the ws2.js file in this package, and it seems the set of data is not configurable; it is as is when it arrives from the websocket: I'm afraid this needs to be escalated on BitFinex

@ghost
Copy link

ghost commented Feb 16, 2022

There is a simple fix: to use PublicTrade instead of FundingTrade, since it is already designed for this, but this will be a breaking change

Public Funding trade has format

 [
    ID,
    MTS,
    AMOUNT,
    RATE,
    PERIOD
  ]

while finding trades

  [
  ID,
  CURRENCY,
  MTS_CREATE,
  OFFER_ID,
  AMOUNT,
  RATE,
  PERIOD,
  MAKER
]

and as far as I found out correctly, _handleTradeMessage receives only data from public trades channel, so FundingTrade should not be used in this case

@vigan-abd wdyt?

@ghost
Copy link

ghost commented Feb 17, 2022

fixed in #578

@vigan-abd
Copy link
Contributor

thanks @vitaliystoliarovcc for investigating and providing a fix :)
@iccicci can you confirm that we solved the issue so we can close the ticket?
latest package release that includes the fix is https://www.npmjs.com/package/bitfinex-api-node/v/5.0.4

@iccicci
Copy link

iccicci commented Feb 22, 2022

Sorry for my late reply @vigan-abd , I'm so busy in this period...
Yes, it seems now the fields are correct.
Thank you

@vigan-abd
Copy link
Contributor

thanks for confirming @iccicci, we're glad we could help :)

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

No branches or pull requests

4 participants