Giter VIP home page Giter VIP logo

cryptocompareapi's Issues

Exception OutOfCallsException raised after multiple call of Historic.getPriceAtTime method

I'm trying to get price of Ether in USD from a CSV file. In each row, I have a timestamp and other informations. The file contains less than 27k rows.

I want to get the price of the Ether for each row from the timestamp. I used the method :

Historic.getPriceAtTime(Integer.valueOf(TimestampFromCsvFile), "ETH", "USD")

This method works fine but after a number of rows treated I get the following exception :

me.joshmcfarlin.CryptoCompareAPI.Utils.OutOfCallsException: No more HISTO calls are left, please try later.

Can someone explain me ? Thanks in advance.

a few extensions

Hi Josh

This project is useful, many thanks. I've had to hack a few extensions in to get it to do what I need though. Rather than a PR I'll just leave them here for you to do with as you wish as they need to be applied to all methods and better integrated.

  1. Add some more fields
    `
    public static History getHourFullargs(String fromSym, String toSym, int limit, String exchange, int aggregate, Integer toTs)
    throws IOException, OutOfCallsException {
    String formattedUrl = String.format("https://min-api.cryptocompare.com/data/histohour?fsym=%s&tsym=%s&limit=%d&e=%s&aggregate=%d",
    fromSym.toUpperCase(), toSym.toUpperCase(), limit, exchange, aggregate);

     if (toTs != null) {
     	formattedUrl = String.format("%s&toTs=%d", formattedUrl, toTs);
     }
     
     System.out.println(formattedUrl);
     
     Reader r = Connection.getJSON(new URL(formattedUrl), CallTypes.HISTO);
     return new Gson().fromJson(r, History.class);
    

    }
    `

  2. Wrap for limits > 2000:
    `
    private static List getHourHistory(CurrencyPair pair, int hours) throws IOException, OutOfCallsException {
    int samples = hours;
    List listData = new LinkedList<>();
    Integer timeFrom = null;
    Set listTimes = new HashSet<>(hours);

     boolean done = false;
     
     while (!done) {
     	// only returns ~2000 at a time
     	Historic.History history = Historic.getHourFullargs(pair.base.toString(), pair.counter.toString(), samples, "Cryptopia", 1, timeFrom);
    

// System.out.println(history.timeFrom + ", " + history.data.size());

		timeFrom = history.timeFrom - 1 ;	// start time of samples
		samples -= history.data.size();

// listData.addAll(history.data);

		for (Data data : history.data) {
			if (listTimes.contains(data.time)) {
				System.out.println("Duplicate timestamp: " + data.time + ", record ignored.");
			} else {
				listTimes.add(data.time);
				listData.add(data);
			}
		}
		
		if ((samples <= 0)
			||(history.timeFrom <= 0)
			||(history.data.size() <= 0)
			){
			done = true;
		}
	}

// System.out.println(listData.size());
return listData;
}
`

  1. Useful for debugging:
    @Override public String toString() { return "Data [time=" + time + " (" +Instant.ofEpochSecond(time) + ")" + ", open=" + open + ", high=" + high + ", low=" + low + ", close=" + close + ", volumeFrom=" + volumeFrom + ", volumeTo=" + volumeTo + "]"; }

Issue importing project

Hi Josh,

I've used the maven dependency you've provided in your readme and I'm having issues importing it.
image

Issue importing project from maven

Hi,

I wanted to use your wrapper in my project but it is not on maven repository anymore.

me.joshmcfarlin
CryptoCompareAPI
1.0-SNAPSHOT

"Missing artifact"

Is your readme not up to date?

Tyvm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.