Ok I am a python beginner who tries fetching data from iforge. However I get problem with timestamp when exporting to CSV. I think timestamp should look like this "2019-03-22 23:00:00" but instead I get 1553460483. Why is that and how to fix it so it becomes in correct format in the csv file?
# coding: utf-8
import json
import csv
import urllib.request
import datetime
data = json.load(request)
time = data[0]['timestamp']
price = data[0]['price']
data = json.load(request) contains this -
[{'symbol': 'EURUSD',
'bid': 1.2345,
'ask': 1.2399,
'price': 1.2343,
'timestamp': 1553460483}]
But since I was only interested in price and timestamp I did-
time = data[0]['timestamp']
price = data[0]['price']
myprice = {'Date':time,'price':price}
And then made csv from myprice....it works but I dont know if correct =) Now to problem -
How to fix timestamp to show up correctly in CSV?