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

Seems that lumens are not recognised and fall back to undefined #367

Closed
KIC opened this issue Oct 21, 2017 · 11 comments
Closed

Seems that lumens are not recognised and fall back to undefined #367

KIC opened this issue Oct 21, 2017 · 11 comments
Assignees

Comments

@KIC
Copy link

KIC commented Oct 21, 2017

I use kraken exchange and I query the ordery by using fetchMyTrades. It seems that Lumens (XLM) are not supported by the generalized API.

6:05:07 PM:   Object {
6:05:07 PM:     "action": "buy",
6:05:07 PM:     "amount": ??,
6:05:07 PM:     "info": Object {
6:05:07 PM:       "cost": "??",
6:05:07 PM:       "fee": "??",
6:05:07 PM:       "id": "TNS6ZE-O67HH-XXXXXX",
6:05:07 PM:       "margin": "0.00000000",
6:05:07 PM:       "misc": "",
6:05:07 PM:       "ordertxid": "O6VUNT-ZS3L5-XXXXX",
6:05:07 PM:       "ordertype": "limit",
6:05:07 PM:       "pair": "XXLMZEUR",
6:05:07 PM:       "price": "",
6:05:07 PM:       "time": ,
6:05:07 PM:       "type": "buy",
6:05:07 PM:       "vol": "",
6:05:07 PM:     },
6:05:07 PM:     "price": 0.015805,
6:05:07 PM:     "symbol": undefined,
6:05:07 PM:   },
@kroitor
Copy link
Member

kroitor commented Oct 21, 2017

Hi! Thanks for reporting, i'll take a look into it and will get back to you asap!

@kroitor kroitor self-assigned this Oct 21, 2017
@kroitor
Copy link
Member

kroitor commented Oct 21, 2017

This issue should be fixed in version 1.9.224+. Can you please update the library and retry the same code again? We will be thankful if you report back whether it works for you or not (it should). Thx, standing by for your reply.

@KIC
Copy link
Author

KIC commented Oct 22, 2017

Thanks for your really fast reaction. Sadly I still have an undefined symbol on the following transaction

 Object {
  "cost": "000000",
  "fee": "0.0000",
  "id": "TNS6ZE-O67HH-XXXXXX",
  "margin": "0.00000000",
  "misc": "",
  "ordertxid": "O6VUNT-ZS3L5-XXXXXX",
  "ordertype": "limit",
  "pair": "XXLMZEUR",
  "price": "0.01580500",
  "time": 1502625003.5281,
  "type": "buy",
  "vol": "0000000",
}

I have upgraded to 1.9.227

npm list
AwesomeProject@0.1.0 C:\Users\KIC\AwesomeProject
+-- ccxt@1.9.227
| +-- crypto-js@3.1.9-1
| +-- node-fetch@2.0.0-alpha.8
| `-- qs@6.5.0
+-- expo@21.0.2

@kroitor
Copy link
Member

kroitor commented Oct 22, 2017

@KIC

Sadly I still have an undefined symbol on the following transaction

You're looking at unparsed 'info' substructure, you should look into fetchMyTrades parsed return for symbol should be there. Try this:

"use strict";
const ccxt = require ('ccxt')
(async function main () {

    const kraken = new ccxt.kraken ({
        apiKey: "YOUR_API_KEY",
        secret: "YOUR_SECRET",
    }) 

    const trades = await kraken.fetchMyTrades ()

    trades.forEach (trade => console.log (trade.id, trade.datetime, trade.symbol))
}) ()

@KIC
Copy link
Author

KIC commented Oct 22, 2017

this is what I do:

kraken.fetchMyTrades()
          .then(ob => {
            //console.log(ob.map(o => { return { action: o.side, symbol: o.symbol, amount: o.amount, price: o.price, info: o.info  }}))
            console.log(ob.reduce((res, o) => {
              res[o.symbol] = res[o.symbol] || [];
              res[o.symbol].push({ symbol: o.symbol, amount: o.amount * (o.side == "buy" ? 1 : -1), price: o.price })
              if (o.symbol == undefined) console.warn(o.info)
              return res;
            }, {}))
          })

the result is still undefined:
],
11:25:25 AM: "undefined": Array [
11:25:25 AM: Object {
11:25:25 AM: "amount": 000000,
11:25:25 AM: "price": 0.015805,
11:25:25 AM: "symbol": undefined,
11:25:25 AM: },
11:25:25 AM: ],

@kroitor
Copy link
Member

kroitor commented Oct 22, 2017

Try this:

kraken.fetchMyTrades().then(ob => {
    ob.forEach (trade => console.log (trade.symbol))  
})

Does it output undefined symbols? If it does, we will debug it further.

@KIC
Copy link
Author

KIC commented Oct 22, 2017

I don't see how this should be different but here we go:

11:44:15 AM: ETH/EUR
11:44:15 AM: ETC/EUR
11:44:15 AM: LTC/EUR
11:44:15 AM: undefined
11:44:15 AM: ZEC/EUR

@KIC
Copy link
Author

KIC commented Oct 22, 2017

or kraken.fetchMyTrades().then(ob => { ob.forEach (trade => console.log (trade.symbol, trade.info.pair))})

results in:
11:47:50 AM: undefined XXLMZEUR

Hmmm I am pretty sure this pair is not traded anymore. But anyhow for historic P/L claculations I would prefer not to be forced using the unparsed info field.

@kroitor
Copy link
Member

kroitor commented Oct 22, 2017

The problem is indeed caused by the Kraken not returning market info for XLM/EUR anymore. We can't add it to the list of active markets, because users will be confused and will try trading it. I will add a workaround for that, so that it will be defined in trades and orders.

@kroitor
Copy link
Member

kroitor commented Oct 22, 2017

@KIC ok, can you please update to 1.9.228+ and try the same code again? XLM/EUR should be recognized and parsed correctly now. Let us know if it works for you or not. Thx!

@KIC
Copy link
Author

KIC commented Oct 24, 2017

yes thats it! thx!

academe-01 pushed a commit to academe-01/ccxt that referenced this issue Oct 2, 2022
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

2 participants