Message Boards Message Boards

0
|
3457 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

Multicharts and Mathematica

Posted 9 years ago

Hello all, I am wondering how to export total return data into a CSV acceptable to Multicharts. The data needs to be in Date,Open,High,Low,Close,Volume. Specifically, date can not have commas delimiting years, months, and days (I would prefer YYYY/MM/DD). I am new to Mathematica and have tried converting the table to strings and trying to flatten the table before partitioning it. Any help would be greatly appreciated. Thanks.

POSTED BY: Ashish K

Hi Ashish,

as you say the problem is that when you save the date in the standard format with commas, a CSV file will think of them as individual "columns".

A way to get around this is to format the date using DateString. Suppose you have downloaded data:

list = FinancialData["GE", "Feb. 5, 2014"];

this variable now contains the date (separated by commas) and the value. Like this

enter image description here

This next command formats the date into anything you like:

data = {DateString[#[[1]], {"Year", "/", "Month", "/", "Day"}], #[[2]]} & /@ list;

enter image description here

You can then safely export and import that data set in CSV format.

Cheers,

Marco

POSTED BY: Marco Thiel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract