<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 API key setup
Step1:  You can also set an environment variable using Bash
export BARCHART_API_KEY="YOURAPIKEY"
Cache queries
requests_cache is optional
use it to have a cache mechanism
a session parameter can be pass to functions
Step2:  getQuote with ONE symbol
Step3:  getQuote with SEVERAL symbols
Step4:  getHistory with ONE symbol
Step5:  getHistory with SEVERAL symbols
<ASSISTANT_TASK:>
Python Code:
#barchart.API_KEY = 'YOURAPIKEY'
Explanation: API key setup
End of explanation
import datetime
import requests_cache
session = requests_cache.CachedSession(cache_name='cache',
    backend='sqlite', expire_after=datetime.timedelta(days=1))
#session = None # pass a None session to avoid caching queries
Explanation: You can also set an environment variable using Bash
export BARCHART_API_KEY="YOURAPIKEY"
Cache queries
requests_cache is optional
use it to have a cache mechanism
a session parameter can be pass to functions
End of explanation
symbol = "^EURUSD"
quote = getQuote(symbol, session=session)
quote # quote is a dict
Explanation: getQuote with ONE symbol
End of explanation
symbols = ["ZC*1", "IBM", "GOOGL" , "^EURUSD"]
quotes = getQuote(symbols, session=session)
quotes # quotes is a Pandas DataFrame
#print(quotes.dtypes)
#print(type(quotes['serverTimestamp'][0])) # should be a pandas.tslib.Timestamp
CONFIG.output_pandas = False
quotes = getQuote(symbols, session=session)
print(quotes) # quotes is a Pandas DataFrame
CONFIG.output_pandas = True
Explanation: getQuote with SEVERAL symbols
End of explanation
symbol = 'IBM'
startDate = datetime.date(year=2014, month=9, day=28)
history = getHistory(symbol, typ='daily', startDate=startDate, session=session)
history
#print(history.dtypes)
#print(type(history['timestamp'][0])) # should be a pandas.tslib.Timestamp
#print(type(history.index[0])) # should be a pandas.tslib.Timestamp
#print(type(history['tradingDay'][0])) # should be a pandas.tslib.Timestamp
Explanation: getHistory with ONE symbol
End of explanation
symbols = ["ZC*1", "IBM", "GOOGL" , "^EURUSD"]
histories = getHistory(symbols, typ='daily', startDate=startDate, session=session)
histories
#print(histories.dtypes)
#print(type(histories.index[0])) # should be a pandas.tslib.Timestamp
#print(type(histories['timestamp'][0])) # should be a pandas.tslib.Timestamp
#histories.loc[:, :, "IBM"] #??
Explanation: getHistory with SEVERAL symbols
End of explanation
<END_TASK>