Unable to load multi-year 1h t6 file

Posted By: TrumpLost

Unable to load multi-year 1h t6 file - 03/10/22 05:17

I'm having trouble loading my t6 file, it has 1 hour data that I converted from CSV using the CSVtoHistory script. This is my script:
Code
void main() {
    BarPeriod = 60;
    // StartDate = "2011-08-18";
    asset("BTCUSD");
    History = "History\\*_1h.t6";
    set(PLOTNOW);
}

void run() {
    vars Prices = series(price());
}


First I just want to plot my BTC 1hour data, and once I can do that, I want to try some analysis. But I can't even get the price chart to come up. I can't figure out what Zorro wants from me.

Here's Zorro's output when I run the script:
Code
Warning 034: BTCUSD not in asset list
Error 047: BTCUSD no 2017 history (History\BTCUSD.t6)
Error 047: BTCUSD 2017..2022 no data
Error 047: No bars generated
Error 047: No bars to plot


So given this unhelpful error message, I thought I should try setting the StartDate value, which you can see is commented out in my code. If I uncomment and run, Zorro crashes.

I'm a little frustrated. Could somebody tell me what I need to do to tell Zorro to use my t6 file?
Posted By: Grant

Re: Unable to load multi-year 1h t6 file - 03/10/22 09:51

Normally the .t6 file would be BTCUSD_YYYY.t6 for this asset, but you define it like BTCUSD_1h.t6 in your History setting. Is that file available in your history folder?

Your StartDate syntax is wrong, it should be YYYYMMDD

Code
Warning 034: BTCUSD not in asset list


This isn't an 'unhelpful error message', it means that you need to define BTCUSD in your asset list.
Posted By: Petra

Re: Unable to load multi-year 1h t6 file - 03/10/22 17:06

Fix the asset list, fix the wrong start date and and set History before loading it and not afterwards.
Posted By: TrumpLost

Re: Unable to load multi-year 1h t6 file - 03/10/22 18:49

Okay, thanks for the help folks. I've made the corrections mentioned and it works now.

Here's the updated script:
Code
void main() {
    BarPeriod = 60;
    StartDate = 20110818;
    History = "History\\*_1h.t6";
    asset("BTC/USD");
    set(PLOTNOW);
}

void run() {
    vars Prices = series(price());
}


Note: The following code won't work:
Code
History = "History\\BTCUSD_1h.t6";


Zorro interprets this as `History\BTCUSDBTCUSD_1h.t6`. I guess Zorro demands that the asset name be dynamically prepended to whatever filename I give it.

I haven't seen a tutorial for this elsewhere, so I'd suggest one be added. If I can volunteer to contribute the tutorial, I'm happy to do so. I used Jupyter Notebook to DL the OHLC data from Bitstamp and save to CSV, so I could run it through CSVtoHistory. Is there an easier way to do this? Given that Bitstamp data is JSON format, is formatting to CSV using Pandas the most efficient approach?

Another question: In the CSVtoHistory script, some of the date format strings start with `+-`, and I don't see an explanation for the `-` symbol in the Zorro help docs. I understand that the `+` means ascending order, but what does the `-` mean? Here's an example of one such format string:
Code
// STK line format "12/23/2016,2300.00,SPY, 225.63, 225.68, 225.72, 225.62,1148991"
//string Format = "+-%m/%d/%Y,%H%M,,f3,f4,f1,f2,f6";

Posted By: Grant

Re: Unable to load multi-year 1h t6 file - 03/10/22 20:39

The History isn't meant to define a specific file name.

https://zorro-project.com/manual/en/script.htm

'-' simply means descending order
Posted By: TrumpLost

Re: Unable to load multi-year 1h t6 file - 03/16/22 23:30

So '+-' means either ascending or descending order, "please figure it out"?
© 2024 lite-C Forums