cryptoqween / cryptoqween.github.io Goto Github PK
View Code? Open in Web Editor NEWCryptoCompare API tutorials
CryptoCompare API tutorials
Hi,
Wondering if the following behavior is correct and/or where to get this info.
I can't seem to find a way to determine the "valid" range of available historical data.
As stated in the doc, if you require more data, adjust the timestamp to whatever you need (when not providing the info specifically, you will get the most recent info)
So I've made a simple loop, where I download the hourly historical data with a limit of 2000 (this yields 2001 results) and adjust to timestamp to the earliest incoming - 1 hour as the toTs for the next call. My stop condition has been set to any data response which yields less than 2001 responses. (meaning no more extra data available)
To my surprise, the loop continues to run and the call always returns 2001 entries. whatever timestamp provided, it is considered valid, with a 100 status code, and the response are just zeros.
I've cross-validated my script output with a direct call on the API documentation site and the results are the same.
Any insides on how to best solve this? The coin detailed info doesn't a valid range, except for a start data of the the coin and has no link to any listing data of any exchange.
I agree, that the issue could be solved by checking for all zero output, but in my opinion this is a really cumbersome approach.
specifying aggregation values on historic data request does take into account the limit size in the wrong way...
1 HistoMinute call with limit of 2000 return 2000 OHLC values (which is correct)
1 HistoMinute call with aggregate of 5 and limit 2000 returns 400 values (which is incorrect in my eyes)
it gets only worse with bigger aggregation...
in my opinion, the limit should be applied after the aggregation is done. I understand that it might require more processing on your end, but I guess this is minimal since it would be cached.
The problem is that if you need a certain amount of data to be able to make some calculations you need to make a lot requests which is suboptimal or sometimes not feasible for certain setups.
I hope this was an oversight and not by design... ๐
Hi,
I'm trying to use the CurrentAgg socket to get data on multiple symbols. when I'm testing it with 2 symbols (['5CCCAGGBTCUSD', '5CCCAGGETHUSD']) it works fine and I keep getting updates. But when I try to subscribe to 65 symbols, I get the first update and that's it.
Is there any limit/reason for that?
BTW, if I use the Current socket the updates keep coming.
Thanks,
Gal
I understand your are packing values and splitting the stream to send the same trade details more than once over the websocket, I am trying to generate OHLCV from the stream prices and OHLC is not the problem but the volume is.
Below is an example illustrating the problem, notice how the same trade ID has been streamed more than once. If I add the volume separately each time, it would be incorrect for sure. Even though the last volume is the same, the volume hour is changing by a small margin. Should I ignore this change in volume hour and consider the second value from the stream, or should I keep track of trade IDS. I want to just resample socket prices into 1 min OHLCV
TYPE 5
MARKET CCCAGG
FROMSYMBOL BTC
TOSYMBOL USD
FLAGS 1
PRICE 7192.47
LASTUPDATE 1535896593
LASTVOLUME 0.005
LASTVOLUMETO 35.932
**LASTTRADEID 288448864**
VOLUMEHOUR 48290.10139092038
VOLUMEHOURTO 351613292.0049536
VOLUME24HOUR 75295.16502406063
VOLUME24HOURTO 546351070.9446084
OPENHOUR 7203.46
HIGHHOUR 7384.38
LOWHOUR 7144.71
OPEN24HOUR 7060.66
HIGH24HOUR 7392.05
LOW24HOUR 7042.61
LASTMARKET Bitfinex
CHANGE24HOUR 131.8100000000004
CHANGE24HOURPCT 1.87
TYPE 5
MARKET CCCAGG
FROMSYMBOL BTC
TOSYMBOL USD
FLAGS 2
PRICE 7192.33
LASTUPDATE 1535896593
LASTVOLUME 0.005
LASTVOLUMETO 35.932
**LASTTRADEID 288448864**
VOLUMEHOUR 48290.12198587038
VOLUMEHOURTO 351613439.9668156
VOLUME24HOUR 75295.18561901062
VOLUME24HOURTO 546351218.9064704
OPENHOUR 7203.46
HIGHHOUR 7384.38
LOWHOUR 7144.71
OPEN24HOUR 7060.66
HIGH24HOUR 7392.05
LOW24HOUR 7042.61
LASTMARKET Bitfinex
CHANGE24HOUR 131.67000000000007
CHANGE24HOURPCT 1.86
Hello,
I am getting this message recently quite often. From client perspective, I do not invoke that many many subscriptions, what this metric is about?
Thanks.
I have a question of a basic nature that no tutorial has been able to answer to me. I was working with SourceTree in a local repo pushing to Github.com. At some point I decided to use Github Desktop, so I added the local repo and started to push to Github.com. I did not like this software, so I went back to SourceTree. Opened my project there but changes were not being tracked anymore. I wonder if one can use two git managers for tracking changes or else I don't know what went wrong.
Hello. I am trying to connect to the websocket using python.
I am using the python websocket-client module the following way.
socket = websocket.WebSocket()
socket.connect('wss://streamer.cryptocompare.com')
However, when i try to connect, i get an error that the websocket is already closed.
Am I doing something wrong or is there an issue with the web socket?
Socket drops connection after a while and does not allow to reconnect. Anyone has similar issue?
Hi,
I am trying to interpret the aggregated trades websocket stream for CCCAGG, subscribing to several symbols, and i'm able to decode the messages fine.
I'm interested in the price and quantity for each aggregated trade, so I am looking at the fields "price" and "lastvolume", which I assume match to these. (Though I am not sure what the "last" in "lastvolume" and other fields is referring to?) I am also looking at "lasttradeid" and "lastexchange" in order to do some checking.
The problem I am facing is that a lot of the messages seem to be incomplete; they contain some but not all of the mentioned fields. I also see the same "lasttradeid" repeating.
This makes me think that single aggregated trades have been split into multiple messages that need to be re-combined?
How do I do this recombining? My first assumption would be to use "lasttradeid" as the key. However, there are messages where this field is also missing. Is it enough to combine on "symbol"?
Please clarify this aspect of the websocket API, as I expect this to be an issue for most people trying to use it. The examples do not seem to do any re-combining, they just show the data as is.
Hi,
found that some price (B3/BTC) with 8 decimal 0.00000012 will display as 1.2e-7. Hope this can be fixed thank you!
Hello,
been using your script for a week or two without problems under windows and Chrome. Suddenly earlier this week Chrome is crashing without any error message. It seems memory usage is pretty high before crashing, could be the cause, but not entirely sure.
When I run the same script under Internet Explorer, it seems fine, memory usage is much lower. Only problem is that I added a few lines to download a file automatically but that part of mine does not work under IE, not sure why. But this is not why i'm posting as this is my code.
Just wondering if others run it under Chrome without problem recently.
hello!! how to add other exchanges for this sample? such as Binance, OKEx ....
Hi,
I'am having some problems to understand conversion when the crypto does not trade directly into the symbol requested. For example if i call the Subswatchlist API for BTPL to USD it says that conversion of type multiply is need:
https://min-api.cryptocompare.com/data/subsWatchlist?fsyms=BTPL&tsym=USD
{
"BTPL":{
"Conversion":"multiply",
"ConversionSymbol":"BTC",
"CurrencyFrom":"BTPL",
"CurrencyTo":"USD",
"Market":"CCCAGG",
"Supply":6323098,
"TotalVolume24H":0,
"SubBase":"5~",
"SubsNeeded":[
"5~CCCAGG~BTPL~BTC",
"5~CCCAGG~BTC~USD"
],
"RAW":[
"5~CCCAGG~BTPL~BTC~4~0.0000011~1510552626~119.99998961~0.000131999988571~1510552626001~0~0~2981.60547588~0.0031467340322768006~0.0000011~0.0000011~0.0000011~0.00000101~0.0000011~0.00000101~Novaexchange~7ffe9",
"5~CCCAGG~BTC~USD~4~6844.52~1522868284~0.0098013~66.832908414~41075622~102732.02342399546~732012286.0325726~121610.80288089329~873375007.7504779~7434.3~7442.42~6756.34~7497.83~7533.47~6752.96~Coinbase~7ffe9"
]
}
}
So from the doc if i understand well it says to multiply values BTPL to BTC by BTC to USD. It works well for the price field but for fields like openDay or change24Hour it is not giving right values: i verify it by calling the full data price API which also uses BTC as conversion:
https://min-api.cryptocompare.com/data/pricemultifull?fsyms=BTPL&tsyms=USD
{
"RAW":{
"BTPL":{
"USD":{
"TYPE":"5",
"MARKET":"CCCAGG",
"FROMSYMBOL":"BTPL",
"TOSYMBOL":"USD",
"FLAGS":"4",
"PRICE":"0.007540",
"LASTUPDATE":1522868668,
"LASTVOLUME":0,
"LASTVOLUMETO":0,
"LASTTRADEID":0,
"VOLUMEDAY":0,
"VOLUMEDAYTO":0,
"VOLUME24HOUR":0,
"VOLUME24HOURTO":0,
"OPENDAY":"0.007540",
"HIGHDAY":"0.007540",
"LOWDAY":"0.007540",
"OPEN24HOUR":"0.006923",
"HIGH24HOUR":"0.007540",
"LOW24HOUR":"0.006923",
"LASTMARKET":"Novaexchange",
"CHANGE24HOUR":0.0006169999999999995,
"CHANGEPCT24HOUR":8.912321248013859,
"CHANGEDAY":0,
"CHANGEPCTDAY":0,
"SUPPLY":6323098,
"MKTCAP":47676.15892,
"TOTALVOLUME24H":0,
"TOTALVOLUME24HTO":0
}
}
}
}
I would like to know if you have a conversion example that you could post for a crypto that does not trade directly into the symbol requested.
Thanks.
I have two queries:
["0~Cryptsy~BTC~USD", "0~Bitstamp~BTC~USD"]
but when I try the same in CCCAGG, I do not get dataOR for example, 5~Bitstamp~BTC~USD
does not provide any data over the websocket but 2~Bitstamp~BTC~USD
does
OR for example 0~CCCAGG~BTC~USD
does not provide any data over the websocket but 5~CCCAGG~BTC~USD
does
Sample Response:
09:11:10.067 websocketMiddleware.js:153 0~CCCAGG~BTC~USD
09:11:10.067 websocketMiddleware.js:153 3~LOADCOMPLETE
How do I know which exchange provides trade data and which exchange provides CURRENTAGG data?
Thank you
It seems that some information is only available through polling and not streaming. examples of these include day open (let's say UTC+0) and change since open. If we could fetch these similar to the 1h/24h variants that would be great and avoids us the polling. any chance of this being added?
I try to unsubscribe but it aint working this is my code.
const subscription = ['2~' + exchange + '~' + coin + '~' + valuta]; console.log(subscription) this._socket.emit('SubRemove', subscription,function(res){ console.log(res) });
Someon can help me?
Good day!
i just noticed that the the to and from symbol for this command:
"https://min-api.cryptocompare.com/data/pricemultifull?fsyms=BTC&tsyms=XRP"
is using the symbol of ethereum. i'm not sure about the rest but you could check it.
i hope you could fix this.
I know its beens a while since you posted this but I was wondering would you know the max amount of symbols allowed to be streamed?
Cheers
I'm connecting fine to the socket.io server but I am not getting any messages from subscriptions. I would appreciate if you could point out what I'm doing wrong.
client, err := gosocketio.Dial(
gosocketio.GetUrl("streamer.cryptocompare.com", 443, true),
transport.GetDefaultWebsocketTransport())
if err != nil {
logrus.Fatal(err)
}
watcher.client = client
err = watcher.client.On("m", func(h *gosocketio.Channel, args Message) {
logrus.Println("--- Got message: ", args)
})
if err != nil {
logrus.Fatal(err)
}
err = watcher.client.On(gosocketio.OnDisconnection, func(h *gosocketio.Channel) {
logrus.Fatal("Disconnected")
})
if err != nil {
logrus.Fatal(err)
}
err = watcher.client.On(gosocketio.OnConnection, func(h *gosocketio.Channel) {
logrus.Println("Connected")
})
if err != nil {
logrus.Fatal(err)
}
watcher.client.Emit("SubAdd", "{ subs: ['0~Poloniex~BTC~USD'] }")
CCC.TRADE.FLAGS = {
'SELL' : 0x1 // hex for binary 1
, 'BUY' : 0x2 // hex for binary 10
, 'UNKNOWN' : 0x4 // hex for binary 100
}
But crypto compare shows:
Flag Description
1 Buy
2 Sell
4 Unknown
Any idea which is correct?
Hi,
I notice today that I was receiving messages with a flag value of 0
. I'm subscribed to Current.
Example of messages:
"2~Kraken~BTC~EUR~0~5250.542889769999~82158362.46584696~15840~8c00"
^โโ flag
"2~Kraken~BTC~USD~0~3022.9073560299994~56512986.796085~19219~19258.4~18c00"
^โโ flag
A zero value isn't documented in the API neither in https://github.com/cryptoqween/cryptoqween.github.io/blob/master/streamer/ccc-streamer-utilities.js. Could you please provide some information about it?
When calling the REST API on the 'Multiple Syms Full Data' endpoint with currencies like EOS, certain entries such as 'SUPPLY' and 'MKTCAP' seem to return 0 as the value. Any chance this is being fixed soon.
Thanks,
Rohan
What is the purpose of MaskInt? How exactly should this be used?
It appears to be a hex which is being converted into a decimal in the example code. Does the decimal value have significance? The sample code just appears to check that its a valid Int.
Thanks.
Hi,
I got this issue that the 24h Change will display : ฮ NaN (NaN%) after sometime, it happens with your example streamer/current also, it will stay there for several minutes than display back the actual price change and percentage. Is this a bug or normal?
Screenshot
https://imgur.com/a/cRbuQ
Another issue I have is I'm not able to get the the data from BLK and XPM coin, I have included '5CCCAGGXPMUSD', '5CCCAGGBLKUSD' in the var subscription. BLK display old and inactive quotes and XPM show nothing. I can add LTC, DASH, BCH and they load fine. Can you help me with this?
Thank you so much.
Hello
I try to get current stream data with below code but got nothing in response.
Here is my code
static let sharedInstance = SocketIOManager()
// let socketManager = SocketManager(socketURL: URL(string: "https://streamer.cryptocompare.com/")!, config: [.log(true),.forceWebsockets(true),.compress])
let socketManager = SocketManager(socketURL: URL(string: "https://streamer.cryptocompare.com/")!, config: [.log(true)])
var socket : SocketIOClient!
override init() {
super.init()
socket = socketManager.defaultSocket
socket.onAny {
print("Any Got event: \($0.event), with items: \($0.items!)")
}
socket.on("m") { dataArray, ack in
let subscription = ["5~CCCAGG~BTC~USD"];
self.socket.emitWithAck("SubAdd", subscription).timingOut(after: 0) {data in
self.socket.emit("SubAdd", subscription)
}
}
socket.connect()
}
System infomation
Swift ver : 3.0
Xcode ver : 9.2
Update documentation to clarify that timestamp is in epoch seconds and not epoch milliseconds
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.