I hereby claim:
- I am vcealicu on github.
- I am zerocool86 (https://keybase.io/zerocool86) on keybase.
- I have a public key whose fingerprint is F67E A2C1 5FAD AECA 186C E991 44E5 E6D3 B258 B304
To claim this, I am signing this object:
/* this function relies on a method to transform the data from multiple decimals to a more human readable format. I'm using util.reduceFloatVal | |
* in here but feel free to use whatever you want. This applies to api responses for historical data from cryptocompare. | |
* The interval parameter refers to seconds used in the current request time period. For requests on the minute api with no aggregation | |
* use 60 seconds, for an aggregation of 5 minutes on your request use 5*60 seconds. On the hourly api use 60*60 for no aggregation, | |
* for an aggregation of 12 hours for example use 12*60*60. For the daily api use 24*60*60 for no aggregation | |
*/ | |
CCC.STATIC.UTIL = { | |
reduceFloatVal : function(value){ | |
value = parseFloat(value); | |
if(value>1){ |
I hereby claim:
To claim this, I am signing this object:
var CCC = CCC || {}; | |
CCC.STATIC=CCC.STATIC || {}; | |
CCC.STATIC.TYPE={ | |
'TRADE' : '0' | |
, 'FEEDNEWS' : '1' | |
, 'CURRENT' : '2' | |
, 'LOADCOMPLATE' : '3' | |
, 'COINPAIRS' : '4' |
angular.module('ccc-app').factory('socketWrapper',['$rootScope','$interval', function socketWrapperFactory($rootScope,$interval) { | |
//none of the streamer controllers will actually update the intrace so i use this interval function to do the updates.... | |
//i specifically prohibit it from calling scope apply at the end because i am calling it inside... did this to make | |
//easier to understand what it does. | |
$interval(function() {$rootScope.$apply();}, 200,0,false); | |
return io.connect('https://streamer.cryptocompare.com/', {secure: true}); | |
}]); | |
angular.module('ccc-app').factory('streamerUtilities',['$rootScope','$filter','socketWrapper','subscriptionManager', | |
function streamerUtilitiesFactory($rootScope,$filter,socketWrapper,subscriptionManager){ |
$scope.connection = streamerUtilities.initConnection(); | |
$scope.progressBar = streamerUtilities.initProgressBar(); | |
$scope.ordering = streamerUtilities.initOrdering(); | |
$scope.isStreaming = streamerUtilities.getStreamingStatus(); | |
$scope.connection.subs = ['5~CCCAGG~BTC~USD'] //will give you the BTC-USD price | |
$scope.connection.subs.push('5~CCAGG~ETH~BTC') //will add the ETH-BTC price as well | |
//The format of the subscriptions is: for our index: 5~CCCAGG~{FromSymbol}~{ToSyombol} | |
//For trades it is: 0~{ExchangeName}~{FromSymbol}~{ToSyombol} |
........... | |
calculateVolumePriceConversionCoefficient = function(currentObj1, currentObj2, timestampForCalculation){ | |
var timePassedObj1 = timestampForCalculation - currentObj1.LASTUPDATE; | |
var timePassedObj2 = timestampForCalculation - currentObj2.LASTUPDATE; | |
//negative or 0 cap it at 1 | |
if(timePassedObj1 <=0 ){ timePassedObj1 = 1; } | |
if(timePassedObj2 <=0 ){ timePassedObj2 = 1; } | |
//if last update is more than 1 day ago cap it at 1 day | |
if(timePassedObj1 > 86400){ timePassedObj1 = 86400; } |