🥳 RAPIDMINER 9.9 IS OUT!!! 🥳

The updates in 9.9 power advanced use cases and offer productivity enhancements for users who prefer to code.

CLICK HERE TO DOWNLOAD

Change unix time stamp on loop

websiteguywebsiteguy Member Posts: 24 Contributor II
edited August 2020 in Help
Hi - i have spent a lot of time searching the forum, but cant work it out.

Wondering if anyone can help me please. I am trying to loop using a macro and changing a value that is inserted in to the URL (a different UNIX timestamp) on each iteration,.

I want to do this in order to loop sucessive calls to the API to get more history data as per call it is limited to 2000 records (hours in this case).

So I would like to get a longer history in order to try some predictions on it.  

I have worked out how to get the last value of the UNIX time stamp from the first run, and then use that in a loop as the starting point for a second run and merge both sets of data to one file to get 4000 hours. 

The problem is I cant work out how to loop gain and change the value for a more sucessive times each loop. to get more history.

 -  The data is hour based ticker price, from cryptocompare limited to 2000 hours per call,

It is posible to insert the value from the earliest UNIX time stamp date from the first run to complete sucessive runs to get earlier data.

&limit=2000&toTs={the earliest timestamp received}

https://min-api.cryptocompare.com/data/histohour?fsym=%{fsym}&tsym=%{tsym}&limit=%{limit}&toTs=%{toTs}&api_key={api_key}

Process attached

(i have removed my API) you can get one free to test it.  from here https://min-api.cryptocompare.com/documentation?key=Historical&cat=dataHistohour


Any help appreciated - thanks, Lee


Best Answer

  • SGolbertSGolbert RapidMiner Certified Analyst, Member Posts: 344   Unicorn
    Solution Accepted
    Hi @websiteguy

    You should use the Generate Macro operator. With this you can update the macro's value by evaluating the previous value.



    Best,
    Sebastian


    websiteguy

Answers

  • hbajpaihbajpai Member Posts: 102   Unicorn
    How about you generate the macro "toTS" inside the loop again by subtracting the time as a function of iteration index. 
    Best,
    Harshit
  • websiteguywebsiteguy Member Posts: 24 Contributor II
    edited August 2020
    Hi @hbajpai, thanks for your reply. Im a novice, been struggling with this for 2 days :)

    Would it be possible to send me an example or screenshot of how to set up subtracting the time as function of iteration index, or modifing the processs file attached to my question as described? it would be greatly appreciated. Regards Lee
  • websiteguywebsiteguy Member Posts: 24 Contributor II
    Hi @SGolbert - thanks for reply :) pointed me in the right direction Generate macro was the Key. After some more exsperementing got it working where it loops through and collects data.

    Had to change the name of the second macro generated after the first loop to myMacro1 and use that value in toTs in the loop.

    Very happy to have sorted it out - thanks for your advice. happy to have spent two days trying to work it out and then sucess :) BOOM
    SGolbert
Sign In or Register to comment.