In [1]:
%matplotlib inline
from findatapy.market import Market, MarketDataRequest, MarketDataGenerator
In [2]:
from findatapy.util.dataconstants import DataConstants
In [3]:
In [4]:
market = Market(market_data_generator=MarketDataGenerator())
In [5]:
md_request = MarketDataRequest(
start_date="decade", # start date
data_source='yahoo', # use Bloomberg as data source
tickers=['Apple'], # ticker (findatapy)
fields=['close'], # which fields to download
vendor_tickers=['aapl'], # ticker (Alpha Vantage)
vendor_fields=['Close']) # which Bloomberg fields to download)
In [6]:
df = market.fetch_market(md_request)
In [7]:
df
Out[7]:
In [8]:
df['Apple.close'].pct_change().rolling(30).mean().plot(grid=True, figsize=(15,8))
Out[8]:
In [3]:
market = Market(market_data_generator=MarketDataGenerator())
In [4]:
md_request = MarketDataRequest(
start_date="decade", # start date
data_source='quandl', # use Bloomberg as data source
tickers=['APPL'], # ticker (findatapy)
fields=['close'], # which fields to download
vendor_tickers=['APPL'], # ticker (Alpha Vantage)
vendor_fields=['Close']) # which Bloomberg fields to download)
In [5]:
df = market.fetch_market(md_request)
In [13]:
df.tail()
Out[13]:
In [20]:
import datetime
boe_url = "http://www.bankofengland.co.uk/boeapps/iadb/fromshowcolumns.asp?csv.x=yes&Datefrom={start_date}&Dateto={end_date}&SeriesCodes={tickers}&CSVF=TN&UsingCodes=Y&VPD=Y&VFD=N"
start_time = datetime.date(2010, 1, 7).strftime("%d/%b/%Y")
end_time = datetime.date(2019, 10, 22).strftime("%d/%b/%Y")
In [23]:
import pandas as pd
pd.read_csv(boe_url.format(start_date=start_time, end_date=end_time,tickers='IUMBV34,IUMBV37,IUMBV42,IUMBV45'))
Out[23]:
In [26]:
#%load_ext autoreload
%autoreload 2
from findatapy.market.datavendorweb import DataVendorYahoo, DataVendorBOE
In [27]:
md_request = MarketDataRequest(
start_date="decade", # start date
data_source='boe', # use Bloomberg as data source
tickers=['IUMBV34', 'IUMBV37'], # ticker (findatapy)
fields=['close'], # which fields to download
vendor_tickers=['IUMBV34', 'IUMBV37'], # ticker (Alpha Vantage)
vendor_fields=['Close']) # which Bloomberg fields to download)
In [28]:
boe = DataVendorBOE()
In [29]:
boe.load_ticker(md_request)
Out[29]:
In [21]:
md_request.vendor_fields * 5
Out[21]:
In [6]:
import requests, json
In [10]:
payload = {
"dataset": {
"id": "cpih01",
"edition": "time-series",
"version": "6"
},
"dimensions": [
{
"name": "geography",
"options": [
"K02000001"
]
}
]
}
In [9]:
base_url = "https://api.beta.ons.gov.uk/v1"
In [11]:
requests.get(base_url, params=payload)
Out[11]:
In [ ]: