Click here to Login





                                                   Conversion error importing data

  0

0
David
2014-01-24 21:25:59


I am trying to use the ASCII import tool to import 1 min historical data of the nasdaq100. I seem to have everything working correctly except the time interval doesn't seem to work. I believe the problem lies in there being no leading zero before my time data. So, 9:00 am for instance is just listed as 930, not 0930. I've tried searching but couldn't find anyone else having this issue. Any help would be appreciated.


Jim Harrison
2014-01-25 07:19:10

  0

Post a link to the file(or sample) and I will see if I can help.



QuantShare
2014-01-25 12:53:13

  0

Post a small sample (few lines)


David
2014-01-25 14:07:13

  0

Here is a 4-line sample between 9:58am and 10:01am, which hopefully should demonstrate the problem. The last 2 lines of this sample import correctly, the first 2 lines yield a conversion error. Just for the record, the last 3 values of each line I have skipped while importing.

19980102,958,3.2778,3.29473,3.2778,3.29473,426930,4,0,0
19980102,959,3.2778,3.29473,3.2778,3.29473,6619.07,4,0,0
19980102,1000,3.29473,3.29473,3.29473,3.29473,1654.77,4,0,0
19980102,1001,3.29473,3.29473,3.29473,3.29473,1654.77,4,0,0



Zoidberg
2014-01-25 14:32:37

  0

Hi does it work if you add the following Pre Script
(assuming "Date type" = Custom "[Y][M][D]" and Time type = "HM"):

for (int irow = 0; irow < Content.Rows.Length; ++irow)
if (Content.Rows[irow].Data[1].Length == 3)
Content.Rows[irow].Data[1] = "0" + Content.Rows[irow].Data[1];



QuantShare
2014-01-25 14:58:42

  0

David,

In the "ASCII Import" form, click on the "Pre Script" button then type the following script:

for(int i=0;i < Content.Rows.Length;i++)
{
PreScriptRow row = Content.Rows[i];
string time = row.Data[1].Trim();
if(time.Length == 3)
{
row.Data[1] = "0" + time;
}
}

The script will simply add "0" when the number of characters in time field is 3

Let me know if you have any further question



No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Commitments of Traders - Historical Data
ISE index options historical data
Index Investment Data for U.S. Futures Markets
AAII Sentiment Survey - Historical Data
Market cap, ROE, ROA and Forward PE for U.S. Stocks - Fundamental...

How-to Lessons
How to speed up watchlist and screener plug-ins when working with...
How to import trading data from CSV files
How to create trading rules based on Put and Call volume data
How to display Forex economic calendar data in a chart
How to automate the data downloading process

Related Forum Threads
Custom Date Format When Importing Data from CSV
Error in downloading data
Date conversion error on Json downloader
Importing data
Importing daily metastock data

Blog Posts
How to Automatically Import Local Data Into QuantShare
Download Trading Data using the Pre-Script
How to deal with StockTwits data
4 Links to Download Free Historical Stock Prices Data by Date
3 Market Indicators based on Fundamental Data









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.