Tucsky / aggr

Cryptocurrency trades aggregator
https://charts.aggr.trade/
GNU General Public License v3.0
811 stars 232 forks source link

Fix Kraken futures trade feed #344

Closed adeacetis closed 1 year ago

adeacetis commented 1 year ago

For the pair PF_SOLUSD

  1. Kraken Futures platform - pro.kraken.com image

  2. https://charts.aggr.trade/zjqe

It's showing size in SOL instead of the size in USD image

  1. PR changes

Everything seems good now. image

We'll note another issue if we compare 1-2 is that trades are not showing up in the same order than on the kraken platform.

Also noticed an issue where time isn't showing two digit minutes (if you choose to display actual time of trades instead of elapsed time since the trade occured). This will be filed separately

Tucsky commented 1 year ago

To me it looks like it's already working

image

maybe they have multiple futures platform but PI_XBTUSD is being traded @ https://futures.kraken.com/trade/futures/PI_XBTUSD and is matching with what they are showing there, couldn't test any alts futures market because, there isn't any volume on any of those

adeacetis commented 1 year ago

PI_ are perpetual inverse listed on a whole different platform called CryptoFacilities according to the doc. image

Doc: https://support.kraken.com/hc/en-us/articles/360022835911-Inverse-Crypto-Collateral-Perpetual-Contract-Specifications

The change I made is for PF_ prefixed contract trading on pro.kraken.com

We could either reject entirely PI_ contracts OR create an edge case for them.

adeacetis commented 1 year ago

FYI

PI pairs in Kraken official doc: image

Pairs trading on CryptoFacilities: image

Tucsky commented 1 year ago

CryptoFacilities was aquired by Kraken in 4 years ago, it's now the same markets as the url I posted above

KRAKEN:BTC/USD on aggr is Kraken BTCUSD margin trade market https://pro.kraken.com/app/trade/margin-btc-usd

image

Number are also matching

adeacetis commented 1 year ago

Okay, but then the current code is working for PI pairs not for PF. We need to incorporate a new case.

Tucsky commented 1 year ago

I see

image

Yeah pf_ trades show qty... for consistency showing amount would be better 👍🏼

adeacetis commented 1 year ago

PR updated, please review

adeacetis commented 1 year ago

What should we do with CryptoFacilities ? I noticed you do some string manipulations with Futures contract that are actually trading on CryptoFacilities, but not the perps trading on Kraken. I wonder if we should actually offer PI and FI altogether since they aren't trading on the main Kraken platform.

CryptoFacilities offer their services only in England. Maybe we could create a new exchange instead. Since Kraken sees them as a separate entities (although from the same company holding), I think we should to

image

adeacetis commented 1 year ago

I didn't see your link. PI pairs are indeed trading on futures.kraken.com as well. They started consolidating both platforms this year but they didn't do the inverted perps. I dont know if they plan on doing it at some point.

Should we add a new filter to separate inverted perps and perp fut?

Tucsky commented 1 year ago

Should we add a new filter to separate inverted perps and perp fut?

Not sure if thats worth the time of studying every contracts on every deriv crypto exchanges supported here to implement the filter that would potentially slow down the search module

adeacetis commented 1 year ago

I understand, and yes, it makes sense not spending time to analyze every futures exchange products list.

However, for Kraken, we already have been removing prefixes for PI and FI pairs (see above). We don't do it for PF_ pairs while I think they are actually more important. PF are what most people trade most of the time.

image

Invert are usually crowded with traders willing to hedge LT holding. Volume is usually low except in a bull market. In the case of Kraken but it is also the case with Deribit, you need to post collateral in the underlying of the contract you're trading. It's important IMO.

Aggr users like aligning volume deltas of spots and perps, and a separation of fut perps and invert perps could also give very different information.

That said, I think we should leave PI and FI prefixes on the kraken pairs and remove it for PF_ as it is the most traded pair by far - it's more convenient for the majority of traders

Tucsky commented 1 year ago

However, for Kraken, we already have been removing prefixes for PI and FI pairs (see above).

They are not really removed

image this code, along with other symbol normalisation formatter allow us to map PI_XBTUSD (remote symbol) with BTCUSD (local symbol) for grouping purpose but it's still accessible via KRAKEN:PI_XBTUSD in scripts or in search (use local symbol turned off), so PF need to be added as "group by pair" should NOT show remote symbol (unknown to most user) image

exchanges are constantly changing things and I didn't knew they added thoses !! :)

adeacetis commented 1 year ago

Of course you didn't know ;)

There are hundreds of moving parts and it's constantly changing as you said.

Glad we've sorted out that one since I am using Kraken a lot lately ;)